Reported by @AnsleyManke on 20 Jan 2012 17:38 UTC
(see previous tickets on this topic, tickets 1872 and 751)
When there are coordinates attributes in the dataset, Ferret can get that information and set up the curvilinear form of graphics commands. The Ferret scripts for LAS could then get this information from Ferret and use it to do the correct operation for saving, listing data.
What's the right way to do it? Make the information part of the grid for variables? Or an attribute within Ferret of the variable?
After some thought, Steve's suggestions:
variables are associated with datasets. grids are not. grids are shared between datasets
curvilinear coordinate variables are associated with datasets
the preceding will hugely complicate an attempt to associate the curvilinear coordinate variables with grids ... as multiple datasets are SET and CANCELLED
Not clear even what the "right" solution to the above is. Candidates such as
1)read and cache curvilinear coordinates in Ferret memory, as we do with 1D coordinate axes?
2)keep track of which datasets use each grid?
3)wait and see what libCF comes up with?
So here's a revised recommendation -- much simpler than the preceding, but arguably should be simplified further (??)
When a "coordinates" attribute is found on a variable in a file, it is already presumably available as a Ferret attribute on that variable. Trouble is that the CF coordinates attribute is not reliably present. And it can point to 1D or 2D coordinates, etc ... And it is used in several ways for auxiliary coordinates. So I suggest that Ferret be enhanced so that it
1) makes coordinates a standard attribute -- always available for any variable, even if there is no explicit coordinates attribute given in a netCDF file
2) give it an array value (Ferret's attribute framework can do this, right?) pointing to all of the relevant coordinate axes (there may be more than just the coordinates found in the grid -- CF allows, for example, an array of string variables to be regarded as an auxiliary coordinate
3) also synthesize the following variable attributes to provide additional information -- likely these can be computed on demand, rather than actually stored
a) coordinates_axis, which may be x, y, z, t (corresponding to the way Ferret understands the axis orientations)
b) coordinates_dim which may be 1, 2 (1D or 2d-curvilinear)
c) coordinates_type, which may be "default" or "alternate" (this is a low priority consideration at present. CF, however, does allow for there to be more coordinate variables than there are dimensions -- e.g. "depth" and "density" variables may both be listed as coordinates on a vertical profile.)
d) thus a curvilinear variable will reveal both its 1D 'X' 'default' axis and its 2D 'X' 'alternate' axes
4) use these new variable attributes in the LAS scripts to determine when curvilinear plotting is needed
5) over time, learn how to properly attach these attributes to LET-defined variables. First implementation of this might be as simple as to just reflect exactly what the current grid of the variable indicates (i.e. the curvilinear character of the LET variable simply gets dropped in the first version. Not good in the long run ...)
As a first step for this, I've added logic to the Ferret scripts that LAS runs.
If the configuration for the variable has Ferret properties marking the grid as curvilinear, proceed as always.
If not, look for a coordinates attribute, and when one exists, check the list of coordinates for 2D coordinate variables having units of longitude and latitude.
When those are found, use them to define the Ferret properties needed to return the products on the native curvilinear grid.
Reported by @AnsleyManke on 20 Jan 2012 17:38 UTC (see previous tickets on this topic, tickets 1872 and 751)
When there are coordinates attributes in the dataset, Ferret can get that information and set up the curvilinear form of graphics commands. The Ferret scripts for LAS could then get this information from Ferret and use it to do the correct operation for saving, listing data.
What's the right way to do it? Make the information part of the grid for variables? Or an attribute within Ferret of the variable?
After some thought, Steve's suggestions:
So here's a revised recommendation -- much simpler than the preceding, but arguably should be simplified further (??)
Migrated-From: http://dunkel.pmel.noaa.gov/trac/ferret/ticket/1912