On 3/21/12 2:40 PM, Ethan Davis wrote:
Yes, we have two issues open that are related to this capability. The
one Don mentions [CDM-32] lists a number of improvements for the
CDM/netCDF-Java Grid API including cross-seam subsetting.
The other one [TDS-143] looks at the cross-seam problem specifically.
One of the comments lists a number of possible solutions. Basically it
lists some options for what code might be responsible for splitting
requests into two and stitching the resulting data together:
a) the client application (e.g., the IDV)
That would not help other applications (like the TDS) or anyone who
wants to write some Java code using the netCDF-Java Grid API.
b) helper classes in netCDF-Java
a possibility, but c seems better.
c) the netCDF-Java Grid API (and other Feature APIs, eventually)
I think that would be the best place for it because it would be usable
by applications built on the netCDF-Java library like IDV, TDS, RAMADDA,
ncWMS, etc. Otherwise, each application would have to write the same
(or similar) code. Other grid libraries (e.g. wgrib2) have this
functionality without the end user/client having to call special code or
write their own.
The GeoGrid.subset method already takes a LatLonRect and could handle
the special case where it does have a grid that is wrappable. Perhaps
use a negative start for Range. Handling it under the covers would make
it seamless for all client applications.
d) somewhere in the THREDDS Data Server (TDS)
A TDS solution does not work for local grid files like those that people
download from NCDC or ECMWF (as HP's message linked from the TDS-143
states) or many global climate model netCDF files that are available for
The IDV work required for these options decreases as you go down the
list. But it never goes away. I think the minimum the IDV will need to
do (with options c and d) is:
1) recognize a dataset as a global dataset (asking netCDF-Java
in all but the first option); and
It already has code to do this by looking at the GridCoordSys.
2) present the subsetting in a way that allows the user to make
a cross-seam requests;
The IDV used to allow a region to be selected across the edge of a grid,
but code was added changed because a) this doesn't make sense for all
grids and b) the underlying netCDF-Java layer wouldn't understand such a
request. So, it should just be a matter of undoing the change in the
GeoSelection class to allow the map to pan.
Now, as to the status of this work in the CDM/TDS, it has not been
started and isn't currently slated for the 4.3 release (sorry, the JIRA
issue is a bit out of date). Options c and d definitely won't make it
into 4.3. We might be able to get at least some parts of option b into
I'm sorry to hear that since it's been a request for several years (long
before HP's request).
I will talk to Yuan, Julien, and Sean about this and perhaps we can put
it down as an agenda item for some future IDV/McV telecon.
Okay, but I probably know the most about how the IDV interfaces with the
I just added a comment to the TDS-143 JIRA issue with some more detailed
notes on the options listed above. If anyone has comments on those
details, let me know.
In the meantime, for those of you IDV users working with global grids, I
added a lonFlip Jython routine which will flip a 0-360 grid to -180 to
180 and vice versa. For those of you who work along the prime meridian
and deal with 0-360 global grids, you can create a formula of
lonFlip(grid) and pass in the 0-360 grid and have it plot with 0 in the
center. This doesn't allow subsetting, but you can use this formula in
conjunction with the Export grid to netCDF formula and flip a grid,
write it out to a netCDF file and then read it back in. At that point,
you can subset over the old grid boundary. This is available in the
NOAA/ESRL/PSD and CIRES