[idvusers] problem using Contour2DDisplayable

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
        


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