create_daylength_rst: Create day length rasters

View source: R/create-daylengths.R

create_daylength_rstR Documentation

Create day length rasters

Description

Generate a multi-layer SpatRaster of day lengths for a given template. The package geosphere is required to use this function.

Usage

create_daylength_rst(
  template,
  dates = terra::time(template),
  crs = "EPSG:4258",
  .quiet = FALSE
)

Arguments

template

(Multi-layer) SpatRaster that determines the spatial extent of the result.

dates

Dates that should be processed. If not specified, the dates of template are used through terra::time().

crs

Coordinate reference system with longitude/latitude metrics. It is used to project the raster coordinates to be able to retrieve the latitude.

.quiet

If TRUE, messages are suppressed.

Value

A multi-layer SpatRaster. Each layer represents one date.

See Also

create_daylength_df()

Examples



# calculate day length, use barrks_data()$tmin as template
dl <- create_daylength_rst(barrks_data()$tmin, .quiet = TRUE)

# plot day length on May 1st, 2015
terra::plot(dl[[terra::time(dl) == '2015-05-01']])



barrks documentation built on April 3, 2025, 9:47 p.m.