OPULS: UGrid Subsetting

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽

Overview

Adding a server side function to hyrax that allows the user to subset unstructured grid (triangular mesh) data objects based on values in their spatial range.


10/29/2013 Update

New version of the server up and running with an updated ugrid subsetting function. This version allows for constraining the additional dimensions of the range variables as they are passed into the ugrid subsetting function, thus you can ask for 1 or more times steps, conditions etc.

Please check it out, details below. It's a "test" server that I am using to work with NOAA to explore the use of AWS storage services, so it's not going to be rock solid. If you want to use it for a demo, tell me and I'll work with you to see it running when you want it.


The Function

Name
ugr5 - Restrict the domain of an unstructured 2D Mesh Topology grid
Syntax
ugr5(0, rangeVariable:string, [rangeVariable:string, ... ] condition:string)
  • The first parameter is currently required to have value zero (0) or two (2), to indicate that the supplied relational constraint condition (the last parameter in the function call) is to be applied to coordinate values at the nodes of the mesh or the faces. Edges (represented by a 1) are not currently supported.
  • The second parameter is a list of one or more (range) data variables that you wish to subset, they may be associated with nodes or faces of the mesh.
  • The last parameter is string whose value is an expression that defines conditions that the domain variables must meet in order to be included in the result.
Here is an example:
ugr5(0,depth,"28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
Used in a url:
http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugr5(0,depth,"28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
Subsetting the range variables
In the example dataset
http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/NECOFS_GOM3_FORECAST.nc.dds
http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/NECOFS_GOM3_FORECAST.nc.das
We can see that there are range variables associated with the nodes of the mesh that have a 'time' dimension and a 'siglay' dimension. Since the 'time' has 145 values, and 'siglay' has 40 values it may be that you wish to only retrieve one time slice and some subset of the siglay slices. This can accomplished by using a dap4 array constraint on the variable as it is passed to the ugrid function. For example, to retrieve the 11th siglay slice of the 4th time slice of the variable salinity you would constrain it like 'salinity[4][11][*]' (note that the indices begin at zero). In the request URL this would look like
http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/NECOFS_GOM3_FORECAST.nc.dds?ugr5(0,salinity[4][11][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")
It is also possible to request, say, every 5th time slice 'salinity[0:5:*][*][*]' or every 3rd siglay slice from 3 to 30 'zeta[4][3:3:30][*]' in the request URL this would look like
http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/NECOFS_GOM3_FORECAST.nc.dds?ugr5(0,salinity[4][3:3:30][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")

The Data

I have a new server up with the ugrid data and subsetting function on board here: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/

In this dir: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/ You can find the datasets (hex.nc, test4.nc) that were used by Bill & Scott at UW to develop the first ugrid restrict using the gridfields library. However their code was based on an older version of the ugrid spec, and it seems the specification shifted out from under their code. I worked on the code to get it to respond to datasets organized as described here: https://publicwiki.deltares.nl/display/NETCDF/Deltares+CF+proposal+for+Unstructured+Grid+data+model

I adapted their original test data using ncml files. I wrote an ncml file for test4.nc ( called test4-ugrid.ncml in the same directory) that makes it compliant with the Deltares specification and it can be subset with the ugrid restrict function. http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/test4-ugrid.ncml Also in that directory is the time-sliced dataset (fvcom_1step.nc) that you provided http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/fvcom_1step.nc Which can be subset using the ugrid restrict function.

Also, a while back I tracked down and downloaded on of the larger, multi-time-step fvcom ugrid data files, it's now set up here: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/Ike/ Inside you'll find that the 2D models have useful stuff. In http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/Ike/2D_varied_manning_windstress/ You should see the original nmcl files from the source server. These weren't compatible with Hyrax - mostly the result of Hyrax not being as "elastic" as the TDS with its inputs.

The file test_dir-norename.ncml can be subset using the ugrid restrict function: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml The file test_dir.ncml is closer to the original ncml file 00_dir.ncml, unfortunately it only works superficially. You can get the metadata responses for this dataset, but there is a bug in the ncml code that prevents ugrid restrict function from returning data values for renamed variables. The test_dir-norename.ncml is simply test_dir.ncml without the renamed variables.