get.ncdf: Load Subsets of NetCDF Files By Location, Run, Time

Description Usage Arguments Value Expected File Structure Warnings and Notes on File Structure

View source: R/get_ncdf.R

Description

get.ncdf loads the data stored in NetCDF files, as determined by the information in process.inputs.tmp, output from get.process.chunks. Data is loaded by region, latitude band, run, and time range, and is concatenated across files if necessary. Data is returned as a list by pixel, with every list member containing the lat and lon of the pixel, and the raw data ("Raw").

Usage

1
get.ncdf(defaults, process.inputs.tmp, year.range = numeric())

Arguments

defaults

the output from set.defaults. The defaults used are filevar and varnames to search for grid/run variablesin the files.

process.inputs.tmp

the output from get.process.chunks, giving the information needed to load a chunk of data from NetCDF file(s), including filename(s), locations within files, etc.

year.range

which year range should be output, in a vector c(year_i,year_f). If nothing set, the full possible year range of the file is loaded.

Value

A list; each element reperesenting a pixel, containing named subelements lat, lon, and the raw data Raw.

Expected File Structure

In general, most common forms of climate file structures are supported, especially the CMIP5 structure. Variables can either be on a lon x lat grid or stored by linear location. Files can either contain all runs of a model or can be saved by run. Files can either contain the whole timeframe of a model run or be split up in consecutive temporal chunks. Furthermore:

filename

the code searches for NetCDF files using the search string "[defaults$filevar]_day_.*nc" (by default; this can be changed by setting defaults$search.str). Make sure no other NetCDF files with that pattern are present in the search directory (by default defaults$mod.data.dir).

variable setup

Currently, the code expects the primary variable to have either a location dimension (giving the linear index of a location), or a lon x lat grid. These are all identified by name - the search terms used can be set in defaults$varnames - out-of-the-box, the package for example supports "lat", "latitude", "Latitude", and "latitude_1" as possible names for the "lat" dimension.

locations

The code expects there to be two location variables, lat and lon (CMIP5 syntax), giving the lat/lon location of every pixel in the file. The names of those variables can be any of the alternatives given by defaults$varnames.

multiple runs

If there are multiple runs in the file, there should be a run variable/dimension in the file giving the run id as an integer

Warnings and Notes on File Structure


ks905383/quantproj documentation built on Nov. 1, 2020, 9:12 p.m.