The Calculator block allows you to apply your own algorithmic expression to bands in an image collection. The results of the calculation are added as a new band or a new dataset.

Click on the pencil icon to add variables and write an expression.

### Add variable

Click ‘Add new variable’ to select the bands you want to use as variables in your calculation. You can use bands from any dataset in your project.

Click on the **trash** icon to delete the variable.

### Datasets

Select the dataset from the dropdown.

Use theConvert features to imagesblock to apply calculations to a feature collection.

To use a dataset from a different workflow in your calculation, add theSave dataset for re-useblock.

### Dates

Select which images from the time series to include in the calculation. You can select one, some or all dates.

### Transform

Click on the Transform option at the bottom of the list to aggregate all of your selected dates into a single image. You can choose to aggregate by:

**Median**: selects the middle value for each pixel**Mean**: creates an average from each value for each pixel**Sum**: calculates the total of all the values of each pixel**Min**: selects the minimum value from all pixels**Max**: selects the maximum value from all pixels**Count**: Counts every pixel that has a value (parts of an image that have been masked out won’t have a value)**Standard deviation**: calculates the standard deviation of the pixel values over all the dates (a common measure of variation in data)**Variance**: calculates the variance of the pixel values over all the dates (a common measure of variation in data)

Click the All dates option twice to clear the selections in the dropdown.

### Bands

Select which bands to include in the calculation.

### Transform bands

Click on the Transform option at the bottom of the list to aggregate all of your selected bands into a single band. You can choose to aggregate by:

**Median**: selects the middle value for each pixel across the bands chosen**Mean**: creates an average from each value for each pixel**Sum**: calculates the total of all the values of each pixel**Min**: selects the minimum value from all pixels**Max**: selects the maximum value from all pixels**Count**: Counts the number of pixels that have a value (parts of an image that have been masked out won’t have a value)**Standard deviation**: calculates the standard deviation of the pixel values over all the dates (a common measure of variation in data)**Variance**: calculates the variance of the pixel values over all the bands (a common measure of variation in data)

Click the All properties option twice to clear the selections in the dropdown.

Transforming bands that don't have comparable values will give invalid results.

### Name

Variables are given a unique name based on the dataset, band and date range. You can change this by clicking on the name.

Click on the ‘**+**’ icon to add the variable to the expression window.

### Select operators

Use the buttons to add operators into the expression window, or type them in directly.

### Write your expression

Use your variables and the operators to write your expression.

Example expressions:

VARIABLE_A - VARIABLE_B

VARIABLE_A / 5

Click **Check expression** to make sure your expression is valid.

### Saving results

You have the option to save the result as a:

- New band: Adds a band to the existing dataset. You can only choose this option for a single band. If you have selected multiple bands in a variable, use the Transform option to combine them, or alternatively save the results as a dataset to retain multiple bands.
- New dataset: Adds the band (or bands) to a new dataset.

You can add multipleCalculatorblocks to a workflow. Any band created in a Calculator block can be used in other Calculator blocks placed below it.

Placing theCalculatorblock above anAggregate images in time blockapplies the calculation on each image, then collate the results. Placing it after applies the calculation to the combined image.

Learn more: Applying your own algorithms

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Feedback sent

We appreciate your effort and will try to fix the article