Re: [netcdf-java] geogrid subset problem

Hi Stuart,

As you guessed, GeoGrid.subset() does not deal with nested subsets.

The subset() method creates a "logical subset of this GeoGrid" (from the javadocs) which means the result is a subsetting GeoGrid wrapper around the initial GeoGrid's dataset. Creating a wrapper around a wrapper or a new wrapper that combines the first and second subset isn't handled.

But you should be able to generate any number of GeoGrids using subset() on the original GeoGrid. All they will share is a pointer to the underlying dataset which should not be a problem.

Ethan

Stuart Maclean wrote:
I am trying to use the GeoGrid.subset operation in the 2.2.22 jar. My input data set is global one minute bathy (the full Gebco data set), so lat extends from -90 to +90 = 10801 points, and lon extends -180 to +180 = 21601 points.

I need to slice off north and south of 85 degrees lat (in order to tile for google maps), so I build a bounds:

        LatLonRect bounds = new LatLonRect( new LatLonPointImpl
                                                                                
                ( -85, -180 ),
                                                                                
                170, 360 );

and call GeoGrid.subset on my input GeoGrid to produce say GG2. This works fine.

But I then go onto to subset GG2, to get say just the northwest quarter of the 'world' , and I get the following error

ucar.ma2.InvalidRangeException
        at ucar.ma2.Range.element(Range.java:337)
        at ucar.ma2.Range.<init>(Range.java:312)
        at ucar.nc2.Variable.makeSectionRanges(Variable.java:421)
        at ucar.nc2.Variable.read(Variable.java:603)
        at ucar.nc2.dataset.VariableDS._read(VariableDS.java:279)
        at ucar.nc2.Variable.read(Variable.java:643)
at ucar.nc2.dataset.CoordinateAxis1D.readValues(CoordinateAxis1D.java: 482)
        at ucar.nc2.dataset.CoordinateAxis1D.doRead(CoordinateAxis1D.java:431)
at ucar.nc2.dataset.CoordinateAxis1D.getCoordEdge(CoordinateAxis1D.java: 152)
        at ucar.nc2.dt.grid.GridCoordSys.getBoundingBox(GridCoordSys.java:879)
        at ucar.nc2.dt.grid.GridCoordSys.<init>(GridCoordSys.java:384)
        at ucar.nc2.dt.grid.GeoGrid.subset(GeoGrid.java:632)
        at ucar.nc2.dt.grid.GeoGrid.subset(GeoGrid.java:591)
        at glmpc.worldmap.tools.GebcoTiler.main(GebcoTiler.java:

I have no idea why this is happening. I can try to provide code and datafile if necessary.

Maybe Geogrid subsetting can not extend past one subset operaion. Is there shared state among the Geogrids maybe?

Any help gratefully appreciated.

Of course if any one has already cut up this dataset for Google Maps tiles I would very much like to talk to you ;)

Stuart

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

--
Ethan R. Davis                                Telephone: (303) 497-8155
Software Engineer                             Fax:       (303) 497-8690
UCAR Unidata Program Center                   E-mail:    edavis@xxxxxxxx
P.O. Box 3000
Boulder, CO  80307-3000                       http://www.unidata.ucar.edu/
---------------------------------------------------------------------------



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