cdtDataset_readData_multiDim: Create CDT dataset format.

View source: R/cdtCreateDataset_NCmultiDim.R

cdtDataset_readData_multiDimR Documentation

Create CDT dataset format.

Description

Create CDT dataset from a multidimensional netCDF data.

Usage

cdtDataset_readData_multiDim(
  cdtdata_info,
  netcdf_data,
  ncvar_info,
  extra_ncdim = NULL,
  conversion_fun = NULL,
  bbox = NULL,
  chunk = list(size = 100, fac = 5)
)

Arguments

cdtdata_info

named list, providing the information about the CDT dataset.

  • dir: character, full path to the directory to save the created CDT dataset.

  • name: character, name of the dataset to use.

netcdf_data

named list, providing the input netCDF data to be converted to a CDT dataset format.

  • timestep: character, the time step of the netCDF data.

  • dir: character, full path to the directory containing the netCDF files.

  • format: character, format of the netCDF file names. Example: 'precip_%S.nc'

ncvar_info

named list, providing the name of the variable and longitude, latitude, time of the netCDF data.

  • varid: character, the name of the variable to be converted.

  • lon_dim: character, the name of the longitude dimension.

  • lat_dim: character, the name of the latitude dimension.

  • time_dim: character, the name of the time dimension.

extra_ncdim

named list, providing the values of the dimensions other than the longitude, latitude and time to be extracted if the netCDF data contains more than 3 dimensions. For example, if the data has a pressure level (dimension name level) and from ensemble data (dimension name member), to extract the data at 1000 hPa and for member 5: extra_ncdim = list(level = 1000, member = 5). Default NULL, the data does not have extra dimension.

conversion_fun

a function to transform the data or to convert the units.

bbox

named list, providing the region to be extracted in the form list(minlon, maxlon, minlat, maxlat). Example: bbox = list(minlon = 33, maxlon = 48, minlat = 3, maxlat = 15) Default NULL.

chunk

named list containing the size of the chunk size and the number of chunk to be used for each computation fac.

Value

A directory named after the element name of cdtdata_info, containing the CDT dataset.

Examples


## Not run: 

cdtdata_info <- list(dir = "~/CDTDATASET/MERRA2", name = "PRECIP")
netcdf_data <- list(timestep = 'daily', dir = "~/DATA/MERRA2/daily_precip", format = 'merra-2_precip_%S.nc')
ncvar_info <- list(varid = 'precip', lon_dim = 'lon', lat_dim = 'lat', time_dim = 'time')
convert_units <- function(x){
   # kg m-2 s-1 to mm day-1
   x * 86400
}

CDT::cdtDataset_readData_multiDim(cdtdata_info, netcdf_data, ncvar_info, conversion_fun = convert_units)


## End(Not run)


rijaf-iri/CDT documentation built on July 3, 2024, 2:54 a.m.