Including netCDF Dimension Values in the Name of an Output Layer or Table

NetCDF (network Common Data Form) is a file format for storing multidimensional scientific data (variables) such as temperature, humidity, pressure, wind speed, and direction. Each of these variables can be displayed through a dimension (such as time, date, or depth) in ArcGIS by making a layer or table view from the netCDF file.  The layer or table view represents one “slice” of the dimension (for example a single date or depth).

When automating netCDF workflows using ModelBuilder, it is often helpful to append a dimension’s value to the name of the layer or table view (for example, temp_1_1_2009 or depth_20).   The basic procedure to accomplish this follows:

  1. Create a new model.
  2. Add the Make netCDF Raster Layer tool from the Multidimensional toolbox to the model.
  3. Right-click the Make netCDF Raster Layer tool, then select Make Variable >>  From Parameter >> Dimension Values.
  4. Add the Calculate Value tool (Data management >> General toolset) to the model.
  5. Double-click the Calculate Value tool.
  6. Convert any slashes in the date/time values to underscores by using the following for the Expression:
        "%Dimension Values%".replace("/","_")
    Note: Slashes in the name may cause problems for other geoprocessing tools.  In order to create a valid layer or table name, you may need to add additional expressions to the Calculate Value tool to remove any illegal characters from the dimension’s value.
  7. Right-click on the output of Calculate Value and rename it to CleanLayerName.

The model variable CleanLayerName will contain the value (or index) of the dimension used when creating the netCDF raster layer.  This variable can be used via in-line substitution to create more meaningful layer or table names in other geoprocessing tools.  For example, to use the dimension’s value as part of the output raster dataset name for the Copy Raster tool, specify it as in_memory%CleanLayerName%.  Similarly, to use it as the output table name for the Extract Values To Table tool, specify C:Workspaceprecip_%CleanLayerName%.

See the annotated model below for an example using the Copy Raster tool.

Using a dimension value as part of an output name and adding this output to the Table of Contents requires an additional step in the model.   Tool outputs with the Add To Display option checked are added to the display in ArcMap using the variable name. If you want the output of the geoprocessing tool to display in ArcMap with the actual unique dimension value instead of the name of the variable, connect the output to be displayed to the Collect Value tool, right-click on it, then check on the Add To Display option. If the model will be run from the model tool dialog box, then make the output of Collect Value a model parameter, since only the output model parameters are added to display.

The same procedure will also work for the Make netCDF Feature Layer and Make netCDF Table View tools.  The following model demonstrates this workflow.  Dotted lines in the diagram represent preconditions and are used to explicitly control the order of operations in the model.

If you would like to learn more about netCDF and multidimensional data, you can start with this topic in the ArcGIS help system:   What is netCDF data?

About the author

Kevin Butler is a Product Engineer on Esri’s Analysis and Geoprocessing Team working as a liaison to the science community. He holds a Ph.D. in Geography from Kent State University. Over the past decade he has worked on strategic projects, partnering with customers and other members of the science community to assist in the development of large ecological information products such as the ecological land units, ecological marine units and ecological coastal units. His research interests include a thematic focus on spatial statistical analytical workflows, a methodological focus on spatial clustering techniques and a geographic focus on Puerto Rico and midwestern cities.


Leave a Reply

Please Login to comment

Next Article

Monitor assignment status in ArcGIS Dashboards using a joined Workforce layer

Read this article