Skip to content

Rewrite readWDM.py to read by data group & block #21

@aufdenkampe

Description

@aufdenkampe

From Jack in Feb 5 email:

I have been investigating bugs related to WDM data with variable timesteps. My review of the readWDM code that loops through WDM data Groups (after comment #Get timeseries data) with calls to 'getFloats' has led me to believe that 'getFloats' should be replaced by a new routine called something like 'getTimeseriesDataGroup'.

The new routine would do the following:

  1. check to see that the Group date word matches the expected date.
  2. loop through WDM Blocks within Group
  • if Block timeunit/timestep does not match HDF5 timeunit/timestep then adjust number of values in Block for use filling array to be written to HDF5. Then process into HDF5 data array like compressed WDM data
  • if Block is compressed, add multiple identical values to HDF5 data array.
  • if Block is uncompressed, march through WDM record copying data values into HDF5 data array.

There need to be robust optional debug messages written to a debug file as there can be subtle issues related to midnight, new year, leap year and end of WDM records.

Code from atcWDMvb routine TimeseriesDataFromWdm can be used as an example of how the new routine might work.

Paul D. thinks: "This vb code seems to handle your complex WDM data correctly, so if we could just translate this vb to python we should be golden."

Last, @ptomasula created this EFDC fortran binary reader in Python, which could be worth following as an example designed to efficiently create Pandas data frames. https://github.com/LimnoTech/LTPy/blob/master/ltpy/ltpy/model_tools/efdc/binary_reader.py

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions