Learn R Programming

pbdDEMO (version 0.3-1)

ncvar: Read and Write Parallel NetCDF4 Files in GBD and ddmatrix Format

Description

These functions write and read NetCDF4 files in GBD and ddmatrix format.

Usage

demo.ncvar_put_dmat(nc, varid, vals, verbose = FALSE, comm = .pbd_env$SPMD.CT$comm)
demo.ncvar_put_gbd(nc, varid, vals, verbose = FALSE, comm = .pbd_env$SPMD.CT$comm, gbd.major = .pbd_env$gbd.major)
demo.ncvar_get_dmat(nc, varid, verbose = FALSE, signedbyte = TRUE, collapse_degen = TRUE, bldim = .pbd_env$bldim, ICTXT = .pbd_env$ictxt, comm = .pbd_env$SPMD.CT$comm)
demo.ncvar_get_gbd(nc, varid, verbose = FALSE, signedbyte = TRUE, collapse_degen = TRUE, comm = .pbd_env$SPMD.CT$comm, gbd.major = .pbd_env$gbd.major)

Arguments

nc
an object of class ncdf4 (as returned by either function nc_open_par or function nc_create_par), indicating what file to read from.
varid
See ncvar_get for details.
vals
See ncvar_put for details.
verbose
See ncvar_get for details.
comm
a communicator number.
gbd.major
a GBD major, either 1 for row-major or 2 for column-major.
signedbyte
See ncvar_get for details.
collapse_degen
See ncvar_get for details.
bldim
the blocking dimension for block-cyclically distributing the matrix across the process grid.
ICTXT
BLACS context number for return.

Value

demo.ncvar_get_dmat returns a ddmatrix, and demo.ncvar_get_gbd returns a GBD matrix in either row- or column major specified by gbd.major.

Details

demo.ncvar_get_* are similar to ncvar_get of pbdNCDF4, but focus on 2D arrays and return a ddmatrix or GBD matrix.

demo.ncvar_put_* are also similar to ncvar_put of pbdNCDF4, but only dump 2D arrays.

Examples

Run this code
## Not run: 
# ### Under command mode, run the demo with 4 processors by
# ### (Use Rscript.exe for windows system)
# mpiexec -np 4 Rscript -e "demo(nc4_serial,'pbdDEMO',ask=F,echo=F)"
# mpiexec -np 4 Rscript -e "demo(nc4_parallel,'pbdDEMO',ask=F,echo=F)"
# mpiexec -np 4 Rscript -e "demo(nc4_dmat,'pbdDEMO',ask=F,echo=F)"
# mpiexec -np 4 Rscript -e "demo(nc4_gbdc,'pbdDEMO',ask=F,echo=F)"
# ## End(Not run)

Run the code above in your browser using DataLab