Generate Multidimensional Anomaly (Spatial Analyst)

Available with Image Analyst license.

Available with Spatial Analyst license.

Summary

Computes the anomaly for each slice in an existing multidimensional raster to generate a new multidimensional raster.

An anomaly is the deviation of an observation from its standard or mean value.

Usage

  • Supported multidimensional raster datasets include Cloud Raster Format (CRF), multidimensional mosaic datasets, or multidimensional raster layers generated by netCDF, GRIB, or HDF files.

  • This tool produces a multidimensional raster dataset in Cloud Raster Format (CRF). Currently, no other output formats are supported.

  • This tool calculates anomalies over time for one or more variables in a multidimensional raster. If you have a nontime dimension in addition to the time dimension, the anomaly will be calculated at each step in the additional dimension.

    For example, you have monthly ocean temperature data, collected every 1 meter of depth up to 100 meters, and you want to calculate the temperature anomalies as deviations from the yearly mean. The Generate Multidimension Anomaly tool will determine the temperature anomalies based on a yearly mean if you set the Mean Calculation Interval parameter to Yearly, and it will return anomaly values for each of the 100 depths.

  • This tool only supports multidimensional raster datasets that have a time dimension.

  • The mathematical methods for calculating anomaly values are listed below. Anomalies can be calculated using either the mean or the median values as the definition of the average. If the data distribution is skewed, the mean can be highly influenced by outliers, so the median value or z-score method may be better suited for this type of data.

    • Difference from mean = x - µ
      • x = pixel value in a slice
      • µ = mean of that pixel's values over the given time interval
    • Percent difference from mean = |x - µ| / [(x + µ)/2]
      • x = pixel value in a slice
      • µ = mean of that pixel's values over the given time interval
      • |x - µ| = absolute value of the difference between the value and the mean
    • Percent of mean = x / µ
      • x = pixel value in a slice
      • µ = mean of that pixel's values over the given time interval
    • Difference from median = x - ß
      • x = pixel value in a slice
      • ß = median of that pixel's values over the given time interval
    • Percent difference from median = |x - ß| / [(x + ß)/2]
      • x = pixel value in a slice
      • ß = median of that pixel's values over the given time interval
      • |x - ß| = absolute value of the difference between the value and the median
    • Percent of median = x / ß
      • x = pixel value in a slice
      • ß = median of that pixel's values over the given time interval
    • Z-score = (x - µ) / S
      • x = pixel value in a slice
      • µ = mean of that pixel's values over the given time interval
      • S = the standard deviation of the pixel's values over the given time interval

  • The mean or median will either be calculated from the input multidimensional raster or you can provide the mean or median values directly as a raster input in the Mean Calculation Interval parameter. The external raster can be a single raster or a multidimensional raster. If the input is a single raster, the difference from the mean will be calculated by comparing the pixel values in each slice to the corresponding pixel value in the external raster. If the input is a multidimensional raster, corresponding slices will be compared to calculate the difference from the mean, so the number and name of the variables and dimensions must match.

    The external raster must have the same extent, cell size, and spatial reference as the input multidimensional raster.

  • The z-score anomaly calculation method is not supported if an external raster is used to calculate the difference from the mean.

Parameters

LabelExplanationData Type
Input Multidimensional Raster

The input multidimensional raster dataset.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; File
Variables [Dimension Info] (Description)
(Optional)

The variable or variables for which anomalies will be calculated. If no variable is specified, all variables with a time dimension will be analyzed.

String
Anomaly Calculation Method
(Optional)

Specifies the method that will be used to calculate the anomaly.

  • Difference From Mean —The difference between a pixel's value and the mean of that pixel's values across slices defined by the interval will be calculated. This is the default.
  • Percent Difference From Mean —The percent difference between a pixel's value and the mean of that pixel's values across slices defined by the interval will be calculated.
  • Percent Of Mean —The percent of the mean will be calculated.
  • Z-score —The z-score for each pixel will be calculated. A z-score of 0 indicates the pixel's value is identical to the mean. A z-score of 1 indicates the pixel's value is 1 standard deviation from the mean. If a z-score is 2, the pixel's value is 2 standard deviations from the mean, and so on.
  • Difference From Median —The difference between a pixel's value and the mathematical median of that pixel's values across slices defined by the interval will be calculated.
  • Percent Difference From Median —The percent difference between a pixel's value and the mathematical median of that pixel's values across slices defined by the interval will be calculated.
  • Percent Of Median —The percent of the mathematical median will be calculated.
String
Mean Calculation Interval
(Optional)

Specifies the temporal interval that will be used to calculate the mean.

  • All —The mean is calculated across all slices for each pixel.
  • Yearly —The yearly mean is calculated for each pixel.
  • Recurring monthly —The monthly mean is calculated for each pixel.
  • Recurring weekly —The weekly mean is calculated for each pixel.
  • Recurring daily —The daily mean is calculated for each pixel.
  • Hourly —The hourly mean is calculated for each pixel.
  • External raster —An existing raster dataset that contains the mean or median value for each pixel is referenced.
String
Ignore NoData
(Optional)

Specifies whether NoData values are ignored in the analysis.

  • Checked—The analysis will include all valid pixels along a given dimension and ignore any NoData pixels. This is the default.
  • Unchecked—The analysis will result in NoData if there are any NoData values for the pixels along the given dimension.
Boolean
Input External Raster
(Optional)

The reference raster dataset that contains a previously calculated mean for each pixel. The anomalies will be calculated in comparison to this mean.

Raster Layer; Raster Dataset; Mosaic Layer; Mosaic Dataset

Return Value

LabelExplanationData Type
Output Multidimensional Raster

The output Cloud Raster Format (CRF) multidimensional raster dataset.

Raster

GenerateMultidimensionalAnomaly(in_multidimensional_raster, {variables}, {method}, {calculation_interval}, {ignore_nodata}, {reference_mean_raster})
NameExplanationData Type
in_multidimensional_raster

The input multidimensional raster dataset.

Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; File
variables
[variables,...]
(Optional)

The variable or variables for which anomalies will be calculated. If no variable is specified, all variables with a time dimension will be analyzed.

String
method
(Optional)

Specifies the method that will be used to calculate the anomaly.

  • DIFFERENCE_FROM_MEANThe difference between a pixel's value and the mean of that pixel's values across slices defined by the interval will be calculated. This is the default.
  • PERCENT_DIFFERENCE_FROM_MEANThe percent difference between a pixel's value and the mean of that pixel's values across slices defined by the interval will be calculated.
  • PERCENT_OF_MEANThe percent of the mean will be calculated.
  • Z_SCOREThe z-score for each pixel will be calculated. A z-score of 0 indicates the pixel's value is identical to the mean. A z-score of 1 indicates the pixel's value is 1 standard deviation from the mean. If a z-score is 2, the pixel's value is 2 standard deviations from the mean, and so on.
  • DIFFERENCE_FROM_MEDIANThe difference between a pixel's value and the mathematical median of that pixel's values across slices defined by the interval will be calculated.
  • PERCENT_DIFFERENCE_FROM_MEDIANThe percent difference between a pixel's value and the mathematical median of that pixel's values across slices defined by the interval will be calculated.
  • PERCENT_OF_MEDIANThe percent of the mathematical median will be calculated.
String
calculation_interval
(Optional)

Specifies the temporal interval that will be used to calculate the mean.

  • ALLThe mean is calculated across all slices for each pixel.
  • YEARLYThe yearly mean is calculated for each pixel.
  • RECURRING_MONTHLYThe monthly mean is calculated for each pixel.
  • RECURRING_WEEKLYThe weekly mean is calculated for each pixel.
  • RECURRING_DAILYThe daily mean is calculated for each pixel.
  • HOURLYThe hourly mean is calculated for each pixel.
  • EXTERNAL_RASTERAn existing raster dataset that contains the mean or median value for each pixel is referenced.
String
ignore_nodata
(Optional)

Specifies whether NoData values are ignored in the analysis.

  • DATA The analysis will include all valid pixels along a given dimension and ignore any NoData pixels. This is the default.
  • NODATAThe analysis will result in NoData if there are any NoData values for the pixels along the given dimension.
Boolean
reference_mean_raster
(Optional)

The reference raster dataset that contains a previously calculated mean for each pixel. The anomalies will be calculated in comparison to this mean.

Raster Layer; Raster Dataset; Mosaic Layer; Mosaic Dataset

Return Value

NameExplanationData Type
out_multidimensional_raster

The output Cloud Raster Format (CRF) multidimensional raster dataset.

Raster

Code sample

GenerateMultidimensionalAnomaly example 1 (Python window)

This example generates an anomaly multidimensional raster for temperature data, comparing pixel values with the mean pixel value across all slices.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
arcpy.CheckOutExtension("Spatial")
outTempAnomaly = GenerateMultidimensionalAnomaly(
	"C:/sapyexamples/data/climateData.nc", "temperature", "DIFFERENCE_FROM_MEAN",
        "ALL", "DATA")
outTempAnomaly.save("C:/sapyexamples/output/TempAnomaly.crf")
GenerateMultidimensionalAnomaly example 2 (stand-alone script)

This example generates an anomaly multidimensional raster for ocean temperature data, comparing pixel values with the yearly mean.

# Name: GenerateMultidimensionalAnomaly_Ex_02.py
# Description: Generates an anomaly multidimensional raster for
#           ocean temperature data, comparing pixel values with the yearly mean
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

""""
Usage: out_multidimensional_raster = GenerateMultidimensionalAnomaly(in_multidimensional_raster,
                                     {variables}, {method}, {temporal_interval})
"""

# Define input parameters
inputFile = "C:/sapyexamples/data/climateData.crf"
variable = "oceantemp"
averageMethod = "PERCENT_DIFFERENCE_FROM_MEAN"
averageInterval = "YEARLY"
ignoreNoData = "DATA"

# Execute GenerateMultidimensionalAnomaly
outYearlyAnomaly = GenerateMultidimensionalAnomaly(inputFile, variable, 
	averageMethod, averageInterval, ignoreNoData)

# Save the output
outYearlyAnomaly.save("C:/sapyexamples/output/TempAnomaly.crf")

Licensing information

  • Basic: Requires Spatial Analyst or Image Analyst
  • Standard: Requires Spatial Analyst or Image Analyst
  • Advanced: Requires Spatial Analyst or Image Analyst

Related topics