Skip to contents

Creates a SpatRaster (terra R-package) object from a variable from wrf file (or another compatible NetCDF)

Usage

wrf_rast(
  file = file.choose(),
  name = NA,
  map,
  level = 1,
  latlon = FALSE,
  method = "bilinear",
  as_polygons = FALSE,
  flip_h = FALSE,
  flip_v = FALSE,
  verbose = FALSE,
  ...
)

Arguments

file

wrf file

name

variable name

map

(optional) file with lat-lon variables and grid information

level

only for 4d data, default is 1 (surface)

latlon

logical (default is FALSE), set TRUE project the output to "+proj=longlat +datum=WGS84 +no_defs"

method

method passed to terra::projection, default is bilinear

as_polygons

logical, true to return a SpatVector instead of SpatRaster

flip_h

horizontal flip (by rows)

flip_v

vertical flip (by cols)

verbose

display additional information

...

extra arguments passed to ncdf4::ncvar_get

Examples

{

wrf <- paste(system.file("extdata", package = "eva3dm"),
                         "/wrfinput_d01", sep="")

r <- wrf_rast(file=wrf, name='XLAT')

plot_rast(r)
}