harphub / harpIO

IO functions for HARP
https://harphub.github.io/harpIO/
Other
6 stars 16 forks source link

hdf5 data - transposed & upside-down #113

Open pollyaschm opened 2 weeks ago

pollyaschm commented 2 weeks ago

Hello!

In read_hdf5(), the default option is that the data is read tranposed and upside-down. This is probably not what you always want.

It would be nice to have a switch to decided whether the data should be inverted or not. (see what I mean here, where I tweaked it for my needs. )

Also, when calling read_grid() for hdf5 data, you need to pass the file_format_opts as

file_format_opts = list(
      data_path = /path/to/data,
      odim= FALSE, 
      meta =TRUE)

I think it would be more consistent (e.g. grib_opts(), ) and intuitive, if could specify the information like this:

file_format_opts = hdf5_opts(
     data_path = /path/to/data,
     odim = FALSE,
     meta = TRUE)

Thanks Polly

andrew-MET commented 2 weeks ago

It seems that hdf5_opts() already exists - it's just not exported. One of the options for netcdf_opts() is y_rev = TRUE/FALSE so that could be used here too.

adeckmyn commented 2 weeks ago

Please send me any hdf5 files that I can use to check. I know that in the past I have encountered hdf5 files where the data was not ordered as described in the meta data. So maybe my code is rotated and only works for "wrong" hdf5 files. At some point (but I am absolutely not sure here) I had the impression that hdf5 files prepared with h5py (python) were different from others. I know that at some point I also added an option to reverse axes etc. in a development branch, but somehow that dissappeared. I'll redo that work.