ursa (version 3.8.8)

session: Get and set sessional parameters for grid, CRS, external software for open PNG files.

Description

session_grid without arguments returns current grid properties. session_grid with arguments specifies grid, which is used by functions of this package, e.g., for plotting, for opened and created raster images during current session.

session_pngviwer is used to permit external software to open PNG files.

session_tempdir spefies directory for temporal files in some cases.

session_use_experimental_functions allows to use undocumented (experimental) functions.

Group of functions session_proj4, session_crs, session_cellsize, session_bbox extracts certain properties of sessional grid.

Usage

session_grid(obj)
session_proj4()
session_crs()
session_cellsize()
session_bbox()

session_pngviewer(allow = NA) session_tempdir(dst = character()) session_use_experimental_functions()

Arguments

obj

Either missing, or NULL, or file name, or object of class ursaRaster, or object of class ursaGrid.

allow

Logical. If TRUE then it is allowed to use external software for viewing PNG files. NA is interpreted as TRUE in the case of "Rscript" usage, and intepreted as FALSE in the case of interactive session or "R CMD BATCH" usage. Default is NA.

dst

Character. Directory name for temporal files. Empty character or non-character is interpreted as getwd() in the case of "Rscript" usage, and intepreted as tempdir() in the case of interactive session or "R CMD BATCH" usage. Default is character() (empty character).

Value

Object of class ursaGrid. It is a list. Default values are grid parameters of NSIDC polar stereo gridded data of Northern hemispere with nominal gridded resolution 25 km (http://nsidc.org/data/polar_stereo/ps_grids.html).

List of 9
 $ columns: int 304
 $ rows   : int 448
 $ resx   : num 25000
 $ resy   : num 25000
 $ minx   : num -3850000
 $ maxx   : num 3750000
 $ miny   : num -5350000
 $ maxy   : num 5850000
 $ proj4  : chr "+proj=stere +lat_0=90 +lat_ts=70.0 +lon_0=-45.0 +k=1
                 +x_0=0.0 +y_0=0.0 +a=6378273.000 +b=6356889.449 +units=m +no_defs"
 - attr(*, "class")= chr "ursaGrid"
NULL

session_proj4 and session_crs return item proj4.

session_cellsize returns squared root from multiplication of cell dimension: sqrt(resx*resy).

sessiong_pngviewer returns value of getOption("ursaAllowPngViewer").

sessiong_bbox returns named numeric of lenght 4: minimal x-coodrinate (xmin), minimal y-coordinate (ymin), maximal x-coordinate (xmax), maximal y-coordinate (ymax).

session_use_experimental_functions added some non-public functions to current namespaces and returns invisile list of function names.

Details

session_grid deals with option “ursaSessionGrid”: options(ursaSessionGrid=…) or getOption("ursaSessionGrid").

Usage session_grid() without arguments return value of “ursaSessionGrid” option via calling getOption("ursaSessionGrid"). If is.null(getOption("ursaSessionGrid")) then session_grid() returns default CRS.

Usage session_grid(NULL) resets “ursaSessionGrid” option via calling options(ursaSessionGrid=NULL).

The sequential calling

session_grid(NULL)
session_grid()

returns default CRS. For checking that the option has been resetted successfully, use getOption("ursaSessionGrid") after session_grid(NULL)

session_proj4 and session_crs are synonyms.

See Also

Class ursaGrid. Use regrid to partial grid changing.

Examples

Run this code
# NOT RUN {
session_grid(NULL)
getOption("ursaSessionGrid") ## NULL
(g1 <- session_grid()) ## default
g1$resx <- g1$resy <- 12500
g1$columns <- as.integer(with(g1,(maxx-minx)/resx))
g1$rows <- as.integer(with(g1,(maxy-miny)/resy))
session_grid(g1)
session_grid(NULL)
a <- ursa_new(value=3)
session_grid(a)

print(session_pngviewer())
# }

Run the code above in your browser using DataCamp Workspace