Load Data From File Into Environment
This function receives a 'work piece', a named list which contains information on a data file to be loaded.
It can be run in 'explore' mode or in 'load' mode.
When running in 'explore' mode, the metadata of the file is read and the sizes of the dimensions in the file are returned in a named list:
'member': Number of members
'time': Number of lead-times
'lon': Longitudes in the file
'lat': Latitudes in the file
When running in 'load' mode it loads and performs any requested computations in additional parameters in the 'work piece', such as interpolating, slicing, ..., and finally stores it in a shared memory matrix pointed by the parameter 'out_pointer' in the 'work piece'.
.LoadDataFile(work_piece, explore_dims = FALSE, silent = FALSE)
work_piece |
Named list with information on the file to load or explore and additional parameters.
|
explore_dims |
Run in dimension explore mode (TRUE) or in load and calculation mode (FALSE). |
silent |
Parameter to allow (FALSE) or deactivate (TRUE) printing of explanatory messages. |
remapcells |
Width in number of cells of the surrounding area of the requested subset to be taken into account for the interpolation. See parameter |
When called in 'explore' mode, a named list is returned with:
dims
List with the found lengths for members, leadtimes and the latitudes and longitudes already trimmed and reordered if needed. The names are 'member', 'time', 'lon', 'lat'. If it is a file from a file-per-member dataset, the number of files that match the filename replacing the $MEMBER_NUMBER$ part by an asterisk is returned (which is the supposed number of members). There are known issues with this method of detection. See documentation on parameter 'nmember' and 'nmemberobs' in Load() function. When the specified file path is a URL, the returned number of members is NULL.
is_2d_var Boolean indicating whether the found variable is 2-dimensional (TRUE) or a global mean (FALSE).
grid Character string with the name of the grid of the file, following the cdo grid naming conventions.
var_long_name A character string with the variable long name. If not available, the short name is returned.
units A character string with the units of the variable.
When called in 'calculation' mode, the found file path or URL is returned if the file was found and NULL is returned otherwise.
History:
0.1 - 2015-01 (N. Manubens, nicolau.manubens at ic3.cat) - First version
## Not run: data <- s2dverification:::.LoadDataFile(list(dataset_type = 'exp', filename = system.file('sample_data/model/experiment/monthly_mean', 'tos_3hourly/tos_19901101.nc', package = 's2dverification'), namevar = 'tos', lon_limits = c(-12, 40), lat_limits = c(27, 48), is_file_per_member = TRUE, dimnames = list(lon = 'longitude', lat = 'latitude', member = 'ensemble')), explore_dims = TRUE, silent = FALSE) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.