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

metadata comparison too strict for hatyan.read_dia() #313

Closed
5 tasks done
veenstrajelmer opened this issue Jun 4, 2024 · 0 comments · Fixed by #314
Closed
5 tasks done

metadata comparison too strict for hatyan.read_dia() #313

veenstrajelmer opened this issue Jun 4, 2024 · 0 comments · Fixed by #314

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Jun 4, 2024

The code below raises "ValueError: metadata for two datasets is not equal, cannot be merged:" because of varying timestep_min. This should be ignored when merging timeseries.

import hatyan
file_dia = r"p:\archivedprojects\11208031-010-kenmerkende-waarden-k\work\data_vanRWS_20220805\wetransfer_waterstandsgegevens_2022-08-05_1306\WATHTE_10min\HOEKVHLD_1.dia"
ts = hatyan.read_dia(file_dia, block_ids="allstation", station="HOEKVHLD")
ts["values"].plot()

The code for metadata comparison is this part:

hatyan/hatyan/timeseries.py

Lines 1584 to 1590 in 8a004bc

#concat allyears dataset
data_pd_all = pd.concat(data_pd_list)
metadata_compare(metadata_list)
metadata = metadata_list[0].copy()
metadata['tstart'] = metadata_list[0]['tstart']
metadata['tstop'] = metadata_list[-1]['tstop']
data_pd_all = metadata_add_to_obj(data_pd_all,metadata)

This also includes setting the metadata from the first block as the metadata of the merged timeseries, which will then not contain a timestep_min. Also the tstart/tstop are derived assuming the blocks are ordered in time which is not always the case.

Todo:

  • add testcase that fails with current setup
  • drop tstart/tstop attrs from timeseries dataframes, only keep for component dataframes
  • drop tzone attrs from timeseries dataframes, only keep for component dataframes
  • drop timestep_min attrs from timeseries dataframes, can probably be dropped throughout the code
  • remove timestep_min from metadata before comparing them (but keep in mind that it is added as metadata to the merged dataset also) >> not added to metadata anymore
@veenstrajelmer veenstrajelmer mentioned this issue Jun 4, 2024
20 tasks
@veenstrajelmer veenstrajelmer changed the title metadata comparison slightly too strict for hatyan.read_dia() metadata comparison too strict for hatyan.read_dia() Jun 4, 2024
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

Successfully merging a pull request may close this issue.

1 participant