NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: [netcdf-java] subset GeoGrid problem



John Caron wrote:
Hi Sachin:

Im not sure why you are  casting to GridCoordSys. The following is the correct 
way to use this:

    GridCoordSystem gcsi = grid.getCoordinateSystem();
    boolean vAxis = (gcsi.getVerticalAxis() != null);
Ah! ..nice tip from the master. :-)
is there some functionality you need from GridCoordSys that you cant get from 
GridCoordSystem
interface ?

I have a interface layer (java) on top of netcdf-java for our matlab API, and I wanted to have easy/quick access to some methods from 'dataset.CoordinateSystem'...
But, I think I can implement that in a better way...

btw, why method 'hasVerticalAxis' works in one case, and not in other ( I mean after subsetting the grid) ?

thanks..appreciate your quick input

Sachin

Sachin Kumar Bhate wrote:
John,

I had earlier reported the problem described below with nj2.2.22.
The same problem still exist in netcdf-java 4.0 as well.

My current testing netcdf-java version is

Version 4.0.34.20090220.0016
Build Date = 2009-02-20 00:16:36


-sachin

John Caron wrote:
hi sachin:

thanks for reporting, ill look into this.
which version of the library are you using?

Sachin Kumar Bhate wrote:
Hello,

I am trying to query a subsetted GeoGrid for 'vertical axis', and
it returns false when I know that the data has vertical axis.
The original grid does return 'true' for the presence of vertical axis,
so it looks like the flag (hAxis/pAxis/zAxis) is not getting set after
subsetting the GeoGrid.

Just wanted to report this as this method has been a loyal gatekeeper
for me when I am trying to get vertical coordinate data when there is
none.

 >>>
example code:

String uri='http://www.gri.msstate.edu/rsearch_data/nopp/bora_feb.nc';
String var='temp';

GridDataset gid = GridDataset.open(uri);
GeoGrid Grid = gid.findGridByName(var);
GridCoordSys gcs = (GridCoordSys) Grid.getCoordinateSystem();

boolean vAxis = gcs.hasVerticalAxis();          // returns true.

// subset geogrid
GeoGrid subg = Grid.subset(null,null,null,1,1,1);       GridCoordSys
gcs2 = (GridCoordSys) subg.getCoordinateSystem();

boolean vAxis2 = gcs2.hasVerticalAxis();   // returns false, should
return true.

<<<

thanks..

Sachin.


--
Sachin Kumar Bhate, Research Associate
MSU-High Performance Computing Collaboratory, NGI
John C. Stennis Space Center, MS 39529
http://www.northerngulfinstitute.org/



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