Re: zero length attrributes...

Hi, John:

This is my own way to handle dimensional scale in WRF-HDF5 module since at that time there was no implementation of dimensional scale at HDF5. So it may not be a good example to follow with the current HDF5 dimensional scale implementation.

Anyway, here is what I invented:
I used a compound datatype to store three piece information of HDF5 file:
1) name of the dimension 2) the length of the dimension(in the example, length of time is 1 means only one timestep is generated) and also 3) whether the current dimension is unlimited or not, if it is unlimited dimension, the flag is set to 1, otherwise it is -1.

I can use these information to retrieve the dimensional information of the HDF5 file.
The H5_Dimrank is used to retrieve information from each variable.
There are two confusion parts of the dumped file:
1) H5_Dimrank always starts with 1, the index of dumper output always starts from 0. 2) I believe that except the first dimension is time(I hard-coded that); to retrieve the rest dimensional rank, you have to reverse the dimension order. For example, for dim rank 1(time),5,3, the actual dimension it is supposed to point to is 1(time),3,5 in the table. I know that's odd. I am using HDF5 fortran wrapper to do all WRF work, I am not sure whether that explains something. It is possible that the dimension information I stored is in fortran order but h5dump just display in C order. It is also possible this is bug that has not been discovered. I just read my code and the part that handles the dimensional scale is not straightforward, I cannot figure out whether this is a bug or not with the limited time. Anyway, I will leave the fix of this in the future WRF release if they still want PHDF5 module. Now, if you can use the previous approach, it should make sense to you. I do remember I converted WRF-NetCDF output and then converted NetCDF to HDF5 to make the comparison with WRF-HDF5 output. The data stored in the two files are the same.

Hope this helps.
Kent
Kent

Thanks,
Kent
At 02:58 PM 3/30/2005, John Caron wrote:
I am trying to figure out how the WRF HDF5 files are put together, by looking at a sample file i was given.

I guess that the attribute H5_DimRank associates the dimensions in a data variable with the dimensions in the dim_table under the DIM_GROUP group.

but i cant figure out the specifics of this file, eg:

   float P(1, 4, 20, 10); // 4 800
      :H5_DimRank = 1, 5, 3, 4; // int
      :MemoryOrder = "XYZ";
      :FieldType = 104; // int
      :description = "pressure";
      :units = "pascals";
      :stagger = " ";

    float LU_INDEX(1, 20, 10); // 4 200
      :MemoryOrder = "XY ";
      :FieldType = 104; // int
      :description = "LAND USE CATEGORY";
      :units = " ";
      :stagger = " ";
      :H5_DimRank = 1, 5, 3; // int

can anyone explain?

the h5dim_table dump:

 {

   dim_name
"Time
"
   dim_length =1
   dim_unlimited =1
 } DIM_GROUP/h5dim_table(0)
 {

   dim_name
"west_east_stag
"
   dim_length =11
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(1)
 {

   dim_name
"south_north
"
   dim_length =20
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(2)
 {

   dim_name
"bottom_top
"
   dim_length =4
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(3)
 {

   dim_name
"west_east
"
   dim_length =10
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(4)
 {

   dim_name
"south_north_stag
"
   dim_length =21
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(5)
 {

   dim_name
"bottom_top_stag
"
   dim_length =5
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(6)
 {

   dim_name
"soil_layers_stag
"
   dim_length =5
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(7)
 {

   dim_name
"ext_scalar
"
   dim_length =1
   dim_unlimited =-1
 } DIM_GROUP/h5dim_table(8)