Skip To Content

Subset

Available with Image Analyst license.

Summary

Creates a raster object that is a subset of the input multidimensional raster based on selected variables and dimension intervals.

Discussion

Use the Subset function to extract a subgroup of variable data from a multidimensional raster object. You can use the subgroup as an input to additional functions. For example, to calculate the average monthly precipitation values for a multidimensional raster that contains both temperature and precipitation data, you can first use Subset to extract the precipitation variable only as a raster object. Then you can use the Aggregate function to compute the monthly average.

The function creates a raster object that is a subgroup of the input, with dimension and variable information defined by the input parameters.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

Syntax

Subset (in_raster, {variables}, {dimension_definitions})
ParameterExplanationData Type
in_raster

The input multidimensional raster dataset.

Raster
variables
[variables,...]

A variable name or a list of variable names to be included in the output raster. If not specified, all variables will be included.

String
dimension_definitions

The dimension interval used to subset the multidimensional raster. This parameter is passed as a dictionary in which the key-value pairs must use one of the formats as follows:

  • <dimension_name>:value

    For example, to subset variables with the depth dimension only at the depth of 0, use {"depth": 0 }.

  • <dimension_name>:(min, max)

    For example, to subset variables with the depth dimension from a depth of 0 to 100, use {"depth": (-100,0)}.

  • <dimension_name>:[value1, (min, max)]

    For example, to subset variables with the depth dimension from a depth of 0 to 100 and also at a depth of 500, use {"depth": [-500, (-100, 0)]}].

  • <dimension_name>: (from, to, recurrent_interval_size, interval unit)

    For example, to subset variables with the time dimension 1980 to 2000, extracting the first day of every year, use {"StdTime": ('1980-01-01T12:00:00', None, 1, 'year'}.

    To subset variables with the time dimension 1980 to 2000, extracting January of every year, use {"StdTime": ('1980-01-01T12:00:00', 1980-31-01T12:00:00', 1, 'year'}.

Dictionary
Return Value
Data TypeExplanation
Raster

The output subset multidimensional raster.

Code sample

Subset example

Extract four subsets from climate multidimensional data and save the final subset.

Missing source code file