Available with Image Analyst license.

Available with Spatial Analyst license.

## Summary

Generates a multidimensional raster dataset by combining existing multidimensional raster variables along a dimension.

## Usage

Use the Aggregation Definition parameter to choose an interval using a keyword, a value, or a range of values. For example, if you have 30 years of sea surface temperature data, collected daily and at every 5 meters depth up to 100 meters, you can use the different interval options for the following scenarios:

- Aggregate daily temperature data into monthly data, where the result is a multidimensional raster with 12 time slices, and each slice is the aggregate of each month across all the years. Choose Interval Keyword and set the keyword to Recurring Monthly.
- Aggregate daily temperature data into monthly data, where the result is a multidimensional raster with 360 slices, or 12 time slices per year (30 years x 12 months = 360 slices). Choose Interval Keyword and set the keyword to Monthly.
- Aggregate monthly temperature data into 4-month intervals. Choose Interval Value, set Value Interval to 4, and set Unit to Months.
- Aggregate temperature data from 0 to 25 meters, then from 25 to 50 meters, then from 50 to 100 meters. Choose Interval Ranges and specify minimum and maximum depths as 0 25; 25 50; 50 100.

Supported multidimensional raster datasets include netCDF, GRIB, HDF, and Esri's CRF. Multidimensional mosaic datasets are also supported.

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

By default, the multidimensional raster output will be compressed using the LZ77 compression type. It is recommended, however, that you change the compression type to LERC and adjust the Maximum Error based on your data. For example, if you expect the results of the analysis to be accurate to three decimal places, use 0.001 for the Maximum Error. It's best to avoid unnecessary accuracy requirements, as they will increase the processing time and storage size.

To change the compression type, modify the Environment setting.

## Syntax

AggregateMultidimensionalRaster(in_multidimensional_raster, dimension, {aggregation_method}, {variables}, {aggregation_def}, {interval_keyword}, {interval_value}, {interval_unit}, {interval_ranges}, {aggregation_function}, {ignore_nodata})

Parameter | Explanation | Data Type |

in_multidimensional_raster | The input multidimensional raster dataset. | Raster Dataset; Raster Layer; Mosaic Dataset; Mosaic Layer; Image Service; File |

dimension | The aggregation dimension. This is the dimension along which the variables will be aggregated. | String |

aggregation_method (Optional) | Specifies the mathematical method that will be used to combine the aggregated slices in an interval. - MEAN —The mean of a pixel's values will be calculated across all slices in the interval. This is the default.
- MAXIMUM —The maximum value of a pixel will be calculated across all slices in the interval.
- MAJORITY —The pixel value that occurred most frequently will be calculated across all slices in the interval.
- MINIMUM —The minimum value of a pixel will be calculated across all slices in the interval.
- MINORITY —The pixel value that occurred least frequently will be calculated across all slices in the interval.
- MEDIAN —The median value of a pixel will be calculated across all slices in the interval.
- RANGE —The range of values for a pixel will be calculated across all slices in the interval.
- STD —The standard deviation of a pixel's values will be calculated across all slices in the interval.
- SUM —The sum of a pixel's values will be calculated across all slices in the interval.
- VARIETY —The number of unique pixel values will be calculated across all slices in the interval.
- CUSTOM —The pixel value will be calculated based on a custom raster function.
When aggregation_method is set to CUSTOM, the aggregation_function parameter becomes enabled. | String |

variables [variables,...] (Optional) | The variable or variables that will be aggregated along the given dimension. If no variable is specified, all variables with the selected dimension will be aggregated. For example, to aggregate daily temperature data into monthly average values, specify temperature as the variable to be aggregated. If you do not specify any variables and you have both daily temperature and daily precipitation variables, both variables will be aggregated into monthly averages and the output multidimensional raster will include both variables. | String |

aggregation_def (Optional) | Specifies the dimension interval for which the data will be aggregated. - ALL —The data values will be aggregated across all slices. This is the default.
- INTERVAL_KEYWORD —The variable data will be aggregated using a commonly known interval.
- INTERVAL_VALUE —The variable data will be aggregated using a user-specified interval and unit.
- INTERVAL_RANGES —The variable data will be aggregated between specified pairs of values or dates.
| String |

interval_keyword (Optional) | Specifies the keyword interval that will be used when aggregating along the dimension. This parameter is required when the aggregation_def parameter is set to INTERVAL_KEYWORD and the aggregation must be across time. - HOURLY —The data values will be aggregated into hourly time steps, and the result will include every hour in the time series.
- DAILY —The data values will be aggregated into daily time steps, and the result will include every day in the time series.
- WEEKLY —The data values will be aggregated into weekly time steps, and the result will include every week in the time series.
- DEKADLY —The data values will be aggregated into 3 periods of 10 days each. The last period can contain more or fewer than 10 days. The output will include 3 slices for each month.
- PENTADLY —The data values will be aggregated into 6 periods of 5 days each. The last period can contain more or fewer than 5 days. The output will include 6 slices for each month.
- MONTHLY —The data values will be aggregated into monthly time steps, and the result will include every month in the time series.
- QUARTERLY —The data values will be aggregated into quarterly time steps, and the result will include every quarter in the time series.
- YEARLY —The data values will be aggregated into yearly time steps, and the result will include every year in the time series.
- RECURRING_DAILY —The data values will be aggregated into daily time steps, and the result will include one aggregated value per Julian day. The output will include, at most, 366 daily time slices.
- RECURRING_WEEKLY —The data values will be aggregated into weekly time steps, and the result will include one aggregated value per week. The output will include, at most, 53 weekly time slices.
- RECURRING_MONTHLY —The data values will be aggregated into monthly time steps, and the result will include one aggregated value per month. The output will include, at most, 12 monthly time slices.
- RECURRING_QUARTERLY —The data values will be aggregated into quarterly time steps, and the result will include one aggregated value per quarter. The output will include, at most, 4 quarterly time slices.
| String |

interval_value (Optional) | The size of the interval that will be used for the aggregation. This parameter is required when the aggregation_def parameter is set to INTERVAL_VALUE. For example, to aggregate 30 years of monthly temperature data into 5-year increments, enter 5 as the interval_value, and specify interval_unit as YEARS. | Double |

interval_unit (Optional) | The unit that will be used for the interval_value parameter. This parameter is required when the dimension parameter is set to a time field and the aggregation_def parameter is set to INTERVAL_VALUE. If you are aggregating anything other than time, this option will not be available and the unit for the interval value will match the variable unit of the input multidimensional raster data. - HOURS —The data values will be aggregated into hourly time slices at the interval provided.
- DAYS —The data values will be aggregated into daily time slices at the interval provided.
- WEEKS —The data values will be aggregated into weekly time slices at the interval provided.
- MONTHS —The data values will be aggregated into monthly time slices at the interval provided.
- YEARS —The data values will be aggregated into yearly time slices at the interval provided.
| String |

interval_ranges [interval_ranges,...] (Optional) | Interval ranges specified in a value table will be used to aggregate groups of values. The value table consists of pairs of minimum and maximum range values, with data type Double or Date. This parameter is required when the aggregation_def parameter is set to INTERVAL_RANGE. | Value Table |

aggregation_function (Optional) | A custom raster function that will be used to compute the pixel values of the aggregated rasters. The input is a raster function JSON object or an .rft.xml file created from a function chain or a custom Python raster function. This parameter is required when the aggregation_method parameter is set to CUSTOM. | File; 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.
- NODATA —The analysis will result in NoData if there are any NoData values for the pixels along the given dimension.
| Boolean |

#### Return Value

Name | Explanation | Data Type |

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

## Code sample

This example aggregates temperature data into yearly data with the average temperature values.

```
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
arcpy.CheckOutExtension("Spatial")
outAggMultidim = AggregateMultidimensionalRaster("C:/sapyexamples/data/climateData.crf",
"StdTime", "MEAN", "temperature", "INTERVAL_KEYWORD", "YEARLY",
"", "", "", "", "DATA")
outAggMultidim.save("C:/sapyexamples/output/YearlyTemp.crf")
```

This example aggregates daily precipitation and temperature data into monthly data with the maximum precipitation and temperature values.

```
# Name: AggregateMultidimensionalRaster_Ex_02.py
# Description: Aggregates daily precipitation and temperature data into
# monthly data with the maximum precipitation and temperature values
# 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 = AggregateMultidimensionalRaster(in_multidimensional_raster, dimension,
{aggregation_method}, {variables},
{aggregation_def}, {interval_keyword}, {ignore_nodata})
"""
# Define input parameters
inputFile = "C:/sapyexamples/data/dailyclimateData.crf"
dimensionName = "StdTime"
aggregationMethod = "Maximum"
variables = "temperature;precipitation"
aggregationDefinition = "INTERVAL_KEYWORD"
keyword = "MONTHLY"
ignore_nodata = "DATA"
# Execute AggregateMultidimensionalRaster
outAggMultidim = AggregateMultidimensionalRaster(inputFile, dimensionName,
aggregationMethod, variables, aggregationDefinition, keyword, "", "", "", "",
ignore_nodata)
# Save the output
outAggMultidim.save("C:/sapyexamples/output/monthlymaxtemp.crf")
```

## Environments

## Licensing information

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