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