[netcdf-java] Trick to allow NetCDF-Java to read unstructured grid results

NetCDF-Java Folk:

A few weeks ago we (Sachin Bhate & I) discovered a trick to utilize
the high-level GridDataset routines in NetCDF Java to return
data,lon,lat,z and time from unstructured grid (e.g. triangular grid)
models with dimensionless vertical coordinates.

Our original data looked like:
   float temp(time, siglay, node)

but this caused exceptions in:
readVolumeData
getVerticalTransform.getCoordinateArray

Our trick was to add a singleton dimension, so that our modified data
looked like:
  float temp(time, siglay, node, scalar)
where scalar=1.

With this trick, the NJ routines treat extracting a 3D field from the
unstructured grid the same as extracting a 2D vertical slice from a
structured grid model.   So we get NetCDF-Java to do the heavy
lifting, figuring out the conversion of time, dimensionless vertical
coordinates, lon, lat, and the only model specific call is to load the
node connectivity array so we can plot up the data.

Pretty cool.

If you want to see actual NetCDF file examples, check out:
http://stellwagen.er.usgs.gov/models/test/fvcom_orig.nc   (original file)
http://stellwagen.er.usgs.gov/models/test/fvcom_singleton.nc  (with trick)

Of course, it would be great if we could figure out how to do this
without rewriting NetCDF files.

We tried this NcML, but it didn't work:
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";
     location="http://stellwagen.er.usgs.gov/models/test/fvcom_orig.nc";>
<dimension name="scalar" length="1" />
<variable name="lat" shape="node scalar" />
<variable name="lon" shape="node scalar" />
<variable name="temp" shape="time siglay node scalar" />
<variable name="zeta" shape="time node scalar" />
<variable name="h" shape="node scalar" />
</netcdf>

Thanks,
Rich
-- 
Dr. Richard P. Signell   (508) 457-2229
USGS, 384 Woods Hole Rd.
Woods Hole, MA 02543-1598


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