ArtesiaWater / hydropandas

Module for loading observation data into custom DataFrames
https://hydropandas.readthedocs.io
MIT License
52 stars 11 forks source link

fill station not shown when all data is filled #74

Closed OnnoEbbens closed 11 months ago

OnnoEbbens commented 2 years ago

Discovered by @martinvonk.

If you try to get meteo data from a station in a certain period that does not have data in this period and you have fill_missing_measurements=True it will return the data from another station. If this other station has all the data in this period there won't be a 'station_opvulwaarde' in the observation timeseries.

The first example below shows what goes wrong. You can see that the metadata is confusing because some parts shows the original requested station (210 Valkenburg) and some parts show the station used to fill the data (215 Voorschoten).

>>> import hydropandas as hpd
>>> hpd.EvaporationObs.from_knmi(210, et_type='EV24', startdate='2020-1-1', enddate='2020-1-10')
-----metadata------
name : EV24_VALKENBURG
x : 88603.9252503658
y : 466467.2721140531
meta : {'LON_east': {'215': 4.437}, 'LAT_north': {'215': 52.141}, 'ALT_m': {'215': -1.1}, 'NAME': {'215': 'Voorschoten'}, 'EV24': 'Referentiegewasverdamping (Makkink) (in m) / Potential evapotranspiration (Makkink) (in m)', 'x': 88603.9252503658, 'y': 466467.2721140531, 'station': 210, 'name': 'EV24_VALKENBURG'}
filename :
station : 210
meteo_var : EV24

                       EV24
2020-01-01 01:00:00  0.0004
2020-01-02 01:00:00  0.0001
2020-01-03 01:00:00  0.0001
2020-01-04 01:00:00  0.0001
2020-01-05 01:00:00  0.0002
2020-01-06 01:00:00  0.0001
2020-01-07 01:00:00  0.0004
2020-01-08 01:00:00  0.0004
2020-01-09 01:00:00  0.0002
2020-01-10 01:00:00  0.0001

If you do have data for a part of the requested period at the requested station, everything is fine:

>>> import hydropandas as hpd
>>> hpd.EvaporationObs.from_knmi(210, et_type='EV24', startdate='2016-5-1', enddate='2016-5-10')
-----metadata------
name : EV24_VALKENBURG
x : 88603.9252503658
y : 466467.2721140531
meta : {'LON_east': {'210': 4.43}, 'LAT_north': {'210': 52.171}, 'ALT_m': {'210': -0.2}, 'NAME': {'210': 'Valkenburg Zh'}, 'EV24': 'Referentiegewasverdamping (Makkink) (in m) / Potential evapotranspiration (Makkink) (in m)', 'x': 88603.9252503658, 'y': 466467.2721140531, 'station': 210, 'name': 'EV24_VALKENBURG'}
filename :
station : 210
meteo_var : EV24

                       EV24 station_opvulwaarde
2016-05-01 01:00:00  0.0023                 NaN
2016-05-02 01:00:00  0.0036                 NaN
2016-05-03 01:00:00  0.0029                 NaN
2016-05-04 01:00:00  0.0034                 215
2016-05-05 01:00:00  0.0028                 215
2016-05-06 01:00:00  0.0042                 215
2016-05-07 01:00:00  0.0043                 215
2016-05-08 01:00:00  0.0036                 215
2016-05-09 01:00:00  0.0048                 215
2016-05-10 01:00:00  0.0045                 215