
Snow normals from cd's ERA5-Land annual snow layers
Source:R/wet_snow_normals.R
wet_snow_normals.RdReads cd's annual snow layers (one band per year, ERA5-Land at 0.1 degree,
built by cd from the Earth Data Hub hourly store), takes the per-cell mean
over years, and resamples it bilinearly onto grid. The mean is
cd::cd_baseline()'s definition (the mean of the year values, NA
removed), taken per cell instead of over an area. Every year in years must
be a band of the file read.
Arguments
- grid
Target grid: a
SpatRasteror a path to one, in EPSG:4326.- vars
cd variable names, each with an
"annual"row incatalog.- years
Years to average.
- dir
Cache directory.
- catalog
A
data.framewith columnsvariable,periodandhref, as fromcd::cd_catalog();NULLreads cd's default catalog. A remotehrefis read throughcd::cd_cache_fetch().- cap
Named numeric: an upper limit for the per-cell mean of each named variable, applied before resampling. Variables not named are not capped.
- overwrite
Logical. Rebuild the resampled grid even when cached.
Value
Path to a GeoTIFF with one layer per variable, named as in vars.
The cache key is the grid, vars, years, cap, the method version and
the values of the bands read (not their files, which cd rebuilds with a
new run time whenever it appends a year).
Details
The defaults are the two predictors the monthly shares were scored with
(#16): snowmelt_doy_50, the calendar day of the year by which half the
year's snowmelt has happened, and swe_max, the year's peak snow water
equivalent (mm).
ERA5-Land has no cell over the sea, so cells of grid whose own ERA5-Land
cell is empty come out NA (GDAL's bilinear reweights around missing
neighbours); they are left for the caller to fill.
ERA5-Land's glacier points carry perennial snow: over 1981-2010, 513 BC
land cells have a mean swe_max of 5,000 to 10,000 mm, against a seasonal
maximum of about 3,000 mm elsewhere. cap limits each cell's mean before
resampling, so a glacier cell still reads as deep snow without dominating
an upstream mean (decided for #16 before any score was seen).