Extract Gridded Information for an ERA5Region
Let's say that we have data on a rectilinear lon-lat grid, as ERA5 data tends to have. How do we extract the data for the relevant region? How do we do this for regions that are non-rectilinear in shape? To solve these problems, we introduce the RegionGrid
type, which contains information that:
- allows for the extraction of data for a subregion from a parent, larger region
- is able to use a mask to extract data for a region's shape, if it is not rectilinear
GeoRegions.RegionGrid
— TypeRegionGrid
Abstract supertype for geographical regions, 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-rectlinear 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
ERA5Reanalysis.ERA5RegionGrid
— MethodERA5RegionGrid(
e5geo :: ERA5Region{ST,FT},
lon :: Vector{<:Real},
lat :: Vector{<:Real}
) -> GeoRegion.RegionGrid
Creates a RegionGrid containing information and mask information required to extract regional data for the ERA5Region from the raw data.
Arguments
e5geo
: A ERA5Region struct typelon
: A vector containing the longitude pointslat
: A vector containing the latitude points