{ "cells": [ { "cell_type": "markdown", "id": "999bc8b7-804c-4301-b8c7-5077a38dc06f", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "# Potential Evapotranspiration from ZAMG data\n", "*A. Kokimova, November 2021, University of Graz*\n", "\n", "Data source: ZAMG - https://data.hub.zamg.ac.at\n", "\n", "What is done:\n", "\n", "- load the station data from ZAMG\n", "- estimate potential evapotranspiration\n", "- plot and store results" ] }, { "cell_type": "code", "execution_count": null, "id": "7a2ae568-3c3b-44f5-8b82-ab5a99d35d2d", "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pyet\n", "pyet.show_versions()" ] }, { "cell_type": "markdown", "id": "da6f3e98-0073-4db9-b763-03beb2611e78", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Loading daily data from ZAMG (Messstationen Tagesdaten)\n", "\n", "station: Graz Universität 16412\n", "\n", "Selected variables:\n", "- globalstrahlung (global radiation), J/cm2 needs to be in MJ/m3d, ZAMG abbreviation - strahl\n", "- arithmetische windgeschwindigkeit (wind speed), m/s, ZAMG abbreviation - vv\n", "- relative feuchte (relative humidity), %, ZAMG abbreviation - rel\n", "- lufttemparatur (air temperature) in 2 m, C, ZAMG abbreviation - t\n", "- lufttemperatur (air temperature) max in 2 m, C, ZAMG abbreviation - tmax\n", "- lufttemperatur (air temperature) min in 2 m, C, ZAMG abbreviation - tmin\n", "- latitute and elevation of a station" ] }, { "cell_type": "code", "execution_count": null, "id": "236434b2-3c33-4772-93ec-de0cb7317209", "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "#read data\n", "data_16412 = pd.read_csv('data/example_1/klima_daily.csv', index_col=1, parse_dates=True)\n", "data_16412" ] }, { "cell_type": "markdown", "id": "22ebf3bc-6b9a-4f81-a455-7ca1b51879dd", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Calculate PET for Graz Universität - 16412" ] }, { "cell_type": "code", "execution_count": null, "id": "bc5ba933-22c2-4c5b-9ca6-43a4bcdad344", "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "# Convert Glabalstrahlung J/cm2 to MJ/m2 by dividing to 100\n", "\n", "meteo = pd.DataFrame({\"time\":data_16412.index, \"tmean\":data_16412.t, \"tmax\":data_16412.tmax, \"tmin\":data_16412.tmin, \"rh\":data_16412.rel, \n", " \"wind\":data_16412.vv, \"rs\":data_16412.strahl/100})\n", "time, tmean, tmax, tmin, rh, wind, rs = [meteo[col] for col in meteo.columns]\n", "\n", "lat = 47.077778*np.pi/180 # Latitude of the meteorological station, converting from degrees to radians\n", "elevation = 367 # meters above sea-level\n", "\n", "# Estimate evapotranspiration with four different methods and create a dataframe\n", "pet_df = pyet.calculate_all(tmean, wind, rs, elevation, lat, tmax=tmax,\n", " tmin=tmin, rh=rh)" ] }, { "cell_type": "markdown", "id": "e6e2564c-48ed-46b7-a275-fd17db592456", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Plot results" ] }, { "cell_type": "code", "execution_count": null, "id": "c9a4582f-219b-47f8-9ed2-dac80720cf55", "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "fig, axs = plt.subplots(figsize=(13,4), ncols=2)\n", "pet_df.plot(ax=axs[0])\n", "pet_df.cumsum().plot(ax=axs[1], legend=False)\n", "\n", "axs[0].set_ylabel(\"PET [mm/day]\", fontsize=12)\n", "axs[1].set_ylabel(\"Cumulative PET [mm]\", fontsize=12)\n", "axs[0].legend(ncol=6, loc=[0,1.])\n", "for i in (0,1):\n", " axs[i].set_xlabel(\"Date\", fontsize=12)" ] }, { "cell_type": "markdown", "id": "1fe2a55b-838a-4e3a-a621-c5fe55db399a", "metadata": { "pycharm": { "name": "#%% md\n" } }, "source": [ "## Store results" ] }, { "cell_type": "code", "execution_count": null, "id": "3c5e47fb-3ec7-4bc9-ad6c-be0edc67ba09", "metadata": { "pycharm": { "name": "#%%\n" } }, "outputs": [], "source": [ "#plt.savefig(\"PET_methods.png\", dpi=300)\n", "#pet_u.to_csv('../evap_16412.csv')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" } }, "nbformat": 4, "nbformat_minor": 5 }