When working with multidimensional or similarly structured data, each raster or slice of data can be used as input to a raster function. While this can be done manually after adding them as layers to the map, it can be tedious when there are multiple inputs or multiple groups of inputs involved. A better solution is to organize your inputs or groups of inputs in a mosaic dataset, and attach a raster function template. When a raster function template is applied to the mosaic dataset, the inputs to the template can be items within the mosaic dataset.
In this scenario, mosaic dataset items need to be grouped logically, using group and tag fields, before they are passed into the template. Raster function templates applied to mosaic datasets need to work with minimal interaction. If your data is not grouped or tagged, you will need to define inputs to the template every time it is applied. Grouping and tagging is useful when working with multidimensional mosaic datasets.
To use items from a mosaic dataset in a raster function template, you'll set up the template first, attach that template to the mosaic dataset, and select the mosaic dataset items to use as inputs to the template. Once the mosaic dataset is added as a layer to a map, you can select the template to visualize your data.
Set up the raster function template to use individual items from a mosaic dataset
If you have a mosaic dataset that contains four raster datasets depicting slope, aspect, elevation, and hillshade, and you want to apply a processing template that uses all four of these surface datasets as inputs to a model, you need to set up your raster function template to use items from the mosaic dataset..
- Edit your raster function template properties to use items from your mosaic dataset.
- Identify the fields in your mosaic dataset attribute table that will be used as the Group Field Name and Tag Field Name. These can be fields that exist in your mosaic dataset, or you can create and populate fields. The Group Field Name references the field used to define the collection of rasters in your mosaic dataset that will be passed into the template. In the example above, State is used as the Group Field Name, where all rasters with the same State value will be passed to the template together. The Tag Field Name references the field that is used to identify each individual item within a group. In the example above, SurfaceType is used as the Tag Field Name.
- Open the raster function template properties dialog box by right-clicking a raster function template in the Raster Functions pane or clicking Edit Properties in the Function Editor pane.
- Set the Type to Item Group on the Edit Properties dialog box. This configures the template to work on items in the mosaic dataset.
- Provide field names for Group Field Name and Tag Field Name.
- Match the values from the tag field with the names of the inputs in your raster function template.
- Open the Function Editor pane for your raster function template.
- Right-click a function in the function chain and click Properties or double-click the function to open the properties dialog box for the function.
- Click the Variables tab to set the name of each variable input. In the example above, slope, elevation, aspect, and hillshade are used to identify the item in the mosaic dataset to use.
- Save the template when you're finished.
Set up the raster function template to use groups of items from a mosaic dataset
A similar workflow is used when a group of items from a mosaic dataset is used as input to a function that accepts a list of rasters. For example, if you pass all of the mosaic dataset items that show sea surface temperature (SST), over time, to the Cell Statistics function, statistics will be calculated from multiple rasters on a pixel-by-pixel basis.
- Open the raster function template properties dialog box by right-clicking a raster function template in the Raster Functions pane or clicking Edit Properties in the Function Editor pane.
- Set Type to Item Group on the Edit Properties dialog box.
- Provide field names for Group Field Name and Tag Field Name. In the example above, Property is used as the group field such that all raster items displaying the same property, such as SST and ocean depth, are passed to the raster function. The Date field is the tag field.
- Open the Function Editor pane for your raster function template.
- Right-click a function in the function chain and click Properties or double-click the function to open the properties dialog box for the function.
- Click the Variables tab to set the name of the input rasters as Raster[]. This name notifies the function to process a list of grouped items.
- Save the template.
When you've finished setting up the template, you can attach the template to your mosaic dataset using the mosaic dataset template manager. Apply the template to the mosaic dataset; on the Data contextual tab, choose the arrow below the Processing Templates option.