Skip to content

Commit

Permalink
fix for knmi precipitation data station attribute is sometimes a seri…
Browse files Browse the repository at this point in the history
…es with duplicate entries #241
  • Loading branch information
OnnoEbbens committed Sep 27, 2024
1 parent f02849d commit 66be64c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 10 additions & 5 deletions hydropandas/io/knmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def get_knmi_obs(
**kwargs:
fill_missing_obs : bool, optional
if True nan values in time series are filled with nearby time series.
The default is False.
The default is False. Note: if the given stn has no data between start and
end the data from nearby stations is used. In this case the metadata of the
Observation is the metadata from the nearest station that has any
measurement in the given period.
interval : str, optional
desired time interval for observations. Options are 'daily' and
'hourly'. The default is 'daily'.
Expand Down Expand Up @@ -1214,8 +1217,7 @@ def interpret_knmi_file(
raise ValueError(
f"Cannot handle multiple stations {unique_stn} in single file"
)
else:
stn = df.at[df.index[0], "STN"]
stn = unique_stn[0]

if add_day or add_hour:
if add_day and add_hour:
Expand Down Expand Up @@ -1659,7 +1661,10 @@ class of the observations, can be PrecipitationObs or
**kwargs:
fill_missing_obs : bool, optional
if True nan values in time series are filled with nearby time series.
The default is False.
The default is False. Note: if the given stn has no data between start and
end the data from nearby stations is used. In this case the metadata of the
Observation is the metadata from the nearest station that has any
measurement in the given period.
interval : str, optional
desired time interval for observations. Options are 'daily' and
'hourly'. The default is 'daily'.
Expand All @@ -1674,7 +1679,7 @@ class of the observations, can be PrecipitationObs or
Returns
-------
obs_list : list of obsevation objects
obs_list : list of observation objects
collection of multiple point observations
"""

Expand Down
5 changes: 4 additions & 1 deletion hydropandas/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,10 @@ def from_knmi(
end date of observations. The default is None.
fill_missing_obs : bool, optional
if True nan values in time series are filled with nearby time series.
The default is False.
The default is False. Note: if the given stn has no data between start and
end the data from nearby stations is used. In this case the metadata of the
Observation is the metadata from the nearest station that has any
measurement in the given period.
interval : str, optional
desired time interval for observations. Options are 'daily' and
'hourly'. The default is 'daily'.
Expand Down

0 comments on commit 66be64c

Please sign in to comment.