Hi Stuart-
Just a followup to this since I'm now looking at your first
message. In your code you have:
Stuart Maclean wrote:
I am now trying to contour a field from a netcdf grid file. The IDV
does this Ok, but my image is simply a white polygon of the grid
itself. My code is this:
String netcdfUrl = args[0];
GeoGridDataSource ggds = new GeoGridDataSource(null, netcdfUrl, null);
GridDataset gds = ggds.getDataset();
GeoGrid gg = (GeoGrid)gds.getGrids().get(0);
This will just get the first grid in the GridDataset. What you want
to do is:
GeoGrid gg = gds.findGridByName("surface_temperature");
(or substitute whatever the variable name is for "surface_temperature").
GeoGridAdapter gga = new GeoGridAdapter( ggds, gg,
"surface_temperature" );
FieldImpl fi = gga.getData();
System.out.println( fi.getType().prettyString() );
which gives
(Time -> ((XC[unit:km], YC[unit:km]) -> surface_temperature[unit:Pa]))
Not sure why temp units are Pa??
The first grid in the GridDataset must be a pressure grid of
some sort.
FlatField ff = (FlatField)fi.getSample(1);
System.out.println( ff.getType().prettyString() );
which I presume extracts some time element, and gives
((XC[unit:km], YC[unit:km]) -> surface_temperature[unit:Pa])
Don
*************************************************************
Don Murray UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000
(303) 497-8628 Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************