# Generate Trend Raster (Map Viewer Classic) The Generate Trend Raster tool estimates the trend for each pixel along a dimension for one or more variables in a multidimensional raster.

##### Note:

This tool is now available in Map Viewer, the modern map-making tool in ArcGIS Enterprise. To learn more, see Generate Trend Raster (Map Viewer).

To run this tool, the portal must be configured for raster analysis.

If you do not see this tool in Map Viewer Classic, contact your organization administrator. Your portal may not be configured for raster analysis, or you may not have the privileges required to run the tool.

## Workflow diagram ## Example

• Given 40 years of monthly ocean temperature data, calculate the linear trend line fit for each pixel to see where and how temperature changed over time.
• Given daily precipitation data collected over 10 years, use the harmonic trend line option and examine the R-squared goodness of fit statistic to see whether a seasonal trend is present in the data.

## Usage notes

This tool can be used to fit data along a linear, harmonic, or polynomial trend line, or it can be used to perform trend detection using the Mann-Kendall or Seasonal-Kendall test.

The output trend raster generated with this tool is used as the input to the Predict Using Trend Raster tool.

The Mann-Kendall and Seasonal-Kendall tests are used to determine whether there is a monotonic trend in the data. They are nonparametric, meaning they do not assume a specific distribution of data The Mann-Kendall test does not consider serial correlation or seasonal effects. If the data is seasonal, the Seasonal-Kendall test is more appropriate.

There are three trend line options for fitting a trend to the variable values along a dimension: linear, harmonic, and polynomial. • 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:

• Where:
• 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

• 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:

• Where:
• 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

• 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:

• Where:
• y = the pixel's variable value
• x = the dimension value
• ß0, ß1, ß2, ß3, ..., ßn = constant coefficients

If you perform linear, harmonic, or polynomial trend fitting, the output is a multidimensional imagery layer 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 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

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 the following occurs:

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

If the tool is used to perform either the Mann-Kendall test or the Seasonal-Kendall test, the output is a five-band raster as follows:

• Band 1 = Sen's slope
• Band 2 = p-value
• Band 3 = Mann-Kendall score (S)
• Band 4 = S Variance
• Band 5 = Z-score

The outputs from the Mann-Kendall or Seasonal-Kendall test can be used to determine which pixels in your multidimensional time series have a statistically significant trend. You can use this information in conjunction with the linear, harmonic, or polynomial trend analysis to extract significant trends in your time series. You can generate a mask including pixels with significant p-values, apply the mask to the multidimensional raster, and use this masked multidimensional raster as the input to the tool to perform linear, harmonic, or polynomial trend analysis.

Model goodness-of-fit statistics can be generated as optional outputs for linear, harmonic, and polynomial trend rasters. The root mean square error (RMSE), R-squared, and the trend slope p-value can be calculated and displayed in the output raster using the RGB renderer and specifying the statistics as the red, green, and blue channels.

For information on how to publish multidimensional imagery layers, see Publish multidimensional imagery layers.

If Use current map extent is checked, only the pixels that are visible in the current map extent will be analyzed. If unchecked, the entire input imagery layer will be analyzed.

The parameters for this tool are listed in the following table:

ParameterExplanation
Choose multidimensional imagery layer to analyze trend

The input multidimensional imagery layer to analyze.

Choose dimension along which variable trend will be analyzed

The dimension along which a trend will be calculated for the variable or variables selected.

Choose variable(s) to analyze trend

The variable or variables for which trends will be calculated. If no variable is specified, the first variable in the multidimensional imagery layer will be analyzed.

Choose the type of line to fit variable values along a dimension

Specifies the type of line that will be used to fit to the pixel values along a dimension.

• Linear—Variable pixel values will be fitted along a linear trend line. This is the default.
• Polynomial—Variable pixel values will be fitted along a second order polynomial trend line.
• Harmonic—Variable pixel values will be fitted along a harmonic trend line.
• Mann-Kendall—Variable pixel values will be evaluated using the Mann-Kendall trend test.
• Seasonal-Kendall—Variable pixel values will be evaluated using the Seasonal-Kendall trend test.

Specify the time unit for the length of a seasonal period

Specifies the time unit that will be used for the length of a seasonal period when performing the Seasonal-Kendall test.

• Days—The unit for the length of the seasonal period will be days. This is the default.
• Months—The unit for the length of the seasonal period will be months.

Specify the length of harmonic cycle

The length of periodic variation that will be modeled. For example, leaf greenness often has one strong cycle of variation in a year, so the cycle length is 1 year. Hourly temperature data has one strong cycle of variation throughout a day, so the cycle length is 1 day. If you expect your data to go through two cycles of variation in one year, the length of cycle is 0.5 years or 182.5 days.

The default length is 1 year for data that varies on an annual cycle.

This parameter is required when the trend line type is set to Harmonic and the dimension is time.

Choose the time unit of harmonic cycle length

Specifies the time unit that will be used for the length of a harmonic cycle.

• Days—The unit for the length of the harmonic cycle will be days.
• Years—The unit for the length of the harmonic cycle will be years. This is the default.

This parameter is required when the trend line type is set to Harmonic and the dimension is time.

Specify the frequency number for the harmonic trend fitting

The frequency that will be used in harmonic trend fitting. This parameter specifies the frequency of cycles in a year. If the frequency is set to 1, a combination of linear and the first order harmonic curve will be used to fit the model. If the frequency is 2, a combination of linear, first order harmonic curve, and second order harmonic curve will be used to fit the data.

The default value is 1.

This parameter is required when the trend line type is set to Harmonic and the dimension is time.

Specify the polynomial order number for the trend fitting

The polynomial order number that will be used in polynomial trend fitting.

The default value is 2, or second order polynomial.

This parameter is required when the trend line type is set to Polynomial and the dimension is time.

Choose model statistics to be included in trend raster

Specifies the statistics that will be calculated in the output.

• RMSE

• Checked—The RMSE will be calculated and included as one of the multiple bands in the output trend raster. This is the default.
• Unchecked—The RMSE will not be calculated.
• R-squared

• Checked—The R-squared value will be calculated and included as one of the multiple bands in the output trend raster.
• Unchecked—The R-squared value will not be calculated. This is the default.
• P-value of slope coefficient

• Checked—The p-value will be calculated and included as one of the multiple bands in the output trend raster.
• Unchecked—The p-value will not be calculated. This is the default.

Ignore missing values in calculation

Specifies whether missing 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 pixel along the given dimension.

Result layer name

The name of the layer that will be created in My Content and added to the map. The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another name.

You can specify the name of a folder in My Content where the result will be saved using the Save result in drop-down box.

## Environments

Analysis environment settings are additional parameters that affect a tool's results. You can access the tool's analysis environment settings by clicking the gear icon at the top of the tool pane.

This tool honors the following Analysis Environments:

• Output coordinate system—Specifies the coordinate system of the output layer.
• Extent—Specifies the area to be used for analysis.
• Snap Raster—Adjusts the extent of the output so it matches the cell alignment of the specified snap raster layer.
• Cell size—The cell size to use in the output layer.
• Resampling method—The method to use to interpolate pixel values.
• Parallel processing factor—Controls the raster processing CPU or GPU instances.

## Similar tools and raster functions

Use Generate Multidimensional Anomaly to calculate anomaly values for variables over time. Other tools may be useful in solving similar problems.

### Map Viewer Classic analysis tools and raster functions

The Predict Using Trend Raster tool uses the output from the Generate Trend Raster tool to forecast variable values to a future date or range of dates.

### ArcGIS Pro analysis tools and raster functions

The Generate Trend Raster geoprocessing tool is available in the Image Analyst toolbox.

Generate Trend is also available as a raster function.

### ArcGIS Enterprise developers resources

If you are working in ArcGIS REST API, use the Generate Trend Raster task.

If you are working in ArcGIS API for Python, use generate_trend_raster from the arcgis.raster.analytics module.