[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #PWQ-373080]: "higher level tools"



Hi Puneet,

> From the NetCDF FAQ [1] --
> 
> "Note that ncdump and similar tools can print metadata and data values
> from netCDF files, but in general they don't understand coordinate systems
> specified in the metadata, only variable arrays and their indices. To
> interpret georeferencing metadata so you can print the data within a
> latitude/longitude bounding box, for example, you need a higher level
> tool that interprets conventions for specifying coordinates, such as
> the CF conventions."
> 
> Could you kindly point me to such a "higher level tool" that would allow
> me to interpret georeferencing metadata in NetCDF files? I specifically
> want to be able to search data within a given lat/lon bounding box.

One such tool is the libcf library:

  http://www.unidata.ucar.edu/software/libcf/

still under development but with some functions already implemented
that may provide what you need.  For example, see the documentation
for nccf_get_vara():

  http://www.unidata.ucar.edu/software/libcf/html/group__subset__grp.html

for accessing a geographic subset of the data.  This function assumes
that the data conform to the CF conventions, and doesn't yet handle
all of the coordinate system representations supported by CF, but is
intended to handle grids defined by simple latitude and longitude
coordinate variables.

Another such tool is the experimental netCDF subsetting service:

  
http://www.unidata.ucar.edu/projects/THREDDS/tech/interfaceSpec/GridDataSubsetService.html

Finally, there is the integrated OpenGIS Consortium (OGC) Web Coverage
Service (WCS) that is supported as part of the THREDDS Data Server (TDS).
If you configure TDS to serve gridded data (which can be in GRIB,
netCDF, HDF, or other forms), then WCS clients can access the data
using lat/lon bounding box queries, at least in theory.  A list of WCS
clients that may work for this kind of access is included in this page:

  TDS Tutorial: Serving Data with OGC Services (WCS and WMS)
  
http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/AddingServices.html

> The aforementioned FAQ goes on to say --
> 
> "Or you can write a small program using one of the language APIs that
> provide netCDF support, for which examples are available."
> 
> Is there an example of such programs that I can use? I am specifically
> interested in using Perl to build such a program.

We don't have a worked out example of subsetting a bounding box in
perl.  We do have some perl examples, but they're fairly basic:

  http://www.unidata.ucar.edu/software/netcdf/examples/programs/
  
> Just to provide more background and context, I have the data from
> the Daymet archive [http://www.daymet.org]. The archive has
> historical weather data for the entire US at 1 km^2 grid
> resolution. The data are chopped up into 2 deg X 2 deg blocks, and
> within the block, the grids are numbered serially starting at 0 in
> the top left corner.
> 
> The dropbox link is to one such file that has the precipitation
> values for 1980 for all the 1 km^2 cells in the 2 deg X 2 deg block
> bounded by 45N-47N and 89E-87E.
> 
> I would like to do the following --
> 
> find the cell_id for a given lat/lon pair.
> find the cell_ids of the cells that fall within a bounding box given by a 
> lat/lon pair.
> given a cell_id, return its lat/lon pair.
> 
> [http://dl.dropbox.com/u/3526821/prcp1980.dmprcp_out.nc.zip]

Those sound like very useful functions for data organized that way.
We have some analogous functionality implemented in Java in the
netCDF-Java library that deals with coordinate systems, but I suspect
it wouldn't be vry easy to adapt to perl.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: PWQ-373080
Department: Support netCDF
Priority: Normal
Status: Closed