make_DEM: Get and aggregate a digital elevation model for use in...

View source: R/make_dem.R

make_DEMR Documentation

Get and aggregate a digital elevation model for use in interpolating GSOD data

Description

Fetches a digital elevation model DEM from 'WorldClim' data, crops and aggregates to a larger spatial resolution and crops at -60/60 degrees latitude for use with other weather data that provide rainfall, e.g. NASA POWER at 0.5 arc degrees or TRMM at 0.25 arc degrees. Mainly for use in crop modelling exercises.

Usage

make_DEM(resolution = NULL, dsn = NULL)

Arguments

resolution

Resolution to aggregate the digital elevation model to in arc-degrees, e.g. 1 = 1 arc degree, 0.5 = one half arc degree, 0.25 = one quarter arc degree. Valid options are 1, 0.5 and 0.25. Defaults to 0.5, the same as NASA POWER.

dsn

Optional. Directory where resulting DEM file is to be saved. If unspecified a spatial object is returned in the R session. If a DEM exists, it will be overwritten with the new one of the same resolution. If a new resolution is specified, a new file will be created.

Value

A terra::SpatRaster() object of a digital elevation model cropped to -60/60 degrees latitude and aggregated by the requested factor and optionally a data file written to local disk as a GeoTIFF object.

Author(s)

Adam H. Sparks, adamhsparks@gmail.com

Examples



# Get DEM and aggregate to 0.5 arc degree, saving it to a local "~/Data/DEM"
# directory.

DEM <- make_DEM(dsn = "~/Data/DEM")


adamhsparks/GRID documentation built on Jan. 27, 2023, 5:48 a.m.