Re: [netcdf-java] problem getting axistype

Jon Blower wrote:
Hi John,

Just to return to this problem with some more info.  The following program:

    public static void main(String[] args) throws Exception {
        NetcdfDataset nc =
NetcdfDataset.openDataset("http://topaz.nersc.no/thredds/dodsC/topaz/mersea-ipv2/arctic/tmipv2a-class1-b-be";);
        GridDataset gd = (GridDataset)TypedDatasetFactory.open(FeatureType.GRID,
            nc, null, null);
        GridDatatype tmp = gd.findGridDatatype("temperature");
        GridCoordSystem coordSys = tmp.getCoordinateSystem();
        System.out.println("X axis type: " +
coordSys.getXHorizAxis().getAxisType());
        System.out.println("Y axis type: " +
coordSys.getYHorizAxis().getAxisType());
        System.out.println("Z axis type: " +
coordSys.getVerticalAxis().getAxisType());
        System.out.println("T axis type: " +
coordSys.getTimeAxis().getAxisType());
        nc.close();
    }

prints out:

X axis type: null
Y axis type: GeoY
Z axis type: Height
T axis type: Time

The variable in question is on a polar stereographic grid.  The types
of the Y, Z and T axes are correctly recognized as the above output
shows.  I can't figure out why the X axis is not.  This problem has
only recently appeared, and it might have occurred due to a change in
the version of nj4 that we use (or the OPeNDAP provider might have
changed something).

Can you shed any light on this?

Thanks, Jon

Hi Jon:

I was recently working on this dataset with someone, though i cant remember who.

1) im not seeing the "X axis type: null" problem. could you get the latest cdm (4.0.44) and see if its still happening?

2) one thing thats obviously wrong is that the y axis has no units. when i add the attribute

   <attribute name="units" value="100  km" />

to it, it looks more correct.

3) but not correct yet, usually it means the projection parameters are wrong. making a guess to use -45 instead of 45, it looks good (see attached). the ncml to make it correct is:

<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"; location="dods://topaz.nersc.no/thredds/dodsC/topaz/mersea-ipv2/arctic/tmipv2a-class1-b-be">

 <variable name="polar_stereographic" >
<attribute name="longitude_of_projection_origin" type="double" value="-45.0" />
 </variable>

 <variable name="y" >
   <attribute name="units" value="100  km" />
</variable>

</netcdf>


JPEG image

  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: