Read KNMI observations using hydropandas
This notebook introduces how to use the hydropandas
package to read, process and visualise KNMI data.
Martin & Onno - 2022
Notebook contents
Observation types
Get KNMI data
Get ObsCollections
Reference evaporation types
Spatial interpolation of evaporation
[1]:
import hydropandas as hpd
from hydropandas.io import knmi
from IPython.display import display
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tqdm.auto import tqdm
from scipy.interpolate import RBFInterpolator, NearestNDInterpolator
import logging
c:\Users\vonkm\miniconda3\envs\hpd_env\lib\site-packages\tqdm\auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
from .autonotebook import tqdm as notebook_tqdm
[2]:
hpd.util.get_color_logger("INFO")
[2]:
<RootLogger root (INFO)>
Observation types
The hydropandas package has a function to read all kinds of KNMI observations. These are stored in an Obs
object. There are three types of observations you can obtain from the KNMI: - EvaporationObs
, for evaporation time series - PrecipitationObs
, for precipitation time series - MeteoObs
, for all the other meteorological time series
With the code below we get the Evaporation in [m/day] for KNMI station 344 (Rotterdam Airport).
[3]:
o = hpd.EvaporationObs.from_knmi(stn=344, start="2022")
display(o.head())
o.plot()
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable EV24from 2022-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi EV24 data from station 344-ROTTERDAM between 2022-01-01 00:00:00 and None
EV24 | |
---|---|
YYYYMMDD | |
2022-01-01 01:00:00 | 0.0003 |
2022-01-02 01:00:00 | 0.0003 |
2022-01-03 01:00:00 | 0.0002 |
2022-01-04 01:00:00 | 0.0002 |
2022-01-05 01:00:00 | 0.0001 |
[3]:
<Axes: xlabel='YYYYMMDD'>
[4]:
o = hpd.PrecipitationObs.from_knmi(stn=344, start="2022")
display(o.head())
o.plot()
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable RHfrom 2022-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi RH data from station 344-ROTTERDAM between 2022-01-01 00:00:00 and None
RH | |
---|---|
YYYYMMDD | |
2022-01-01 01:00:00 | 0.0000 |
2022-01-02 01:00:00 | 0.0002 |
2022-01-03 01:00:00 | 0.0064 |
2022-01-04 01:00:00 | 0.0000 |
2022-01-05 01:00:00 | 0.0008 |
[4]:
<Axes: xlabel='YYYYMMDD'>
attributes
A MeteoObs
object has the following attributes:
name
: station name and variablex
: x-coordinate in m RDy
: y-coordinate in m RDstation
: station numberunit
: measurement unitmeta
: dictionary with other metadata
[5]:
print(f"name: {o.name}")
print(f"x,y: {(o.x, o.y)}")
print(f"station: {o.station}")
print(f"unit", o.unit)
print("metadata:")
for key, item in o.meta.items():
print(f" {key}: {item}")
name: RH_ROTTERDAM
x,y: (90061.9308913925, 441636.8542853104)
station: 344
unit
metadata:
LON_east: 4.447
LAT_north: 51.962
ALT_m: -4.3
NAME: Rotterdam
RH: Etmaalsom van de neerslag (in m) (0 voor <0.05mm) / Daily precipitation amount (in m) (0 for <0.05mm)
Get KNMI data
There are 2 main method to obtain meteorological data:
from_knmi
from_knmi_nearest_xy
Below you can see how they can be called to obtain the precipitation data. Notice that they return the same data because station 344 is nearest to the given xy coordinates.
[6]:
o1 = hpd.PrecipitationObs.from_knmi(stn=344)
o2 = hpd.PrecipitationObs.from_knmi(xy=(90600, 442800))
o1.equals(o2)
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable RHfrom None to None
INFO:hydropandas.io.knmi:download knmi RH data from station 344-ROTTERDAM between None and None
INFO:hydropandas.io.knmi:get KNMI data from station nearest to coordinates (90600, 442800) and meteovariable RH
INFO:hydropandas.io.knmi:download knmi RH data from station 344-ROTTERDAM between None and None
[6]:
True
read options
The MeteoObs.from_knmi
method contains the following keyword arguments:
stn
: station number.startdate
: the start date of the time series you want, default is 1st of January 2019.enddate
: the end date of the time series you want, default is today.fill_missing_obs
: option to fill missing values with values from the nearest KNMI station. If measurements are filled an extra column is added to the time series in which the station number is shown that was used to fill a particular missing value.interval
: time interval of the time series, default is ‘daily’raise_exception
: option to raise an error when the requested time series is empty. ***
The 3 examples below give a brief summary of these options
[7]:
# example 1 get daily average temperature (TG) from 1900 till now
o_t = hpd.MeteoObs.from_knmi("TG", stn=344, start="1960")
o_t.plot(figsize=(16, 4), grid=True)
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable TGfrom 1960-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi TG data from station 344-ROTTERDAM between 1960-01-01 00:00:00 and None
[7]:
<Axes: xlabel='YYYYMMDD'>
[8]:
# example 2 get daily average precipitation from 1972 with and without filling missing measurements
o_rd = hpd.PrecipitationObs.from_knmi(
"RD", stn=892, start="1972", end="2023", fill_missing_obs=False
)
o_rd.plot(figsize=(16, 4), grid=True)
o_rd_filled = hpd.PrecipitationObs.from_knmi(
"RD", stn=892, start="1972", end="2023", fill_missing_obs=True
)
fig, ax = plt.subplots(figsize=(16, 4))
o_rd_filled.loc[o_rd_filled["station"] == "892", "RD"].plot(
ax=ax, grid=True, label="oorspronkelijke metingen"
)
o_rd_filled.loc[o_rd_filled["station"] != "892", "RD"].plot(
ax=ax, color="orange", label="opgevulde metingen"
)
ax.legend()
INFO:hydropandas.io.knmi:get KNMI data from station 892 and meteo variable RDfrom 1972-01-01 00:00:00 to 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:download knmi RD data from station 892-GIERSBERGEN between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 892 and meteo variable RDfrom 1972-01-01 00:00:00 to 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:changing end_date to 2023-01-01
INFO:hydropandas.io.knmi:download knmi RD data from station 892-GIERSBERGEN between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:station 892 has no measurements before 1993-11-01 09:00:00
INFO:hydropandas.io.knmi:station 892 has 7975 missing measurements
INFO:hydropandas.io.knmi:trying to fill 7975 measurements with station [827]
INFO:hydropandas.io.knmi:download knmi RD data from station 827-TILBURG between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
[8]:
<matplotlib.legend.Legend at 0x1ba3821bac0>
[9]:
# see the station_opvulwaarde
display(o_rd.head())
display(o_rd_filled.head())
RD | |
---|---|
YYYYMMDD | |
1993-11-01 09:00:00 | 0.0000 |
1993-11-02 09:00:00 | 0.0000 |
1993-11-03 09:00:00 | 0.0005 |
1993-11-04 09:00:00 | 0.0000 |
1993-11-05 09:00:00 | 0.0000 |
RD | station | |
---|---|---|
1972-01-01 09:00:00 | 0.0 | 827 |
1972-01-02 09:00:00 | 0.0 | 827 |
1972-01-03 09:00:00 | 0.0 | 827 |
1972-01-04 09:00:00 | 0.0 | 827 |
1972-01-05 09:00:00 | 0.0 | 827 |
[10]:
# example 3 get evaporation
logging.getLogger().getEffectiveLevel()
logging.getLogger().setLevel(logging.INFO)
o_ev = hpd.EvaporationObs.from_knmi(
stn=344, start="1972", end="2023", fill_missing_obs=True
)
o_ev
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable EV24from 1972-01-01 00:00:00 to 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 344-ROTTERDAM between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:station 344 has no measurements before 1987-09-12 01:00:00
INFO:hydropandas.io.knmi:station 344 has 5809 missing measurements
INFO:hydropandas.io.knmi:trying to fill 5809 measurements with station [215]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 215-VOORSCHOTEN between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:trying to fill 5809 measurements with station [330]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 330-HOEK-VAN-HOLLAND between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:trying to fill 5809 measurements with station [210]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 210-VALKENBURG between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:trying to fill 5563 measurements with station [348]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 348-CABAUW-MAST between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:trying to fill 5499 measurements with station [240]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 240-SCHIPHOL between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:trying to fill 5499 measurements with station [356]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 356-HERWIJNEN between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
INFO:hydropandas.io.knmi:trying to fill 5499 measurements with station [260]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 260-DE-BILT between 1972-01-01 00:00:00 and 2023-01-01 00:00:00
[10]:
EV24 | station | |
---|---|---|
1972-01-01 01:00:00 | 0.0002 | 260 |
1972-01-02 01:00:00 | 0.0002 | 260 |
1972-01-03 01:00:00 | 0.0002 | 260 |
1972-01-04 01:00:00 | 0.0000 | 260 |
1972-01-05 01:00:00 | 0.0000 | 260 |
... | ... | ... |
2022-12-28 01:00:00 | 0.0003 | 344 |
2022-12-29 01:00:00 | 0.0001 | 344 |
2022-12-30 01:00:00 | 0.0002 | 344 |
2022-12-31 01:00:00 | 0.0001 | 344 |
2023-01-01 01:00:00 | 0.0001 | 344 |
18629 rows × 2 columns
Get ObsCollections
It is also possible to read multiple Observation
objects at once and store them in an ObsCollection
object. For this we use the ObsCollection.from_knmi()
method. Below an example to obtain precipitation (RH) and evaporation (EV24) from the KNMI station of Rotterdam and De Bilt.
[11]:
oc = hpd.read_knmi(stns=[344, 260], meteo_vars=["RH", "EV24"])
oc
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable RHfrom None to None
INFO:hydropandas.io.knmi:download knmi RH data from station 344-ROTTERDAM between None and None
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable RHfrom None to None
INFO:hydropandas.io.knmi:download knmi RH data from station 260-DE-BILT between None and None
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable EV24from None to None
INFO:hydropandas.io.knmi:download knmi EV24 data from station 344-ROTTERDAM between None and None
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable EV24from None to None
INFO:hydropandas.io.knmi:download knmi EV24 data from station 260-DE-BILT between None and None
[11]:
x | y | filename | source | unit | station | meteo_var | obs | |
---|---|---|---|---|---|---|---|---|
name | ||||||||
RH_ROTTERDAM | 90061.930891 | 441636.854285 | KNMI | 344 | RH | PrecipitationObs RH_ROTTERDAM -----metadata---... | ||
RH_DE-BILT | 140565.152506 | 456790.999119 | KNMI | 260 | RH | PrecipitationObs RH_DE-BILT -----metadata-----... | ||
EV24_ROTTERDAM | 90061.930891 | 441636.854285 | KNMI | 344 | EV24 | EvaporationObs EV24_ROTTERDAM -----metadata---... | ||
EV24_DE-BILT | 140565.152506 | 456790.999119 | KNMI | 260 | EV24 | EvaporationObs EV24_DE-BILT -----metadata-----... |
Besides giving a list of stations it is also possible to: - specify locations
as a dataframe with x, y coordinates (RD_new), the function will find the nearest KNMI station for every location. - specify xmid
and ymid
which are 2 arrays corresponding to a structured grid to obtain the nearest KNMI station for every cell in the grid.
[12]:
location = pd.DataFrame(index=["Rotterdam"], data={"x": 77500, "y": 399500})
hpd.read_knmi(locations=location, meteo_vars=["RH"])
INFO:hydropandas.io.knmi:get KNMI data from station 340 and meteo variable RHfrom None to None
INFO:hydropandas.io.knmi:download knmi RH data from station 340-WOENSDRECHT between None and None
[12]:
x | y | filename | source | unit | station | meteo_var | obs | |
---|---|---|---|---|---|---|---|---|
name | ||||||||
RH_WOENSDRECHT | 82342.243033 | 384814.046707 | KNMI | 340 | RH | PrecipitationObs RH_WOENSDRECHT -----metadata-... |
[13]:
hpd.read_knmi(xy=((77500, 399500),), meteo_vars=["RH"])
INFO:hydropandas.io.knmi:get KNMI data from station 340 and meteo variable RHfrom None to None
INFO:hydropandas.io.knmi:download knmi RH data from station 340-WOENSDRECHT between None and None
[13]:
x | y | filename | source | unit | station | meteo_var | obs | |
---|---|---|---|---|---|---|---|---|
name | ||||||||
RH_WOENSDRECHT | 82342.243033 | 384814.046707 | KNMI | 340 | RH | PrecipitationObs RH_WOENSDRECHT -----metadata-... |
Precipitation
The KNMI database has three different precipitation products: 1. Daily data from a meteorological station 2. Daily data from a neerslag (precipitation) station 3. Hourly data from a meteorological station
All three products can be obtained using the from_knmi
method. Product 1 and 2 can also be accessed without the api.
If you want to access the data from a neerslag (precipitation) station you should add stn_type='precipitation'
to the PrecipitationObs.from_knmi()
method.
[14]:
# daily meteo station
precip1 = hpd.PrecipitationObs.from_knmi(stn=260, start="2010-1-1", end="2010-1-10")
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable RHfrom 2010-01-01 00:00:00 to 2010-01-10 00:00:00
INFO:hydropandas.io.knmi:download knmi RH data from station 260-DE-BILT between 2010-01-01 00:00:00 and 2010-01-10 00:00:00
[15]:
# daily neerslag station
precip2 = hpd.PrecipitationObs.from_knmi(
meteo_var="RD", stn=550, start="2010-1-1", end="2010-1-10"
)
INFO:hydropandas.io.knmi:get KNMI data from station 550 and meteo variable RDfrom 2010-01-01 00:00:00 to 2010-01-10 00:00:00
INFO:hydropandas.io.knmi:download knmi RD data from station 550-DE-BILT between 2010-01-01 00:00:00 and 2010-01-10 00:00:00
[16]:
# hourly meteo station (only works with api)
precip3 = hpd.PrecipitationObs.from_knmi(
stn=260,
start="2010-1-1",
end="2010-1-10",
interval="hourly",
)
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable RHfrom 2010-01-01 00:00:00 to 2010-01-10 00:00:00
INFO:hydropandas.io.knmi:download knmi RH data from station 260-DE-BILT between 2010-01-01 00:00:00 and 2010-01-10 00:00:00
[17]:
# daily meteo station without api
precip4 = hpd.PrecipitationObs.from_knmi(
stn=260,
start="2010-1-1",
end="2010-1-10",
use_api=False,
)
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable RHfrom 2010-01-01 00:00:00 to 2010-01-10 00:00:00
INFO:hydropandas.io.knmi:download knmi RH data from station 260-DE-BILT between 2010-01-01 00:00:00 and 2010-01-10 00:00:00
[18]:
# daily neerslag station without api
precip5 = hpd.PrecipitationObs.from_knmi(
meteo_var="RD",
stn=550,
start="2010-1-1",
end="2010-1-10",
use_api=False,
)
INFO:hydropandas.io.knmi:get KNMI data from station 550 and meteo variable RDfrom 2010-01-01 00:00:00 to 2010-01-10 00:00:00
INFO:hydropandas.io.knmi:download knmi RD data from station 550-DE-BILT between 2010-01-01 00:00:00 and 2010-01-10 00:00:00
Below are the differences between the precipitation estimates from different station types.
[19]:
fig, ax = plt.subplots(figsize=(16, 4))
precip1["RH"].plot(
ax=ax,
drawstyle="steps",
ls="--",
lw=3,
label=str(precip1.station) + "_dagelijks",
)
precip2["RD"].plot(
ax=ax,
drawstyle="steps",
ls="--",
lw=3,
label=str(precip2.station) + "_dagelijks",
)
precip3["RH"].plot(
ax=ax,
drawstyle="steps",
label=str(precip3.station) + "_uurlijks",
)
precip4["RH"].plot(
ax=ax,
drawstyle="steps",
marker="o",
label=str(precip4.station) + "_dagelijks_geen_api",
)
precip5["RD"].plot(
ax=ax,
drawstyle="steps",
marker="o",
label=str(precip5.station) + "_dagelijks_geen_api",
)
ax.legend()
ax.grid()
ax.set_ylabel("neerslag [m/dag]")
[19]:
Text(0, 0.5, 'neerslag [m/dag]')
The locations of the stations can be plotted onto a map using the contextily package.
[20]:
import contextily as cx
oc = hpd.ObsCollection([precip1, precip2])
gdf = oc.to_gdf()
gdf = gdf.set_crs(28992)
gdf["name"] = gdf.index
ax = gdf.buffer(2000).plot(alpha=0, figsize=(8, 8))
gdf.plot("name", ax=ax, cmap="jet", legend=True, markersize=100)
cx.add_basemap(ax, crs=28992)
Evaporation
KNMI provides the Makking reference evaporation (meteo_var EV24). Hydropandas provides a posssibility to calculate three different types of reference evaporation from data of KNMI meteo stations: - Penman - Hargreaves - Makkink (in the same way as KNMI)
These three types of reference evaporation are calculated the same way as described by Allen et al. 1990 and STOWA rapport. Be aware that the last report is written in Dutch and contains errors in the units.
The following variables from the KNMI are used for each reference evaporation type: - Penman: average (TG), minimum (TN) and maximum (TX) temperature, de global radiation (Q), de windspeed (FG) en de relative humidity (PG). - Hargreaves: average (TG), minimum (TN) and maximum (TX) temperature - Makkink: average temperature (TG) and global radiation (Q)
Comparison Makkink
Lets compare Hypdropandas Makkink verdamping evaporation with the EV24 Makkink verdamping of the KNMI. When Hydropandas Makkink evaporation is rounded (on 4 decimals), the estimate is the same as for the KNMI estimate.
[21]:
ev24 = hpd.EvaporationObs.from_knmi(
stn=260, start="2022-1-1"
) # et_type='EV24' by default
makk = hpd.EvaporationObs.from_knmi(meteo_var="makkink", stn=260, start="2022-1-1")
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable EV24from 2022-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi EV24 data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable makkinkfrom 2022-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi TG data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi Q data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
[22]:
f, ax = plt.subplots(2, figsize=(11, 4))
ax[0].plot(ev24, label=ev24.name)
ax[0].plot(makk.round(4), label=makk.name)
ax[0].set_ylabel("E [m/d]")
ax[0].set_title("Makkink evaporation")
ax[0].legend()
ax[1].plot(ev24["EV24"] - makk["makkink"].round(4))
ax[1].set_title("Difference Makkink KNMI and Hydropandas")
f.tight_layout()
Comparison Penman, Makkink en Hargreaves
On average Penman gives a higher estimate for reference evaporation than Makkink (~0.55mm). This can be explained by the fact that Penman takes into account windspeed and Makkink ignores this proces. Hargreaves is a very simple way of estimation the evaporation, only taking into account temperature and extraterrestial radiation. Therefore it gives a lower estimate for the reference evporatoin compared to the two other methods (~-0.35mm wrt Makkink).
[23]:
penm = hpd.EvaporationObs.from_knmi(
meteo_var="penman", stn=260, start="2022-1-1"
).squeeze()
harg = hpd.EvaporationObs.from_knmi(
meteo_var="hargreaves", stn=260, start="2022-1-1"
).squeeze()
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable penmanfrom 2022-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi TG data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi TN data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi TX data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi Q data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi FG data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi UG data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable hargreavesfrom 2022-01-01 00:00:00 to None
INFO:hydropandas.io.knmi:download knmi TG data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi TN data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
INFO:hydropandas.io.knmi:download knmi TX data from station 260-DE-BILT between 2022-01-01 00:00:00 and None
[24]:
f, ax = plt.subplots(figsize=(11, 4))
ax.plot(makk, label=makk.name)
ax.plot(penm, label=penm.name)
ax.plot(harg, label=harg.name)
ax.legend()
[24]:
<matplotlib.legend.Legend at 0x1ba3bf49030>
Spatial interpolate (Makkink) Evaporation?
Does interpolation matter? There are ways to interpolate evaporation datasets. However currently the nearest station is always used in HydroPandas’ methods. Does this give different results? First lets look spatially.
Get all stations where EV24 is measured
[25]:
stns = knmi.get_stations(meteo_var="EV24").sort_index()
Collect all EV24 data ever measured by KNMI
[26]:
tmin = "1950-01-01"
tmax = "2022-04-11"
# empty dataframe
df = pd.DataFrame(
columns=stns.index
) # index=pd.date_range(start=tmin, end=tmax, freq='H')
for stn in tqdm(stns.index):
df_stn = hpd.MeteoObs.from_knmi(
meteo_var="EV24", stn=stn, fill_missing_obs=False, start=tmin, end=tmax
)
df[stn] = df_stn
df
0%| | 0/36 [00:00<?, ?it/s]
INFO:hydropandas.io.knmi:get KNMI data from station 210 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 210-VALKENBURG between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
3%|▎ | 1/36 [00:02<01:19, 2.27s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 215 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 215-VOORSCHOTEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
6%|▌ | 2/36 [00:03<00:57, 1.70s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 235 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 235-DE-KOOY between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
8%|▊ | 3/36 [00:05<01:04, 1.96s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 240 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 240-SCHIPHOL between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
11%|█ | 4/36 [00:07<01:01, 1.91s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 242 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 242-VLIELAND between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 242-VLIELAND between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
14%|█▍ | 5/36 [00:08<00:48, 1.55s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 249 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 249-BERKHOUT between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
17%|█▋ | 6/36 [00:09<00:40, 1.36s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 251 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 251-HOORN-TERSCHELLING between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
19%|█▉ | 7/36 [00:10<00:36, 1.24s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 257 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 257-WIJK-AAN-ZEE between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
22%|██▏ | 8/36 [00:11<00:31, 1.12s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 260-DE-BILT between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
25%|██▌ | 9/36 [00:13<00:40, 1.51s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 265 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 265-SOESTERBERG between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
28%|██▊ | 10/36 [00:15<00:36, 1.42s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 267 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 267-STAVOREN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
31%|███ | 11/36 [00:16<00:34, 1.39s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 269 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 269-LELYSTAD between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
33%|███▎ | 12/36 [00:17<00:32, 1.36s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 270 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 270-LEEUWARDEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
36%|███▌ | 13/36 [00:19<00:37, 1.62s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 273 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 273-MARKNESSE between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
39%|███▉ | 14/36 [00:21<00:36, 1.64s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 275 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 275-DEELEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
42%|████▏ | 15/36 [00:23<00:36, 1.74s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 277 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 277-LAUWERSOOG between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
44%|████▍ | 16/36 [00:25<00:35, 1.78s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 278 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 278-HEINO between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
47%|████▋ | 17/36 [00:27<00:34, 1.83s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 279 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 279-HOOGEVEEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
50%|█████ | 18/36 [00:29<00:34, 1.93s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 280 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 280-EELDE between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
53%|█████▎ | 19/36 [00:31<00:34, 2.00s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 283 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 283-HUPSEL between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
56%|█████▌ | 20/36 [00:33<00:33, 2.09s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 286 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 286-NIEUW-BEERTA between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
58%|█████▊ | 21/36 [00:36<00:31, 2.08s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 290 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 290-TWENTHE between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
61%|██████ | 22/36 [00:38<00:28, 2.06s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 310 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 310-VLISSINGEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
64%|██████▍ | 23/36 [00:40<00:27, 2.11s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 319 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 319-WESTDORPE between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
67%|██████▋ | 24/36 [00:42<00:23, 2.00s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 323 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 323-WILHELMINADORP between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
69%|██████▉ | 25/36 [00:43<00:20, 1.90s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 330 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 330-HOEK-VAN-HOLLAND between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
72%|███████▏ | 26/36 [00:45<00:19, 1.91s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 340 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 340-WOENSDRECHT between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 340-WOENSDRECHT between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
75%|███████▌ | 27/36 [00:47<00:16, 1.78s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 344-ROTTERDAM between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
78%|███████▊ | 28/36 [00:49<00:16, 2.08s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 348 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 348-CABAUW-MAST between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
81%|████████ | 29/36 [00:51<00:14, 2.08s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 350 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 350-GILZE-RIJEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
83%|████████▎ | 30/36 [00:54<00:13, 2.22s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 356 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 356-HERWIJNEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
86%|████████▌ | 31/36 [00:56<00:10, 2.01s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 370 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 370-EINDHOVEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
89%|████████▉ | 32/36 [00:58<00:08, 2.10s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 375 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 375-VOLKEL between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
92%|█████████▏| 33/36 [01:00<00:06, 2.06s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 377 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 377-ELL between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
94%|█████████▍| 34/36 [01:01<00:03, 1.89s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 380 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 380-MAASTRICHT between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
97%|█████████▋| 35/36 [01:04<00:02, 2.11s/it]
INFO:hydropandas.io.knmi:get KNMI data from station 391 and meteo variable EV24from 1950-01-01 00:00:00 to 2022-04-11 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 391-ARCEN between 1950-01-01 00:00:00 and 2022-04-11 00:00:00
100%|██████████| 36/36 [01:06<00:00, 1.86s/it]
[26]:
210 | 215 | 235 | 240 | 242 | 249 | 251 | 257 | 260 | 265 | ... | 340 | 344 | 348 | 350 | 356 | 370 | 375 | 377 | 380 | 391 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
YYYYMMDD | |||||||||||||||||||||
1987-03-26 01:00:00 | 0.0006 | NaN | 0.0006 | NaN | NaN | NaN | NaN | NaN | 0.0005 | NaN | ... | NaN | NaN | NaN | NaN | NaN | 0.0008 | NaN | NaN | 0.0010 | NaN |
1987-03-27 01:00:00 | 0.0016 | NaN | 0.0015 | NaN | NaN | NaN | NaN | NaN | 0.0016 | NaN | ... | NaN | NaN | 0.0016 | NaN | NaN | 0.0017 | NaN | NaN | 0.0024 | NaN |
1987-03-28 01:00:00 | 0.0008 | NaN | 0.0007 | NaN | NaN | NaN | NaN | NaN | 0.0007 | NaN | ... | NaN | NaN | 0.0007 | NaN | NaN | 0.0005 | NaN | NaN | 0.0008 | NaN |
1987-03-29 01:00:00 | 0.0013 | NaN | 0.0007 | NaN | NaN | NaN | NaN | NaN | 0.0010 | NaN | ... | NaN | NaN | NaN | NaN | NaN | 0.0013 | NaN | NaN | 0.0014 | NaN |
1987-03-30 01:00:00 | 0.0019 | NaN | 0.0021 | NaN | NaN | NaN | NaN | NaN | 0.0016 | NaN | ... | NaN | NaN | 0.0017 | NaN | NaN | 0.0015 | NaN | NaN | 0.0018 | NaN |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
2016-04-29 01:00:00 | 0.0023 | 0.0022 | 0.0020 | 0.0020 | NaN | 0.0015 | 0.0018 | 0.0014 | 0.0022 | NaN | ... | NaN | 0.0026 | 0.0023 | 0.0018 | 0.0022 | 0.0024 | 0.0019 | 0.0025 | 0.0025 | 0.0023 |
2016-04-30 01:00:00 | 0.0023 | 0.0021 | 0.0025 | 0.0020 | NaN | 0.0022 | 0.0027 | 0.0022 | 0.0014 | NaN | ... | NaN | 0.0021 | 0.0016 | 0.0014 | 0.0012 | 0.0015 | 0.0014 | 0.0010 | 0.0010 | 0.0009 |
2016-05-01 01:00:00 | 0.0023 | 0.0022 | 0.0029 | 0.0022 | NaN | 0.0021 | 0.0028 | 0.0026 | 0.0023 | NaN | ... | NaN | 0.0025 | 0.0022 | 0.0021 | 0.0021 | 0.0022 | 0.0021 | 0.0009 | 0.0011 | 0.0015 |
2016-05-02 01:00:00 | 0.0036 | 0.0035 | 0.0036 | 0.0034 | NaN | 0.0034 | 0.0035 | 0.0035 | 0.0035 | NaN | ... | NaN | 0.0036 | 0.0036 | 0.0035 | 0.0034 | 0.0031 | 0.0030 | 0.0029 | 0.0031 | 0.0031 |
2016-05-03 01:00:00 | 0.0029 | 0.0028 | 0.0022 | 0.0029 | NaN | 0.0028 | 0.0026 | 0.0027 | 0.0034 | NaN | ... | NaN | 0.0031 | 0.0033 | 0.0034 | 0.0034 | 0.0035 | 0.0034 | 0.0034 | 0.0036 | 0.0035 |
10632 rows × 36 columns
According to the KNMI, thin plate spline is the best way to interpolate Makkink evaporation. Thats also how they provide the gridded Makkink evaporation :
Evaporation Dataset - gridded daily Makkink evaporation for the Netherlands
Interpolation of Makkink evaporation in the Netherlands - Paul Hiemstra and Raymond Sluiter (2011)
[28]:
xy = stns.loc[df.columns, ["x", "y"]]
for idx in tqdm(df.index[0 : len(df) : 2000]):
# get all stations with values for this date
val = df.loc[idx].dropna() * 1000 # mm
# get stations for this date
coor = xy.loc[val.index].to_numpy()
if (
len(val) < 3
): # if there are less than 3 stations, thin plate spline does not work
# options: linear, multiquadric, gaussian,
kernel = "linear"
else:
kernel = "thin_plate_spline"
# options:
# 'inverse_quadratic', 'linear', 'multiquadric', 'gaussian',
# 'inverse_multiquadric', 'cubic', 'quintic', 'thin_plate_spline'
# create an scipy interpolator
rbf = RBFInterpolator(coor, val.to_numpy(), epsilon=1, kernel=kernel)
nea = NearestNDInterpolator(coor, val.to_numpy())
# interpolate on grid of the Netherlands
grid = np.mgrid[10000:280000:100j, 300000:620000:100j]
grid2 = grid.reshape(2, -1).T # interpolator only takes array [[x0, y0],
# [x1, y1]]
val_rbf = rbf.__call__(grid2).reshape(100, 100)
val_nea = nea.__call__(grid2).reshape(100, 100)
# create figure
fig, ax = plt.subplot_mosaic("AAAABBBBC", figsize=(10, 5.925))
fig.suptitle(f"Makkink Evaporation [mm] {idx.date()}", y=0.95)
vmin = 0
vmax = 5
ax["A"].set_title(f"Interpolation: {kernel}")
ax["A"].pcolormesh(grid[0], grid[1], val_rbf, vmin=vmin, vmax=vmax)
ax["B"].set_title(f"Interpolation: Nearest")
ax["B"].pcolormesh(grid[0], grid[1], val_nea, vmin=vmin, vmax=vmax)
ax["A"].scatter(*coor.T, c=val, s=100, ec="k", vmin=vmin, vmax=vmax)
p = ax["B"].scatter(*coor.T, c=val, s=100, ec="k", vmin=vmin, vmax=vmax)
cb = fig.colorbar(p, cax=ax["C"])
cb.set_label("[mm]")
fig.tight_layout()
0%| | 0/6 [00:00<?, ?it/s]
100%|██████████| 6/6 [00:01<00:00, 4.51it/s]
The same method is implemented in Hydropandas for an ObsCollection.
[29]:
sd = "2022-01-01"
ed = "2022-12-31"
oc = hpd.read_knmi(stns=stns.index, starts=sd, ends=ed, meteo_vars=["EV24"])
oc_et = oc.interpolate(xy=[(100000, 330000)])
eti = oc_et.iloc[0].obs
eti
INFO:hydropandas.io.knmi:get KNMI data from station 210 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 210-VALKENBURG between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 210-VALKENBURG between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 215 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 215-VOORSCHOTEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 235 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 235-DE-KOOY between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 240 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 240-SCHIPHOL between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 242 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 242-VLIELAND between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 242-VLIELAND between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 249 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 249-BERKHOUT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 251 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 251-HOORN-TERSCHELLING between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 257 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 257-WIJK-AAN-ZEE between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 260 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 260-DE-BILT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 265 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 265-SOESTERBERG between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 265-SOESTERBERG between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 267 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 267-STAVOREN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 269 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 269-LELYSTAD between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 270 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 270-LEEUWARDEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 273 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 273-MARKNESSE between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 275 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 275-DEELEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 277 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 277-LAUWERSOOG between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 278 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 278-HEINO between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 279 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 279-HOOGEVEEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 280 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 280-EELDE between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 283 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 283-HUPSEL between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 286 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 286-NIEUW-BEERTA between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 290 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 290-TWENTHE between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 310 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 310-VLISSINGEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 319 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 319-WESTDORPE between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 323 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 323-WILHELMINADORP between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 330 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 330-HOEK-VAN-HOLLAND between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 340 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 340-WOENSDRECHT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 340-WOENSDRECHT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 344 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 344-ROTTERDAM between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 348 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 348-CABAUW-MAST between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 350 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 350-GILZE-RIJEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 356 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 356-HERWIJNEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 370 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 370-EINDHOVEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 375 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 375-VOLKEL between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 377 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 377-ELL between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 380 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 380-MAASTRICHT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:get KNMI data from station 391 and meteo variable EV24from 2022-01-01 00:00:00 to 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:download knmi EV24 data from station 391-ARCEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
[29]:
100000_330000 | |
---|---|
YYYYMMDD | |
2022-01-01 01:00:00 | 0.000254 |
2022-01-02 01:00:00 | 0.000570 |
2022-01-03 01:00:00 | 0.000330 |
2022-01-04 01:00:00 | 0.000142 |
2022-01-05 01:00:00 | 0.000157 |
... | ... |
2022-12-27 01:00:00 | 0.000151 |
2022-12-28 01:00:00 | 0.000260 |
2022-12-29 01:00:00 | 0.000101 |
2022-12-30 01:00:00 | 0.000141 |
2022-12-31 01:00:00 | 0.000077 |
365 rows × 1 columns
[30]:
etn = hpd.MeteoObs.from_knmi(
xy=(100000, 330000), start=sd, end=ed, meteo_var="EV24", fill_missing_obs=True
)
etn
INFO:hydropandas.io.knmi:get KNMI data from station nearest to coordinates (100000, 330000) and meteovariable EV24
INFO:hydropandas.io.knmi:download knmi EV24 data from station 340-WOENSDRECHT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:no measurements found for station 340-WOENSDRECHT between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:station 340 has no measurements between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:trying to get measurements from nearest station
INFO:hydropandas.io.knmi:download knmi EV24 data from station 323-WILHELMINADORP between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
INFO:hydropandas.io.knmi:station 323 has 4 missing measurements
INFO:hydropandas.io.knmi:trying to fill 4 measurements with station [310]
INFO:hydropandas.io.knmi:download knmi EV24 data from station 310-VLISSINGEN between 2022-01-01 00:00:00 and 2022-12-31 00:00:00
[30]:
EV24 | station | |
---|---|---|
2022-01-01 01:00:00 | 0.0003 | 323 |
2022-01-02 01:00:00 | 0.0004 | 323 |
2022-01-03 01:00:00 | 0.0003 | 323 |
2022-01-04 01:00:00 | 0.0002 | 323 |
2022-01-05 01:00:00 | 0.0002 | 323 |
... | ... | ... |
2022-12-27 01:00:00 | 0.0004 | 323 |
2022-12-28 01:00:00 | 0.0003 | 323 |
2022-12-29 01:00:00 | 0.0001 | 323 |
2022-12-30 01:00:00 | 0.0002 | 323 |
2022-12-31 01:00:00 | 0.0001 | 323 |
365 rows × 2 columns
As can be seen, for one location the interpolation method is significantly slower. Lets see how the values compare for a time series.
[31]:
fig, ax = plt.subplots(2, 1, figsize=(8, 6), sharex=True)
eti.plot(ax=ax[0])
etn.plot(ax=ax[0], linestyle="--", color="C1")
ax[0].set_title("Comparison Interpolated and Nearest Makkink Evaporation")
ax[0].set_ylabel("[mm]")
ax[0].grid()
ax[0].legend(["Interpolated", "Nearest"])
(eti.squeeze() - etn["EV24"].squeeze()).plot(ax=ax[1], color="C2")
ax[1].set_ylabel("[mm]")
ax[1].grid()
ax[1].legend(["Interpolated - Nearest"])
[31]:
<matplotlib.legend.Legend at 0x1ba3ca4fa00>
The interpolated evaporation can also be collected for multiple points (using x and y in a list of DataFrame) in an ObsCollection
[32]:
oc_et = oc.interpolate(xy=[(100000, 320000), (100000, 330000), (100000, 340000)])
oc_et
[32]:
x | y | filename | source | unit | station | meteo_var | obs | |
---|---|---|---|---|---|---|---|---|
name | ||||||||
100000_320000 | 100000 | 320000 | interpolation | NaN | EV24 | EvaporationObs 100000_320000 -----metadata----... | ||
100000_330000 | 100000 | 330000 | interpolation | NaN | EV24 | EvaporationObs 100000_330000 -----metadata----... | ||
100000_340000 | 100000 | 340000 | interpolation | NaN | EV24 | EvaporationObs 100000_340000 -----metadata----... |
The interpolation method is slow at first, but if collected for many different locations the time penalty is not that significant anymore.