NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

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

  • To: Rich Signell <rsignell@xxxxxxxx>
  • Subject: Re: [netcdf-java] Trick to allow NetCDF-Java to read unstructured grid results
  • From: John Caron <caron@xxxxxxxxxxxxxxxx>
  • Date: Wed, 30 Jan 2008 14:32:28 -0700
Hi Rich, Scahin:

Basically, you've got a workaround for some of the assumptions we coded into 
the Grid datatype,
namely that there must be 2 horizontal dimensions (here theres only one 
dimension). there are likely
some grid methods that wont work correctly, but its interesting to find out 
exactly which.

id like to add a new datatype, probably "unstructured grid" to correctly 
generalize the grid type.
as an aside, we also want to add a "swath" datatype, which is also a variant of 
a grid, but different.

thanks for the test files, it always helps me to look at concrete examples.

Rich Signell wrote:
> 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


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