daily_clima: daily_clima

Description Usage Arguments Value Examples

View source: R/daily_clima.R

Description

This function generates daily climatological maps.

Usage

1
daily_clima(b, dates = NULL)

Arguments

b

RasterBrick/Stack containing the historical observations or a proxy (typically a reanalysis) that is used to derive the climatological information. This needs to contain daily layers for multiple years. names(b) should contain dates for comparison (e.g. X2017.01.01).

dates

Dates for which we need to calculate daily climatology. By default, this is a leap year.

Value

The function returns a RasterBrick (if dates contains one date) or a list of RasterBricks (if dates contains more than one date). Extent, resolution and land-sea mask match those of b. Values are the subset of b related to the given dates.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
  # Generate dummy RasterBrick
  set.seed(0)
  r <- raster(nrows = 2, ncols = 2,
              xmn = 0, xmx = 360, ymn = -90, ymx = 90, vals = 30)
  b <- raster::brick(lapply(1:(365 * 3),
       function(i) raster::setValues(r, runif(n = raster::ncell(r),
                                              min = 0, max = 100))))
  names(b) <- seq.Date(from = as.Date("1993-01-01"),
                       to = as.Date("1995-12-31"),
                       by = "day")
  daily_clima(b, as.Date("1996-01-01"))

## End(Not run)

caliver documentation built on Feb. 19, 2021, 5:07 p.m.