assess_env_uncertainty: Compute variation of environmental conditions.

View source: R/assess_env_uncertainty.R

assess_env_uncertaintyR Documentation

Compute variation of environmental conditions.

Description

Given a grid system and environmental data this function compute the standard deviation for each feature of the grid system.

Usage

assess_env_uncertainty(x, y, by = 1000, scale = 1000)

Arguments

x

ee$Image or ee$ImageCollection objects with a single band.

y

ee$Geometry$*, ee$Feature, ee$FeatureCollection or sf objects.

by

Numerical input. Numbers of features.

scale

A nominal scale in meters of the Image projection to work in. By default 1000.

Value

The function returns a sf object with column called "elevation" with standard deviation for each feature.

Note

The functions with prefix "ee_" is based on rgee package for interacting with Google Earth Engine (GEE). To run these functions or anything related to rgee/GEE, users must have:

  • Google account with Earth Engine activated

  • Python >= v3.5

  • EarthEngine Python API (Python package)

If the strict dependencies are not installed, rgee just will not work. It highly recommended seeing the installations and activation instructions in rgee documentation.

Author(s)

TainĂ¡ Rocha

See Also

rgee examples.

Examples

## Not run: 
# As this function is based on rgee package, the following commands must be executed:

# Create virtual environmental at local machine to install the necessary dependencies
rgee::ee_install()

# Initialize
rgee::ee_Initialize()

# Load ImageCollection of interest i.e, an environmental layer

nasadem<- rgee::ee$Image('NASA/NASADEM_HGT/001')$select('elevation')

# Hypothetical grid system
lat_lon_grid <- structure(list(ID = 758432:758443,
                              lat = c(-14.875, -14.875, -14.625, -14.625, -14.875, -14.875, -14.625, -14.625, -14.375, -14.375, -14.125, -14.125),
                              lon = c(-42.875, -42.625, -42.625, -42.875, -42.375, -42.125, -42.125, -42.375, -42.375, -42.125, -42.125, -42.375)),
                         class = "data.frame", row.names = c(NA, -12L))

grid_to_raster <- raster::rasterFromXYZ(lat_lon_grid [, c('lon', 'lat', 'ID')], crs = '+proj=longlat +datum=WGS84 +no_defs')

grid <- raster::rasterToPolygons(grid_to_raster, fun=NULL, na.rm=TRUE, dissolve=FALSE) |>
 sf::st_as_sf() |>
 rgee::sf_as_ee()

# Plot
rgee::Map$addLayer(grid)

# Compute standard deviation
std_dev <- GridDER::assess_env_uncertainty(x= nasadem, y= grid)

## End(Not run)


BiogeographyLab/gridder documentation built on April 21, 2024, 2:32 a.m.