- To: idvusers@xxxxxxxxxxxxxxxx
- Subject: [idvusers] problem using Contour2DDisplayable
- From: Stuart Maclean <stuart@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 3 Apr 2008 10:14:52 -0700
I have been using Contour2DDisplayable in the past with success. The
Flat field has always been
lat, lon -> val where val might be depth or whatever.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); 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?? 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]) Contour2DDisplayable cdd = new Contour2DDisplayable( "foo" ); cdd.setData( fi ); cdd.setContourLevels( new RegularContourLevels( 10, 273, 273, 310 ) ); // cdd.setColorPalette( cyans );I cannot see what I am overlooking. Can the Contour2DDisplayable not be used like this where the domain is not lat, lon?
Any help appreciated Stuart