In def _grdc_metadata_reader the line numbers used to extract metadata from .txt are off by one:
|
attribute_grdc["dataSetContent"] = str(all_lines[20].split(":")[1].strip()) |
|
except (IndexError, ValueError): |
|
attribute_grdc["dataSetContent"] = "NA" |
|
|
|
try: |
|
attribute_grdc["units"] = str(all_lines[22].split(":")[1].strip()) |
|
except (IndexError, ValueError): |
|
attribute_grdc["units"] = "NA" |
dataSetContent is currently read from index 20, but should be 21 to read line 22 in the .txt
units is currently read from index 22, but should be 23 to read line 24 in the .txt
Additionally, the "units" attribute is not currently used, units are currently hardcoded in the description when creating the xarray object
Proposed fix:
- Update the indices to 21 and 23.
- Optionally remove or repurpose the unused "units" attribute to avoid confusion.
PS: As mentioned to @RolfHut, I’m currently working on extending the GRDC station reader to also handle stations with monthly data instead of daily. I could bundle these bugfixes with that, if preferred.

In
def _grdc_metadata_readerthe line numbers used to extract metadata from .txt are off by one:ewatercycle/src/ewatercycle/observation/grdc.py
Lines 354 to 361 in ce00996
dataSetContentis currently read from index 20, but should be 21 to read line 22 in the .txtunitsis currently read from index 22, but should be 23 to read line 24 in the .txtAdditionally, the "units" attribute is not currently used, units are currently hardcoded in the description when creating the xarray object
Proposed fix:
PS: As mentioned to @RolfHut, I’m currently working on extending the GRDC station reader to also handle stations with monthly data instead of daily. I could bundle these bugfixes with that, if preferred.