Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knmi precipitation data station attribute is sometimes a series with duplicate entries #241

Closed
dbrakenhoff opened this issue Sep 26, 2024 · 1 comment

Comments

@dbrakenhoff
Copy link
Collaborator

I'm sometimes getting duplicate station names in the station attribute (resulting in a series instead of an int) when downloading precipitation data:

o = hpd.read_knmi(stns=[733], starts="2024", meteo_vars=["RD"])
o.station

gives me:

name
RD_VLISSINGEN    YYYYMMDD
2023-12-31    733
2023-12-31    733
N...
Name: station, dtype: object

This is a bit annoying when you expect an integer. Any idea why this is happening? Maybe something on the KNMI side?

@OnnoEbbens
Copy link
Collaborator

OnnoEbbens commented Sep 27, 2024

This was sort of tricky because there are 2 things going on:

  1. The function hpd.read_knmi returns an ObsCollection and not an Obs object, even though you have only one observation. The station attribute of an ObsCollection is a Series of the ObsCollection DataFrame. To get an Obs object you can use: hpd.PrecipitationObs.from_knmi(meteo_var='RD', stn=733, start='2024').
  2. The fact that o.station returns a Series with two objects (and a date) even though you only have one observations is a bug fixed by fix for knmi precipitation data station attribute is sometimes a seri… #242.

OnnoEbbens added a commit that referenced this issue Sep 27, 2024
OnnoEbbens added a commit that referenced this issue Sep 27, 2024
* allow get_stations with meteo_var == slice(None)

* only filter stations if start/end is provided

* ensure current station is in dataframe so nearest station can be determined

* fix for knmi precipitation data station attribute is sometimes a series with duplicate entries #241 (#242)

* reshuffle a bit

* ruff

* up version for minor release

---------

Co-authored-by: OnnoEbbens <onnoebbens@gmail.com>
OnnoEbbens added a commit that referenced this issue Oct 9, 2024
* allow get_stations with meteo_var == slice(None)

* only filter stations if start/end is provided

* ensure current station is in dataframe so nearest station can be determined

* fix for knmi precipitation data station attribute is sometimes a series with duplicate entries #241 (#242)

* reshuffle a bit

* ruff

* up version for minor release

* version bump

* fix bug in fill_missing_obs

* version bump

* ruff

* ruff

---------

Co-authored-by: Davíd Brakenhoff <d.brakenhoff@artesia-water.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants