As noted in the previous section, adding a coordinates attribute to the variables that have curvilinear grids is the best method for getting an xml configuration for datsets with curvilinear grids. Then run addXML and you are done!
To create a configuration by hand: We need to just create an xml file for the curvilinear data set.
Choose an existing xml file for some other data set. Find an example in your conf/server directory, say levitus.xml. Copy to your desired xml file name and edit the file. The initial part starts as:
<datasets>
<datasets>
<levitus_climatology_cdf name="Levitus Climatology"
url="file:levitus_climatology"
doc="">
<properties>
<ferret>
<land_type>filled</land_type>
</ferret>
</properties>
In the properties section, add Ferret properties to define the curvilinear coordinate variables. The header will become something like this, where polar_curvilinear.nc is our data file (or it could be a URL) and geolon and geolat are the names of the curvilinear coordinate variables.
<datasets>
<curvilienar_theta name="Polar data">
url="file:polar_curvilinear">
<properties>
<ferret>
<curvi_coord_lon>geolon</curvi_coord_lon> <!-- Curvilinear coordinates -->
<curvi_coord_lat>geolat</curvi_coord_lat> <!-- Curvilinear coordinates -->
</ferret>
</properties>
The next section defines variables. Here is the standard form from levitus.xml
<variables> <salt name="SALINITY" units="PPT">
<link match="/lasdata/grids/levitus_climatology_cdf_grid"/>
</salt>
<temp name="TEMPERATURE" units="DEG C">
<link match="/lasdata/grids/levitus_climatology_cdf_grid"/>
</temp>
</variables>
</levitus_climatology_cdf>
</datasets>
For each variable in our curvilinear dataset, but NOT including the curvilinear variables, we do something similar, making up a grid name, which will be used below.
<variables>
<theta0 name="THETAO" units="K">
<link match="/lasdata/grids/polar_xyzt_grid"/>
</theta0>
</variables>
</curvilienar_theta>
</datasets>
.The next section of our standard xml file is the grids and axes.
<grids>
<levitus_climatology_cdf_grid>
<link match="/lasdata/axes/levitus_climatology_cdf_XAXLEVITR"/>
<link match="/lasdata/axes/levitus_climatology_cdf_YAXLEVITR"/>
<link match="/lasdata/axes/levitus_climatology_cdf_ZAXLEVITR"/>
</levitus_climatology_cdf_grid>
</grids>
<axes>
<levitus_climatology_cdf_XAXLEVITR type="x" units="degrees_east">
<arange start="20.5" step="1" size="360"/>
</levitus_climatology_cdf_XAXLEVITR>
<levitus_climatology_cdf_YAXLEVITR type="y" units="degrees_north">
<arange start="-89.5" step="1" size="180"/>
</levitus_climatology_cdf_YAXLEVITR>
<levitus_climatology_cdf_ZAXLEVITR type="z" units="METERS">
<v>0</v>
<v>10</v>
<v>20</v>
<v>30</v>
<v>50</v>
...
</levitus_climatology_cdf_ZAXLEVITR>
</axes>
We will need to invent a grid and axes. The grid is just a list ofpointers to axes. This information is only for the user interface, soit should represent the XYZT extents that you want the user to be ableto select from in the interface (not trying to represent the complexityof curvilinear coordinates). To get the coordinate ranges for longitude and latitude you can "ask ferret" in an interactive ferret session, or use another tool to get information about the range of values.
> ferret
yes? use polar_curvilinear.nc
yes? stat geolon
geographical Longitude at cell center
X: 0.5 to 360.5
Y: 0.5 to 200.5
Z: N/A
T: N/A
DATA SET: ./curvi_demo.nc
Total # of data points: 72000 (360*200*1*1)
# flagged as bad data: 0
Minimum value: 0
Maximum value: 426.77
Mean value: 179.56 (unweighted average)
Standard deviation: 103.59
yes? stat geolat
geographical Latitude at cell center
X: 0.5 to 360.5
Y: 0.5 to 200.5
Z: N/A
T: N/A
DATA SET: ./curvi_demo.nc
Total # of data points: 72000 (360*200*1*1)
# flagged as bad data: 0
Minimum value: -81
Maximum value: 89.488
Mean value: 2.8957 (unweighted average)
Standard deviation: 44.983
yes? quit
Look at the Minimum and Maximum values listed. Here, the longitude range in GEOLON is larger than 360 degrees! This is part of the particular nature of this curvilinear grid, and will be used by the backend. Since we are configuring only what the interface will offer as a range in longitude, we can just specify this as 0 to 360. For size we will use the number of points from the input axes.
If we know that the data set is a subset of the globe, not the entire 0 to 360 range in longitude, then longitudes should not be treated as wrapping around the earth. If this is the case, go back and add a Ferret property lon_modulo to the <properties> section at the start of the file and set its value to 0.
<ferret>
<curvi_coord_lon>geolon</curvi_coord_lon> <!-- Curvilinear coordinates -->
<curvi_coord_lat>geolat</curvi_coord_lat> <!-- Curvilinear coordinates -->
<lon_modulo>0</lon_modulo> <!-- 0= do not treat longitudes as modulo -->
</ferret>
For the Z and T axes the standard xml is this:
<link match="/lasdata/axes/polar_xyzt_DEPTH"/>
<link match="/lasdata/axes/polar_xyzt_TIME"/>
</polar_xyzt_grid>
</grids>
<axes>
<polar_xyzt_cdf_XAX type="x" units="degrees_east">
<arange start="0" step="1" size="360"/>
</polar_xyzt_cdf_XAX >
<polar_xyzt_cdf_YAX type="y" units="degrees_north">
<arange start="-81." step="0.825" size="200"/>
</polar_xyzt_cdf_YAX>
For the Z and T axes of our file, we want the representation of the axes as addXML would show them. Look at the ncdump header for the file for information about the coordinates.
The end of the xml file might look like this.
<polar_xyzt_cdf_DEPTH type="z" units="m">
<arange start="5" step="1" size="1"/>
</polar_xyzt_cdf_TIME type="t" units="month">
<arange start="2001-01-01 12:00:00" size="1752" step="1" />
</polar_xyzt_cdf_TIME>
</axes>