Christopher Mueller wrote:
I’m curious if anyone out there can help me with some questions I have
about GeoGrids. Specifically I’m wondering if anyone knows how I can go
about the process of combining multiple GeoGrids into one “object” and
then write that object to a local .nc file. Thus far, I’ve succeeded in
connecting to an opendap server, getting a single geogrid, subsampling
it and using the GeoGrid.writeFile() method to create a local file.
I’ve noticed that the javadoc for GeoGrid says not to use the writeFile
method – but I couldn’t see another way of getting the data to disk.
So my first question is – what is the correct method for writing the
contents of a GeoGrid to a local file?? I’ve checked out
NetcdfFileWriteable, but that doesn’t allow me to add a GeoGrid (at
least not directly).
ucar.nc2.dt.grid.NetcdfCFWriter is a helper class that replaces
grid.writeFile(). It writes CF compliant files. It's still a bit rough but
probably will work for you.
My second question is – is there a way to combine multiple geogrids so
that their contents can be written to a single file. For example – if
my opendap dataset has U, V, and Temp variables, I’d like them all to be
written to a single file. My geogrid.writeFile method produces a
dataset for each at this point
As you will see from the API, you have to construct a ucar.nc2.dt.GridDataset
object. You can do this from an opendap dataset, just like any other dataset,
see ucar.nc2.dt.grid.GridDataset.open(). If you dont want all the Geogrids, you
will have to remove the ones you dont want. It should work, but we havent
tested that particular case.
In relation to this second question – how would I combine geogrids from
2 separate opendap sources – assuming that they are identical aside from
the variable(s) of interest?
Again, you would construct a ucar.nc2.dt.GridDataset and use NetcdfCFWriter to
write it out. It may be tricky to get the GridDataset right, we've never
attempted to combine from 2 different sources.
Thank you in advance for your help – it’s most appreciated.
*Christopher Mueller/ /*| Scientist
Applied Science Associates
70 Dean Knauss Drive | Narragansett, RI 02882 USA
p: +1 401-789-6224 | f: +1 401-789-1932
e: cmueller@xxxxxxxxxxxxxx <mailto:ehowlett@xxxxxxxxxxxxxx> |
*ASA **|** Science. Services. Solutions.***
netcdf-java mailing list
For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/