What is a RegionGrid?
But how do we go from defining a GeoRegion, to extracting data for that GeoRegion? The answer is with the information in the RegionGrid
types, which maps gridded lon-lat data to a given GeoRegion as follows:
- Mapping gridded lon-lat data to a
RectRegion
gives aRectGrid
structure - Mapping gridded lon-lat data to a
PolyRegion
gives aPolyGrid
structure - Mapping non-rectilinear gridded lon-lat data to a
RegionMask
gives aRegionMask
structure
However, the basic uses of RectGrid
and PolyGrid
are the same, and as such their differences are largely transparent to the user, except for one field found in PolyGrid
, the mask
, which will be elaborated upon later.
GeoRegions.RegionGrid
— TypeRegionGrid
Abstract supertype for geographical region gridded information, with the following subtypes:
RectGrid{FT<:Real} <: RegionGrid
PolyGrid{FT<:Real} <: RegionGrid
RegionMask{FT<:Real} <: RegionGrid
Both RectGrid
and PolyGrid
types contain the following fields:
grid
- A vector ofInt
s defining the gridpoint indices of the [N,S,E,W] points respectivelylon
- A vector ofFloat
s defining the latitude vector describing the regionlat
- A vector ofFloat
s defining the latitude vector describing the regionilon
- A vector ofInt
s defining indices of the parent longitude vector describing the regionilat
- A vector ofInt
s defining indices of the parent latitude vector describing the region
A PolyGrid
type will also contain the following field:
mask
- An array of 0s and 1s defining a non-rectilinear shape within a rectilinear grid where data is valid (only available in PolyGrid types)
A RegionMask
type will contain the following fields:
lon
- An array of longitude pointslat
- An array of latitude pointsmask
- An array of NaNs and 1s defining the region within the original field in which data points are valid
So basically a RegionGrid
contains information on the indices of the gridded data that are part of the GeoRegion
, thus helping us extract the relevant data for a given GeoRegion
.