OPULS: UGrid Subsetting: Difference between revisions

From OPeNDAP Documentation
⧼opendap2-jumptonavigation⧽
 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Overview ==
== Overview ==
We have written server functions that utilize Bill Howe's Gridfields library to subset unstructured grids (aka irregular meshes) that conform to the UGrid 0.9 specification that is part of the CF-1.6 specification. Our function has a little latitude in its requirements because it also supports features found in earlier versions of the UGrid specification (e.g., the 'mesh array' can be either the Nx3 or 3xN). However, our function only supports triangular (2D) meshes, not the other mesh schemes outlined in the specification. The function will subset one or more ''range variables'' based on the values of the ''domain variables'' as expressed in a simple relational expression. The result of the function is an unstructured grid - that is, the subsetting operation will return a a set of variables that could be written to a netcdf file and the result would conform to the UGrid 0.9 specification. Because the specification has evolved over time and older data are still perfectly valid, we often 'tweak' those older datasets using NcML so that the contain the variables and attributes required by the newer versions of the UGrid specification. Our function supports both zero- and ones-based indexing for both the range and domain variables.


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.
== Background information on UGrid 0.9.0 ==
The [https://github.com/ugrid-conventions UGrid specification] moved to GitHub in 2013. The 0.9.0 version of the specification was last edited on 29 Oct 2013. Our function conforms to that specification and to an older version (0.6?), where the major difference is the organization of the mesh array data. For a triangular array, the 0.9.0 version specifies the array be a Nx3 while the older specification specified a 3xN. Our code supports both.


== The ugrid subsetting functions ==
These functions allow you to subset the UGrid dataset by the values associated with nodes, edges, or faces.
=== ugnr: Subset by node value. ===
;Name
:'''''ugnr''''' - Subset an unstructured 2D Mesh Topology grid based on domain values associated with the nodes
;Syntax
: <tt>ugnr(rangeVariable:string, [rangeVariable:string, ... ] condition:string)</tt>
:* The first, second, ..., parameter is a list of (''range'') data variable names that you wish to subset, they may be associated with nodes, edges, or faces of the mesh.
:* The last parameter is an expression that defines conditions that the ''domain'' variables must meet in order to be included in the result.
: Here is an example:
:: <tt>ugnr(depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")</tt>
: Used in a url (that returns the DDS for the subset data):
:: <tt>[http://52.70.199.67:8080/opendap/hyrax/ugrids/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugnr(depth,%2228.0%3Clat&lat%3C29.0&-89.0%3Clon&lon%3C-88.0%22) http://52.70.199.67:8080/opendap/hyrax/ugrids/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugnr(depth,"28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")]</tt>


; Subsetting the range variables
: In the example dataset [http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc NECOFS_GOM3_FORECAST.nc] ([http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.dds DDS] [http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.das 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'' dimension has 145 values, and ''siglay'' dimension has 40 values it may be that you wish to only retrieve a single time slice and/or siglay slice. This can accomplished by using an array constraint on the variable as it is passed to the ugrid function. For example, to retrieve the 12th siglay slice of the 5th 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 the function call is
::<tt>[http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.dds?ugnr(salinity%5B4%5D%5B11%5D%5B*%5D,%2238.0%3Clat%20&%20lat%3C42.0%20&%20-64.0%3Clon%20&%20lon%3C-60.0%22) <nowiki>ugnr(salinity[4][11][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")</nowiki>]</tt>
: It is also possible to request, say, every 5th time slice  ''salinity[0:5:*][*][*]'' or every 3rd siglay slice from 3 to 30 ''salinity[4][3:3:30][*]''. In a request URL this would look like
::<tt>[http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.dds?ugnr(salinity%5B4%5D%5B3:3:30%5D%5B*%5D,%2238.0%3Clat%20&%20lat%3C42.0%20&%20-64.0%3Clon%20&%20lon%3C-60.0%22) <nowiki>ugnr(salinity[4][3:3:30][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")</nowiki>]</tt>


== 10/29/2013 Update ==
=== uger: Subset by edge value. ===


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.
;Name
:'''''uger''''' - Subset an unstructured 2D Mesh Topology grid based on domain values associated with the edges
;Syntax
: <tt>uger(rangeVariable:string, [rangeVariable:string, ... ] condition:string)</tt>
:* The first, second, ..., parameter is a list of (''range'') data variable names that you wish to subset, they may be associated with nodes, edges, or faces of the mesh.
:* The last parameter is an expression that defines conditions that the ''domain'' variables must meet in order to be included in the result.
: Here is an example:
:: <tt> uger(depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")</tt>


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.
=== ugfr: Subset by face value. ===


;Name
:'''''ugfr''''' - Subset an unstructured 2D Mesh Topology grid based on domain values associated with the faces
;Syntax
: <tt> ugfr(rangeVariable:string, [rangeVariable:string, ... ] condition:string)</tt>
:* The first, second, ..., parameter is a list of (''range'') data variable names that you wish to subset, they may be associated with nodes, edges, or faces of the mesh.
:* The last parameter is an expression that defines conditions that the ''domain'' variables must meet in order to be included in the result.
: Here is an example:
:: <tt> ugfr(depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")</tt>


=== The Function ===


== Retired Functions ==
=== The ugr5 Function ===
'''''This function is deprecated.''' Supported by Hyrax 1.12.2 and earlier.''
;Name
;Name
:ugr5 - Restrict the domain of an unstructured 2D Mesh Topology grid  
:ugr5 - Restrict the domain of an unstructured 2D Mesh Topology grid  


;Syntax
;Syntax
: <font size="2"><code>ugr5(0, rangeVariable:string, [rangeVariable:string, ... ] condition:string)</code></font>
: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 first parameter indicates that the supplied relational constraint condition is to be applied to coordinate values at the nodes (0) or the faces (2) of the mesh.
:* 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 second, third, ..., parameter is a list of (''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.  
:* The last parameter is an expression that defines conditions that the ''domain'' variables must meet in order to be included in the result.  
: Here is an example:
: Here is an example:
:: ugr5(0,depth,"28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
:: ugr5(0, depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
: Used in a url:
: Used in a url (that returns the DDS for the subset data):
:: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugr3(0,depth,"28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
:: [http://52.70.199.67:8080/opendap/hyrax/ugrids/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugr5(0,depth,%2228.0%3Clat&lat%3C29.0&-89.0%3Clon&lon%3C-88.0%22) http://52.70.199.67:8080/opendap/hyrax/ugrids/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")]
: And then once your browser gets ahold of it:
 
:: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/hyrax/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugr3(0,depth,%2228.0%3Clat%20&amp;%20lat%3C29.0%20&amp;%20-89.0%3Clon%20&amp;%20lon%3C-88.0%22)
; Subsetting the range variables
; Subsetting the range variables
: In the example dataset
: In the example dataset [http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc NECOFS_GOM3_FORECAST.nc] ([http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.dds DDS] [http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.das 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'' dimension has 145 values, and ''siglay'' dimension has 40 values it may be that you wish to only retrieve a single time slice and/or siglay slice. This can accomplished by using an array constraint on the variable as it is passed to the ugrid function. For example, to retrieve the 12th siglay slice of the 5th 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 the function call is
:: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds
:: [http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.dds?ugr5(0,salinity%5B4%5D%5B11%5D%5B*%5D,%2238.0%3Clat%20&%20lat%3C42.0%20&%20-64.0%3Clon%20&%20lon%3C-60.0%22) <nowiki>ugr5(0,salinity[4][11][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")</nowiki>]
: We can see that there are three range variables associated with the nodes of the mesh that have a second dimension 'time'. Since the 'time' dimension is largish, with 1081 values, it may be that you wish to only retrieve one time slice. 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 5th time slice of the variable zeta you would constrain it like 'zeta[4][*]' (note that the indices begin at zero). In the request URL this would look like
: It is also possible to request, say, every 5th time slice ''salinity[0:5:*][*][*]'' or every 3rd siglay slice from 3 to 30 ''salinity[4][3:3:30][*]''. In a request URL this would look like
:: <nowiki>http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugr5(0,zeta[4][*],%2229.3%3Elat&lat%3C29.8&-95.0%3Elon&lon%3C-94.4%22) </nowiki>
::[http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.nc.dds?ugr5(0,salinity%5B4%5D%5B3:3:30%5D%5B*%5D,%2238.0%3Clat%20&%20lat%3C42.0%20&%20-64.0%3Clon%20&%20lon%3C-60.0%22) <nowiki>ugr5(0,salinity[4][3:3:30][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")</nowiki>]
: It is also possible to request, say, every 5th time slice 'zeta[0:5:*][*]' or every 3rd time slice from 3 to 30 'zeta[3:3:30][*]' in the request URL this would look like
::<nowiki> http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugr5(0,zeta[3:3:30][*],%2229.3%3Elat&lat%3C29.8&-95.0%3Elon&lon%3C-94.4%22)</nowiki>


=== The Data ===
== Sample 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/
A server with unstructured grid data and subsetting function on board is here: http://52.70.199.67: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
In the directory [http://52.70.199.67:8080/opendap/ugrids/ ugrids] You can find a number of test datasets:
; fvcom_1step.nc, hex.nc
: These are test data from Bill Howe. The ''hex'' file is small but it lacks the special variable the UGrid uses to encode metadata the function depends on to read the unstructured data.
; test4.nc, test4-rename-nodedata.ncml, test4-ugrid.ncml
: ''test4'' also lacks the special 'metadata variable' but we have written NcML (''test4-ugrid'') that adds it to the dataset, so you can use ugr5() with a URL that points at the virtual dataset that NcML file defines. The companion NcML file (''test4-rename-nodedata.ncml'') uses NcML to rename the node data variable and while this works fine for normal DAP accesses, the ugr5() won't work with this - the purpose of this example is to document a known bug where using NcML to rename a range variable breaks the function.
; NECOFS_GOM3_FORECAST.nc, NECOFS_WAVE_FORECAST.nc
: These files us a 3xN face node connectivity array (corresponding to the older version of the UGrid specification)
; Ike/2D_varied_manning_windstress and Ike/2D_varied_manning_windstress_wave
: These directories have data from c. 2008 that requires (minimal) NcML to work with our function
; RENCI
: Data used by the ODSIP EarthCube project. This directory has the same data (or nearly so) where the face node connectivity array is organized a Nx3 and 3xN.
; lana
: This is a bit of a mystery; it may have been lumped into the ugrid sample data by mistake.
; README
: A brief recap of this information


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.
<!--
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://52.70.199.67:8080/opendap/ugrids/test4-ugrid.ncml  Also in that directory is the dataset (NECOFS_GOM3_FORECAST.nc) that Rich Signell provided http://52.70.199.67:8080/opendap/hyrax/ugrids/NECOFS_GOM3_FORECAST.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.
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://52.70.199.67:8080/opendap/ugrids/Ike/ Inside you'll find that the 2D models have useful stuff. In http://52.70.199.67:8080/opendap/ugrids/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.
The file test_dir-norename.ncml can be subset using the ugrid restrict function: http://52.70.199.67:8080/opendap/ugrids/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.


<!--
=== Places for improvement ===
=== Places for improvement ===
* Make a version in which only the lat and lon boundaries are specified that then proceeds to subset all of the nodes, edges, and faces.
* Make a version in which only the lat and lon boundaries are specified that then proceeds to subset all of the nodes, edges, and faces.
*: See the "super restrict" function discussion below
*: See the "super restrict" function discussion below
* Allow the user to specify both face and grid variables
* Allow the user to specify both face and grid variables
*: It appears that this should be straight forward, and this is where I'll proceed.
*: It appears that this should be straight forward, and this is where I'll proceed.
*: '''UPDATE: This works now.''' Test URL: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ebs/fvcom_1step.nc.dds?ugr3(0,ua,h,%2228.0%3Clat%20&amp;%20lat%3C29.0%20&amp;%20-89.0%3Clon%20&amp;%20lon%3C-88.0%22)
*: '''UPDATE: This works now.''' Test URL: http://ec2-54-242-224-73.compute-1.amazonaws.com:8080/opendap/ugrids/fvcom_1step.nc.dds?ugr3(0,ua,h,%2228.0%3Clat%20&amp;%20lat%3C29.0%20&amp;%20-89.0%3Clon%20&amp;%20lon%3C-88.0%22)
* Figure out how to handle node (or edge, or face) variables that have additional dimensions.
* Figure out how to handle node (or edge, or face) variables that have additional dimensions.
*: '''UPDATE: This works now!'''
*: '''UPDATE: This works now!'''
Line 65: Line 108:
: where zeta is defined "Float32 zeta[time = 1081][node = 417642];"??
: where zeta is defined "Float32 zeta[time = 1081][node = 417642];"??
: '''UPDATE: YES! This works  now!'''
: '''UPDATE: YES! This works  now!'''


# Make individual functions that can be 'nested'
# Make individual functions that can be 'nested'

Latest revision as of 18:25, 7 December 2015

Overview

We have written server functions that utilize Bill Howe's Gridfields library to subset unstructured grids (aka irregular meshes) that conform to the UGrid 0.9 specification that is part of the CF-1.6 specification. Our function has a little latitude in its requirements because it also supports features found in earlier versions of the UGrid specification (e.g., the 'mesh array' can be either the Nx3 or 3xN). However, our function only supports triangular (2D) meshes, not the other mesh schemes outlined in the specification. The function will subset one or more range variables based on the values of the domain variables as expressed in a simple relational expression. The result of the function is an unstructured grid - that is, the subsetting operation will return a a set of variables that could be written to a netcdf file and the result would conform to the UGrid 0.9 specification. Because the specification has evolved over time and older data are still perfectly valid, we often 'tweak' those older datasets using NcML so that the contain the variables and attributes required by the newer versions of the UGrid specification. Our function supports both zero- and ones-based indexing for both the range and domain variables.

Background information on UGrid 0.9.0

The UGrid specification moved to GitHub in 2013. The 0.9.0 version of the specification was last edited on 29 Oct 2013. Our function conforms to that specification and to an older version (0.6?), where the major difference is the organization of the mesh array data. For a triangular array, the 0.9.0 version specifies the array be a Nx3 while the older specification specified a 3xN. Our code supports both.

The ugrid subsetting functions

These functions allow you to subset the UGrid dataset by the values associated with nodes, edges, or faces.

ugnr: Subset by node value.

Name
ugnr - Subset an unstructured 2D Mesh Topology grid based on domain values associated with the nodes
Syntax
ugnr(rangeVariable:string, [rangeVariable:string, ... ] condition:string)
  • The first, second, ..., parameter is a list of (range) data variable names that you wish to subset, they may be associated with nodes, edges, or faces of the mesh.
  • The last parameter is an expression that defines conditions that the domain variables must meet in order to be included in the result.
Here is an example:
ugnr(depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
Used in a url (that returns the DDS for the subset data):
http://52.70.199.67:8080/opendap/hyrax/ugrids/Ike/2D_varied_manning_windstress/test_dir-norename.ncml.dds?ugnr(depth,"28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")
Subsetting the range variables
In the example dataset NECOFS_GOM3_FORECAST.nc (DDS 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 dimension has 145 values, and siglay dimension has 40 values it may be that you wish to only retrieve a single time slice and/or siglay slice. This can accomplished by using an array constraint on the variable as it is passed to the ugrid function. For example, to retrieve the 12th siglay slice of the 5th 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 the function call is
ugnr(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 salinity[4][3:3:30][*]. In a request URL this would look like
ugnr(salinity[4][3:3:30][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")

uger: Subset by edge value.

Name
uger - Subset an unstructured 2D Mesh Topology grid based on domain values associated with the edges
Syntax
uger(rangeVariable:string, [rangeVariable:string, ... ] condition:string)
  • The first, second, ..., parameter is a list of (range) data variable names that you wish to subset, they may be associated with nodes, edges, or faces of the mesh.
  • The last parameter is an expression that defines conditions that the domain variables must meet in order to be included in the result.
Here is an example:
uger(depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")

ugfr: Subset by face value.

Name
ugfr - Subset an unstructured 2D Mesh Topology grid based on domain values associated with the faces
Syntax
ugfr(rangeVariable:string, [rangeVariable:string, ... ] condition:string)
  • The first, second, ..., parameter is a list of (range) data variable names that you wish to subset, they may be associated with nodes, edges, or faces of the mesh.
  • The last parameter is an expression that defines conditions that the domain variables must meet in order to be included in the result.
Here is an example:
ugfr(depth, "28.0<lat & lat<29.0 & -89.0<lon & lon<-88.0")


Retired Functions

The ugr5 Function

This function is deprecated. Supported by Hyrax 1.12.2 and earlier.

Name
ugr5 - Restrict the domain of an unstructured 2D Mesh Topology grid
Syntax
ugr5(0, rangeVariable:string, [rangeVariable:string, ... ] condition:string)
  • The first parameter indicates that the supplied relational constraint condition is to be applied to coordinate values at the nodes (0) or the faces (2) of the mesh.
  • The second, third, ..., parameter is a list of (range) data variables that you wish to subset, they may be associated with nodes or faces of the mesh.
  • The last parameter 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 (that returns the DDS for the subset data):
http://52.70.199.67:8080/opendap/hyrax/ugrids/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 NECOFS_GOM3_FORECAST.nc (DDS 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 dimension has 145 values, and siglay dimension has 40 values it may be that you wish to only retrieve a single time slice and/or siglay slice. This can accomplished by using an array constraint on the variable as it is passed to the ugrid function. For example, to retrieve the 12th siglay slice of the 5th 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 the function call is
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 salinity[4][3:3:30][*]. In a request URL this would look like
ugr5(0,salinity[4][3:3:30][*],"38.0<lat & lat<42.0 & -64.0<lon & lon<-60.0")

Sample Data

A server with unstructured grid data and subsetting function on board is here: http://52.70.199.67:8080/opendap/

In the directory ugrids You can find a number of test datasets:

fvcom_1step.nc, hex.nc
These are test data from Bill Howe. The hex file is small but it lacks the special variable the UGrid uses to encode metadata the function depends on to read the unstructured data.
test4.nc, test4-rename-nodedata.ncml, test4-ugrid.ncml
test4 also lacks the special 'metadata variable' but we have written NcML (test4-ugrid) that adds it to the dataset, so you can use ugr5() with a URL that points at the virtual dataset that NcML file defines. The companion NcML file (test4-rename-nodedata.ncml) uses NcML to rename the node data variable and while this works fine for normal DAP accesses, the ugr5() won't work with this - the purpose of this example is to document a known bug where using NcML to rename a range variable breaks the function.
NECOFS_GOM3_FORECAST.nc, NECOFS_WAVE_FORECAST.nc
These files us a 3xN face node connectivity array (corresponding to the older version of the UGrid specification)
Ike/2D_varied_manning_windstress and Ike/2D_varied_manning_windstress_wave
These directories have data from c. 2008 that requires (minimal) NcML to work with our function
RENCI
Data used by the ODSIP EarthCube project. This directory has the same data (or nearly so) where the face node connectivity array is organized a Nx3 and 3xN.
lana
This is a bit of a mystery; it may have been lumped into the ugrid sample data by mistake.
README
A brief recap of this information