Reading in Pre-existing ERA5Variable
Information
In order to familiarize ourselves with using ERA5Variable
s, we load some of the pre-existing variables that are prepackaged with ERA5Reanalysis.jl.
Loading Single-Level Variable Information
The easiest example is to load a single-level variable using the SingleVariable()
function, for example the u-component of wind 100m above the surface:
ERA5Reanalysis.SingleVariable
— TypeSingleVariable(
varID :: AbstractString,
ST = String,
) -> evar :: SingleLevel
Retrieve the basic properties of the Single-Level variable defined by varID
and put them in the evar
SingleLevel type structure.
Arguments
varID
: variable ID (in string format) used in the NetCDF file
julia> using ERA5Reanalysis
julia> SingleVariable("u100")
The Single-Level Variable "u100" has the following properties: Variable ID (varID) : u100 Long Name (lname) : 100m_u_component_of_wind Variable Name (vname) : Zonal Wind at 100m Height Variable Units (units) : m s**-1
Loading Pressure-Level Variable Information
Loading pressure-level variables using the PressureVariable()
function is similar overall. However, an additional argument hPa
is needed to specify the pressure-levels in question. By default hPa = 0
refers to all available pressure-levels. However, if the input for hPa
is not a valid ERA5 pressure-level in CDS, then throw
determines if an error is thrown, or if the nearest pressure level will be used instead.
ERA5Reanalysis.PressureVariable
— TypePressureVariable(
varID :: AbstractString,
ST = String;
hPa :: Int = 0
throw :: Bool = true
) -> evar :: SingleLevel
Retrieve the basic properties of the Pressure-Level variable defined by varID
at pressure-height indicated by hPa
and put them in the evar
SingleLevel type structure.
Arguments
varID
: variable ID (in string format) used in the NetCDF file
Keyword Arguments
hPa
: Integer specifying pressure-level height in hPathrow
: ifhPa
level does not exist andthrow
is true, throw error, otherwise find nearest pressure level
julia> using ERA5Reanalysis
julia> PressureVariable("cc",hPa=1000)
The Pressure-Level Variable "cc" has the following properties: Variable ID (varID) : cc Long Name (lname) : fraction_of_cloud_cover Variable Name (vname) : Cloud Cover Fraction (1000 hPa) Variable Units (units) : % Pressure Level (hPa) : 1000
julia> PressureVariable("cc",hPa=890)
ERROR: 2023-04-03T03:55:13.028 - ERA5Reanalysis.jl - Pressure level specified in "hPa" argument is invalid, please check and see if you requested correctly
julia> PressureVariable("cc",hPa=890,throw=false)
The Pressure-Level Variable "cc" has the following properties: Variable ID (varID) : cc Long Name (lname) : fraction_of_cloud_cover Variable Name (vname) : Cloud Cover Fraction (900 hPa) Variable Units (units) : % Pressure Level (hPa) : 900
Valid ERA5 Pressure-Levels in CDS
A list of valid ERA5 pressure-levels available directly from CDS can be retrieved using the function era5Pressures
ERA5Reanalysis.era5Pressures
— Methodera5Pressures() -> parray :: Vector{Int}
Returns the a vector containing the 37 pressure levels available in ERA5 in hPa units.
Returns
parray
: vector containing list of pressures in Int format and hPa units
julia> using ERA5Reanalysis
julia> era5Pressures()
37-element Vector{Int64}: 1 2 3 5 7 10 20 30 50 70 ⋮ 800 825 850 875 900 925 950 975 1000
Does the ERA5Variable
exist?
If we want to check if the ERA5Variable
exists, we use either the isSingle()
or isPressure
functions.
There is no generic isERA5Variable
function, because some pressure-level variables and single-level variables on the CDS have the same identifier (e.g. Total Cloud Cover, and Cloud Cover Fraction, both of which use the identifer cc
).
ERA5Reanalysis.isSingle
— FunctionisSingle(
varID :: AbstractString;
throw :: Bool = true,
dolog :: Bool = false
) -> tf :: Bool
Extracts information of the Single-Level Variable with the ID varID
. If no Single-Level Variable with this ID exists, an error is thrown.
Arguments
RegID
: The keyword ID that will be used to identify the Single-Level Variable. 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 valid Single-Level Variable identifier instead of returning the Booleantf
dolog
: Iftrue
, then return logging to screen along with results
Returns
tf
: True / False
ERA5Reanalysis.isPressure
— FunctionisPressure(
varID :: AbstractString;
throw :: Bool = true,
dolog :: Bool = false
) -> tf :: Bool
Extracts information of the Pressure-Level Variable with the ID varID
. If no Pressure-Level Variable with this ID exists, an error is thrown.
Arguments
RegID
: The keyword ID that will be used to identify the Pressure-Level Variable. 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 valid Pressure-Level Variable identifier instead of returning the Booleantf
dolog
: Iftrue
, then return logging to screen along with results
Returns
tf
: True / False
julia> using ERA5Reanalysis
julia> isSingle("tcwv")
true