Creating GeoRegions
In this section, we go through the basic steps of creating a GeoRegion, and removing it once defined so it can be redefined.
Defining a new GeoRegion
We use the functions RectRegion
and PolyRegion
to define rectilinear and polygonal regions respectively. For example, we construct the sample RectRegion
TRC
Defining PolyRegions
When defining PolyRegion
s, the first and last set of (lon,lat) coordinates must be the same (i.e. a closed polygon must be defined)
The GeoRegions will be automatically added to the following files in joinpath(DEPOT_PATH[1],"files","GeoRegions")
:
RectRegions will be added to
rectlist.txt
PolyRegions will be added to
polylist.txt
If the GeoRegion ID TRC
already exists, however, this will throw an error
RectRegion(
RegID :: AbstractString,
ParID :: AbstractString,
name :: AbstractString,
bound :: Vector{<:Real};
savegeo :: Bool = true,
verbose :: Bool = true,
ST = String,
FT = Float64
) -> RectRegion{ST,FT}
Creates a rectilinear GeoRegion RegID
.
Arguments
RegID
: The keyword ID that will be used to identify the GeoRegion. If the ID is already in use, then an error will be thrown.ParID
: The ID of the parent GeoRegion where information can be extracted fromname
: A name for the GeoRegion (meta information, can be used in Logging)bound
: The [N,S,E,W] coordinates defining the region
Keyword Arguments
savegeo
: Save the GeoRegion into the master list? Default istrue
verbose
: Verbose logging for ease of monitoring? Default istrue
PolyRegion(
RegID :: AbstractString,
ParID :: AbstractString,
name :: AbstractString,
lonpt :: Vector{<:Real},
latpt :: Vector{<:Real};
savegeo :: Bool = true,
verbose :: Bool = true,
ST = String,
FT = Float64
) -> PolyRegion{ST,FT}
Creates a rectilinear GeoRegion RegID
.
Arguments
RegID
: The keyword ID that will be used to identify the GeoRegion. If the ID is already in use, then an error will be thrown.ParID
: The ID of the parent GeoRegion where information can be extracted fromname
: A name for the GeoRegion (meta information, can be used in Logging)lonpt
: A vector containing the longitude pointslatpt
: A vector containing the latitude points
Keyword Arguments
savegeo
: Save the GeoRegion into the master list? Default istrue
verbose
: Verbose logging for ease of monitoring? Default istrue
Start and End Points
The 1st and last elements of lonpt
and latpt
must be equal.
Is it already a GeoRegion?
Sometimes we would like to independently check if an ID
has already been used. We can use the function isGeoRegion()
to perform this checkIf the GeoRegion ID
TRC` already exists, however, this will throw an error
isGeoRegion(
RegID :: AbstractString;
throw :: Bool = true
) -> tf :: Bool
Extracts information of the GeoRegion with the ID RegID
. If no GeoRegion with this ID exists, an error is thrown.
Arguments
RegID
: The keyword ID that will be used to identify the GeoRegion. If the ID is not valid (i.e. not being used), then an error will be thrown.throw
: Iftrue
, then throws an error ifRegID
is not a validGeoRegion
identifier instead of returning the Booleantf
Returns
tf
: True / False
Removing an existing GeoRegion
To remove an existing GeoRegion, we can use the function removeGeoRegion
Global GeoRegion
The Global GeoRegion GLB
is considered to be an integral part of the GeoRegions.jl package and therefore it cannot be removed.
removeGeoRegion(RegID::AbstractString)
Creates the GeoRegion associated with the ID RegID
.
Arguments
RegID
: The keyword ID that will be used to identify the GeoRegion. If the ID is not valid (i.e. not being used), then an error will be thrown.
Reset the list of GeoRegions
Should one wish to entirely reset the list of GeoRegions, one can call resetGeoRegions()
. See Custom GeoRegions for more details.