Skip to contents

Read and tidy your initial NetCDF by turning the absolute values into monthly-based anomalies, and by subsetting the time series and geogprahical area of your atmospheric variable.

Usage

read_nc(
  x,
  anomaly = F,
  time_subset = NULL,
  month_subset = NULL,
  crop_area = NULL,
  aggregate = NULL
)

Arguments

x

path to file or SpatRaster object.

anomaly

logical. If TRUE it convets into anomalies, based on their corresponding monthly means.

time_subset

character or Date. Default NULL. Provide a vector of dates to subset the original SpatRaster time series.

month_subset

integer. Default NULL. Provide a vector of integers to subset the original SpatRaster by months.

crop_area

integer. Default NULL. Provide a vector of coordinates (xmin,xmax,ymin,ymax) to crop the original SpatRaster domain.

aggregate

integer. Default NULL. Resampling to a coarser resolution. Useful to save memory when processing heavy time-consuming datasets.

Value

A SpatRaster object. It must be converted to daily if the input is hourly.

See also

read_nc

Examples

# Load data (mslp or precp_grid)
slp_file <- system.file("extdata", "mslp_ei.nc", package = "synoptReg")

# Reading data simply
slp <- read_nc(slp_file)

# Converting to monthly based anomalies and just for October, November and December
slp <- read_nc(slp_file, anomaly = TRUE, month_subset = 10:12)