Adding GeoRegions from Templates
So you have a list of areas that you want to define, but you don't want to enter them in one by one. What to do?### Setup
using GeoRegions
Template GeoRegion Files
Fear not! I have template files that one can use to define RectRegion
s and PolyRegion
s. Simply use the templateGeoRegion()
to copy the templates into a directory of your choice.
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)
templateGeoRegion("your-file-path-here")
GeoRegions.templateGeoRegions
— FunctiontemplateGeoRegions(; path::AbstractString, overwrite::Bool=false)
Copies the template files for defining GeoRegions in textfiles, that can then be added as a batch using addGeoRegions()
Keyword Arguments
path
: The folder to copy the files tooverwrite
: If template files exist in this folder, overwrite?
Reading in GeoRegions from a custom file
We can then read in GeoRegions from your custom file using the function addGeoRegions()
, which will then read all the GeoRegion information in the file and add it to the list of GeoRegions.
addGeoRegions("recttest.txt")
GeoRegion("TRP")
The Rectilinear Region TRP has the following properties:
Region ID (ID) : TRP
Parent ID (pID) : GLB
Name (name) : Tropical
Bounds (N,S,E,W) : [30.0, -30.0, 360.0, 0.0]
(is180,is360) : (false, true)
GeoRegions.addGeoRegions
— FunctionaddGeoRegions(fname::AbstractString)
Extracts information of the GeoRegion with the ID RegID
. If no GeoRegion with this ID exists, an error is thrown.
Arguments
fname
: name + path of the file containing GeoRegion information
Reset the list of GeoRegions
Should one wish to entirely reset the list of GeoRegions, one can call resetGeoRegions()
:
resetGeoRegions()
[ Info: 2024-01-12T00:14:04.593 - GeoRegions.jl - Resetting the custom lists of GeoRegions back to the default
┌ Warning: 2024-01-12T00:14:04.593 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/rectlist.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/rectlist.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
┌ Warning: 2024-01-12T00:14:04.593 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/polylist.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/polylist.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
And if one wishes to reset the predefined list of GeoRegions, we can do:
resetGeoRegions(allfiles=true)
[ Info: 2024-01-12T00:14:04.594 - GeoRegions.jl - Resetting both the master and custom lists of GeoRegions back to the default
┌ Warning: 2024-01-12T00:14:04.594 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/rectlist.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/rectlist.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
┌ Warning: 2024-01-12T00:14:04.594 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/polylist.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/polylist.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
┌ Warning: 2024-01-12T00:14:04.595 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/giorgi.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/giorgi.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
┌ Warning: 2024-01-12T00:14:04.595 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/srex.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/srex.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
┌ Warning: 2024-01-12T00:14:04.595 - GeoRegions.jl - Overwriting /home/runner/.julia/files/GeoRegions/ar6.txt with original file in /home/runner/work/GeoRegions.jl/GeoRegions.jl/src/georegions/../../extra/ar6.txt ...
└ @ GeoRegions ~/work/GeoRegions.jl/GeoRegions.jl/src/georegions/read.jl:417
GeoRegions.resetGeoRegions
— FunctionresetGeoRegions(; allfiles::Bool = false)
Reset all the files containing GeoRegion information back to the default.
Arguments
allfiles
: Iftrue
, reset the GeoRegions defined in Giorgi & Francisco [2000], AR6 Regions (Iturbide et al., 2020; ESSD) and Seneviratne et al. [2012] as well. Iffalse
, only reset the custom GeoRegions.
This page was generated using Literate.jl.