[Thread Prev][Thread Next][Index]

Re: [ferret_users] Change K to L axis



Hi Patricia,

If you execute the unix command,

> ncdump -h myfile.nc

that will list the netcdf header for the file.  It may show something that looks like this:

netcdf myfile {
dimensions:
        dim1= 180;
        dim2= 190;
        dim3= 133;
variables:
        double dim1(dim1) ;
                dim1:units = "degrees_east" ;
        double dim2(dim2) ;
                dim2:units = "degrees_north" ;
        double dim3(dim3) ;
                dim3:units = "day";
        float var(dim1, dim2, dim3) ;
                var:_FillValue = -99.9f ;
                var:long_name = "Geo variable" ;
                var:units = "xxx" ;

// global attributes:
                :history = "written by ..." ;
}

In this example, the dimensions are also coordinate variables, that is, in addition to being dimensions of the grids of the data, they are also defined as variables with attributes. The units attributes would be enough to tell Ferret that these are X, Y, and T dimensions. Attributes "standard_name", "long_name", or "axis" would also tell it the correct direction. If variables corresponding to the dimensions are listed, then the third dimension needs an attribute that Ferret and other software would use to determine that it is a time dimension.

Some files have dimensions, but no coordinate variables. I suspect this may be the case with your file. In the example above, if dim1, dim2, dim3 would not be listed under the variables section. For this file you are correct to try USE/ORDER=xyt which tells Ferret to define the grid for the variables with directions x,y,t.  You can use the data in your Ferret session, and it would behave as you would like. But as you found, when the data is written out it is unchanged.

You can change the definition of the coordinate axes of a grid in the Ferret session.  The most simple case just nails down the definition as a T axis.  You could also give it units, such as /UNITS=days/T0=1-jan-2012, and even change the values of the coordinates if you wanted to.

yes? use/order=xyt my_data.nc
yes? show data
     currently SET data sets:
    1> ./
my_dat.nc  (default)
 name     title                             I         J         K         L         M         N
 VAR     
Geo variable                     1:180     1:90      ...       1:133     ...       ...

yes? define axis/t=1:133:1 dim3
Replacing definition of axis DIM3
           *** NOTE: grid GHU1 used by data set my_data
           *** NOTE: Redefinition may alter apparent contents of data set

yes? save/file=new_file.nc var

In the warning message, Ferret is telling you you're making a change to the grid of the data.  But that's what you want to do.

Now, from the Unix prompt,

> ncdump -h new_file.nc

netcdf a {
dimensions:
        dim1 = 144 ;
        dim2= 73 ;
        dim3 = UNLIMITED ; // (132 currently)
variables:
        double dim3 (dim3 ) ;
                dim3 :axis = "T" ;
        var(dim1, dim2, dim3) ;
                var:_FillValue = -99.9f ;
                var:long_name = "Geo variable" ;
                var:units = "xxx" ;

// global attributes:
                :history = "FERRET V7.032 (optimized)  9-Feb-17" ;
                :Conventions = "CF-1.6" ;
}


Ferret uses the CF conventions for netCDF files, and there's much more about that here:
http://cfconventions.org/cf-conventions/v1.6.0/cf-conventions.html  Look at the sections about Coordinate Types, section 4.


-Ansley


On 2/9/2017 12:58 AM, Patricia Handmann wrote:
Dear ferreters,

I was using the cdfgeo-uv tool.
It saves the ugeo and vgeo files with the time axis in K instead of L.
Is there a way to change the K axis back to the L axis in order to use other cdo tools afterwards.
I already tried use/order=XYT  and then saved the file - it did not help me a lot since
apparently the axis is not changed for real.
Is the only way to define a new grid?

I would really appreciate your help.

Patricia


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement