Deltares / hatyan

Harmonic tidal analysis and prediction
https://deltares.github.io/hatyan/
GNU General Public License v3.0
13 stars 2 forks source link

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

Closed veenstrajelmer closed 3 months ago

veenstrajelmer commented 3 months ago

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: https://github.com/Deltares/hatyan/blob/8a004bc4126d8c47a3aafb2c34688dbe78211ccd/hatyan/timeseries.py#L1584-L1590

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: