ArtesiaWater / hydropandas

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

Prevent runtime error, with mulitple bro id's #107

Closed Florisklooster closed 1 year ago

Florisklooster commented 1 year ago

In some 'grondwatermonitoringsputten' two bro id's are returned, one with a quality regime of 'IMBRO/A' and one with 'IMBRO'. Right now this gives a runtime error. In this proposed change I have put the default on 'IMBRO/A', if something like the above would be implented in the code, than of course the quality_regime parameter should be in other functions as well.

By the way, I really appreciate the effort of implementing this BRO extension

OnnoEbbens commented 1 year ago

Nice catch and thanks for the PR!

Two questions:

  1. Could you let me know the bro id of the gmw where this occurs? Then I can add a test for this. Or if you want, you can add a test yourself.
  2. Can you point this PR to the 'dev' branch, instead of the 'main' branch?
OnnoEbbens commented 1 year ago

Apparently I can change the PR from 'main' to 'dev' myself so the 2nd question is not relevant anymore.

Florisklooster commented 1 year ago

Thanks for the fast reply, not sure what would be expected in a test, so hereby the bro id's: GMW000000063853, GMW000000063852, GMW000000063851

OnnoEbbens commented 1 year ago

Thanks for the id's. I added a test and found that all GLD id's associated with the GMW id's you gave contain zero observations. This might be something that we should report to the BRO.

I also made a tiny modification to your code to be absolutely certain that the gld id associated with the given quality regime is returned.

For future references a list with the GLD id's associated with the GMW id's: bro_id = 'GLD000000031484' # "GMW000000063853" bro_id = 'GLD000000031463' # "GMW000000063853" bro_id = 'GLD000000031459' # "GMW000000063852" bro_id = 'GLD000000031460' # "GMW000000063852" bro_id = 'GLD000000031456' # "GMW000000063851" bro_id = 'GLD000000031454' # "GMW000000063851"