Geographic mask from longitude and latitute

Share:

Description

geogMask is a helper function that preprocess input for the HiClimR via geogMask parameter.

Usage

1
2
geogMask(continent=NULL, region=NULL, country=NULL, lon=NULL, lat=NULL,
  InDispute=TRUE, verbose = TRUE, plot=FALSE, colPalette=NULL, pch = 15, cex = 1)

Arguments

continent

NULL or a string (or array of strings) to specify continent name(s): only one of continent, region, or country should be speciefied. Valid list of continent names can be obtained by running geogMask().

region

NULL or a string (or array of strings) to specify region name(s): only one of continent, region, or country should be speciefied. Valid list of region names can be obtained by running geogMask().

country

NULL or a string (or array of strings) to specify country ISO3 character code(s): only one of continent, region, or country should be speciefied. Valid list of country ISO3 character code(s) can be obtained by running geogMask().

lon

a vector of longitudes with length N. Longitudes takes values from -180 to 180 (not 0 to 360). For gridded data, the length may have the value (n) provided that n * m = N where n = length(unique(lon)) and m = length(unique(lat)).

lat

a vector of latitudes with length N or m. See lon.

InDispute

a logical: should the areas in dispute be considered for geographic masking by country? If InDispute = TRUE (the default), areas in dispute will be considered as a part of the country.

verbose

logical to print processing information if verbose = TRUE.

plot

logical to call the plotting method if plot = TRUE.

colPalette

a color palette or a list of colors such as that generated by rainbow, heat.colors, topo.colors, terrain.colors or similar functions.

pch

Either an integer specifying a symbol or a single character to be used as the default in plotting points. See points for possible values.

cex

A numerical value giving the amount by which plotting symbols should be magnified relative to the default = 1.

Details

In some applications, a user may want to focus on an area that is a mask-defined subset of the full dataset. For instance, the NASA Tropical Rainfall Measuring Mission (TRMM) data covers ocean and land, while a researcher might be interested in the precipitation variability only over land, a country, or a list of countries (e.g., Nile Basin countries). This masking capability is supported by the geogMask helper function. It requires the longitute (lon) and latitude (lat) vectors together with a string (or array of strings) to specify continent name(s), region name(s), or country ISO3 character code(s) via either continent, region, or country parameters. Valid values for them can be obtained by running geogMask(). World mask data is based on the HIU Large Scale International Boundaries (LSIB) data (http://hiu.state.gov/data/data.aspx).

Value

A vector of indices for the spatial elements to be masked, as required by HiClimR.

Author(s)

Hamada Badr <badr@jhu.edu>, Ben Zaitchik <zaitchik@jhu.edu>, and Amin Dezfuli <dez@jhu.edu>.

References

Hamada S. Badr, Zaitchik, B. F. and Dezfuli, A. K. (2015): A Tool for Hierarchical Climate Regionalization, Earth Science Informatics, 1-10, http://dx.doi.org/10.1007/s12145-015-0221-7.

Hamada S. Badr, Zaitchik, B. F. and Dezfuli, A. K. (2014): Hierarchical Climate Regionalization, CRAN, http://cran.r-project.org/package=HiClimR.

See Also

HiClimR, validClimR, geogMask, coarseR, fastCor, grid2D, and minSigCor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
require(HiClimR)

## Load test case data
x <- TestCase$x

## Generate longitude and latitude mesh vectors
xGrid <- grid2D(lon = unique(TestCase$lon), lat = unique(TestCase$lat))
lon <- c(xGrid$lon)
lat <- c(xGrid$lat)

## Check the valid options for geographic masking
geogMask()

## geographic mask for Africa
gMask <- geogMask(continent = "Africa", lon = lon, lat = lat, plot = TRUE)