Learn R Programming

spex (version 0.7.1)

latmask: Latitude mask for polar raster

Description

Mask out values based on latitude for a raster. This works by finding all cells at latitudes less than latitude and setting them to missing. If southern = FALSE the inequality is reversed, and all cells at latitudes greater than latitude are masked out.

Usage

latmask(x, latitude = 0, southern = TRUE, trim = FALSE, ...)

Arguments

x

a raster layer

latitude

maximum latitude (effectively a minimum latitude if southern = FALSe)

southern

flag for whether south-polar context is used, default is TRUE

trim

if TRUE runs raster::trim on the result, to remove NA margin

...

ignored currently

Value

RasterLayer

Details

The trim option allows for the result to be reduced to the common bounding box within which any row or column has a non-missing value.

See Also

raster::trim, latitudecircle

Examples

Run this code
# NOT RUN {
 
library(raster)
plot(latmask(ice, -60))
plot(latmask(ice, -60, trim = TRUE))
ice[!ice > 0] <- NA
plot(ice)
plot(latmask(ice, -55, trim = TRUE))
# }

Run the code above in your browser using DataLab