Available with Image Analyst license.

## Summary

Estimates the trend for each pixel along a dimension for one or more variables in a multidimensional raster.

## Usage

A use example for this tool is you have 40 years worth of monthly ocean temperature data, and you want to fit a trend line for each pixel to see where and how temperature changed over time.

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.

There are three trend line options for fitting a trend to the variable values along a dimension: linear, polynomial, and harmonic. The three trend fitting options are described below.

- Linear—The linear trend line is a best-fit straight line that is used to estimate simple linear relationships. A linear trend highlights a rate of change that is increasing or decreasing at a steady rate. The formula for the linear trend line is as follows:
- y = the pixel's variable value
- x = the dimension value
- ß0 = the y-intercept
- ß1 = the linear slope or rate of change
ß1 > 0 indicates an increasing trend

ß1 < 0 indicates a decreasing trend

- Polynomial—The polynomial trend line is a curved line that is useful for data that fluctuates. In this case, a polynomial order value is used to indicate the maximum number of fluctuations that occur. The formula for the polynomial trend line is as follows:
- y = the pixel's variable value
- x = the dimension value
- ß0, ß1, ß2, ß3, ..., ßn = constant coefficients

- Harmonic—The harmonic trend line is a periodically repeating curved line that is best used to describe data that follows a cyclical pattern, such as seasonal temperature changes. The formula for the harmonic trend line is as follows:
- y = the pixel's variable value
- t = the Julian date
- ß0 = the y-intercept
- ß1 = the rate of change
- α, γ = coefficients of inter-annual or intra-annual changes
- ω = 1 / i
- f = the harmonic frequency

- Linear—The linear trend line is a best-fit straight line that is used to estimate simple linear relationships. A linear trend highlights a rate of change that is increasing or decreasing at a steady rate. The formula for the linear trend line is as follows:
The output trend raster generated with this tool is used as the input to the Predict Using Trend Raster tool. The output is a multidimensional raster in which each slice is a multiband raster containing information about the trend line. If you are analyzing the trend for a single variable for a dataset containing a single dimension (for example, time), there will be a single slice in the output dataset. If you are analyzing a single variable for a dataset containing multiple dimensions (for example, time and depth), each slice will contain trend information for each dimension value along the dimension that was not included in the analysis.

For Linear trend analysis, the output contains three-band rasters, where:

- Band 1 = Slope
- Band 2 = Intercept
- Band 3 = Root Mean Square Error (RMSE) or the error around the line of best fit

For Polynomial trend analysis, the number of bands in the output depends on the polynomial order. Second order polynomial fitting produces a four-band raster, where:

- Band 1 = Polynomial_2
- Band 2 = Polynomial_1
- Band 3 = Polynomial_0
- Band 4 = RMSE

Third order polynomial fitting produces a five-band raster, where:

- Band 1 = Polynomial_3
- Band 2 = Polynomial_2
- Band 3 = Polynomial_1
- Band 4 = Polynomial_0
- Band 5 = RMSE

For Harmonic trend analysis, the number of bands in the output depends on the harmonic frequency. When the frequency is set to 1, the output is a five-band raster, where:

- Band 1 = Slope
- Band 2 = Intercept
- Band 3 = Harmonic_sin1
- Band 4 = Harmonic_cos1
- Band 5 = RMSE

When the frequency is set to 2, the output is a seven-band raster, where:

- Band 1 = Slope
- Band 2 = Intercept
- Band 3 = Harmonic_sin1
- Band 4 = Harmonic_cos1
- Band 5 = Harmonic_sin2
- Band 6 = Harmonic_cos2
- Band 7 = RMSE

## Syntax

GenerateTrendRaster(in_multidimensional_raster, dimension, {variables}, {line_type}, {frequency}, {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 dimension along which a trend will be extracted for the variable or variables selected in the analysis. | String |

variables [variables,...] (Optional) | The variable or variables for which trends will be calculated. If no variable is specified, the first variable in the multidimensional raster will be analyzed. | String |

line_type (Optional) | Specifies the type of line to be used to fit to the pixel values along a dimension. - LINEAR —Fits the pixel values for a variable along a linear trend line. This is the default.
- POLYNOMIAL —Fits the pixel values for a variable along a second order polynomial trend line.
- HARMONIC —Fits the pixel values for a variable along a harmonic trend line.
| String |

frequency (Optional) | If the line_type parameter is HARMONIC, the default value is 1 ,or one harmonic cycle per year. If the line_type parameter is POLYNOMIAL, the default value is 2, or second order polynomial. | Long |

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 calculates the polynomial trend fit for precipitation data over time.

```
# Import system modules
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
# Execute
trendCoeffMultidim = GenerateTrendRaster("C:/data/model_time_series.crf",
"StdTime", "precip", "POLYNOMIAL", 2, "NODATA")
# Save output
trendCoeffMultidim.save("C:/data/polynomial_trend_coefficients.crf")
```

This example calculates the linear trend fit for temperature and salinity data over time.

```
# Import system modules
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
# Define input parameters
inFile = "C:/Data/ClimateVariables.crf"
dimensionName = "Depth"
variables = "salinity;temp"
trend_model = "LINEAR"
ignore_Nodata = "DATA"
# Execute - fit a linear model for salinity and temperature
trendCoeffMultidim = GenerateTrendRaster(inFile, dimensionName,
variables, trend_model, None, ignore_nodata)
# Save output
trendCoeffMultidim.save("C:/data/linear_trend_coefficients.crf")
```

This example calculates the harmonic trend fit along an NDVI time series.

```
# Import system modules
import arcpy
from arcpy.ia import *
# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")
# Define input parameters
inFile = "C:/data/ndvi_time_series.crf"
dimensionName = "StdTime"
variables = "ndvi"
trend_model = "HARMONIC"
harmonic_frequency = 2
ignore_Nodata = "DATA"
# Execute
trendCoeffMultidim = GenerateTrendRaster(inFile, dimensionName,
variables, trend_model, harmonic_frequency, ignore_nodata)
# Save output
trendCoeffMultidim.save("C:/data/harmonic_trend_coefficients.crf")
```

## Environments

## Licensing information

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