[netcdfgroup] Convert from HDF5 to netCDF4 while renaming dimensions

Hello,

I have a set of HDF5 files that have the following header:

netcdf control-A-2017-05-12-090000-g1 {
dimensions:
        phony_dim_0 = 16 ;
        phony_dim_1 = 16 ;
        phony_dim_2 = 200 ;
        phony_dim_3 = 2 ;
        phony_dim_4 = 1 ;
        phony_dim_5 = 4 ;
variables:
        ...

Since it's HDF5, the dimensions are created as phony_dim_x. In this case,
phony_dim_0 and phony_dim_1 are the y and x coordinates, respectively. I
would like to rename the dimensions appropriately. Since renaming
dimensions in HDF5 is not possible (since they don't technically exist), I
need to convert to netcdf first. to do so I use ncks in.h5 out.nc.

However, the header info of the converted file is:

netcdf control-A-2017-05-12-090500-g1 {
dimensions:
        phony_dim_0 = 16 ;
        phony_dim_1 = 200 ;
        phony_dim_2 = 2 ;
        phony_dim_3 = 1 ;
        phony_dim_4 = 4 ;
variables:
        ...

Here's the part that's giving me issue: the two phony_dim_[0,1] dimensions
have been combined to a single dimension, phony_dim_0. I assume this is
because they have the same value, and so the netcdf conversion assumes
they're the same.

A variable that was listed in the hdf5 file as ACCPA(phony_dim_0,
phony_dim_1) ; is now ACCPA(phony_dim_0, phony_dim_0) ;, with two identical
dimensions.

Thus, I am not able to rename the dimensions individually. If I do ncrename
-d phony_dim_0,y out.nc, I get ACCPA(y, y) ;

Is there a way to get around this?

Thanks!

Lucas

-- 
Lucas Sterzinger
PhD Student
UC Davis Cloud Physics Research Group
Hoagland Hall 230
lsterzinger@xxxxxxxxxxx
https://lucassterzinger.com
  • 2020 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: