Re: [netcdf-java] problem getting axistype

Hi Adit:

The AxisType is optional, so you need to check for null.
John

Adit Santokhee wrote:
Hi,

I am trying to read data from a netcdf file. But I am getting an "java.lang.IllegalArgumentException: Illegal axis type null" error message.

Our application java code is as follows:

       AxisType axisType = axis1D.getAxisType();
             if (axisType == AxisType.Lon || axisType == AxisType.Lat ||
           axisType == AxisType.GeoX || axisType == AxisType.GeoY)
       {
           OneDCoordAxis theAxis = null;
           if (axis1D.isRegular())
           {
               theAxis = new Regular1DCoordAxis(axis1D.getStart(),
                   axis1D.getIncrement(), (int)axis1D.getSize(), axisType);
           }
           else
           {
theAxis = new Irregular1DCoordAxis(axis1D.getCoordValues(), axisType);
           }
           return theAxis;
       }
       else
       {
throw new IllegalArgumentException("Illegal axis type " + axisType);
       }

I have attached the dataset metadata. Could you please advise?

Cheers,

Adit


------------------------------------------------------------------------

_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/



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