Skip to content

(minor) bug report: Incorrect line numbers in GRDC metadata reader #480

@andrevdv

Description

@andrevdv

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.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions