Skip to content

Reading in Pre-existing ERA5Variable Information ​

In order to familiarize ourselves with using ERA5Variables, 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 Type
julia
SingleVariable(
    ID :: AbstractString,
    ST = String,
) -> evar :: SingleLevel

Retrieve the basic properties of the Single-Level variable defined by ID and put them in the evar SingleLevel type structure.

Arguments

  • ID : variable ID (in string format) used in the NetCDF file
source

Note

As of v0.3 and above, all Single-Level variables available in the CDS are available by default in ERA5Reanalysis.jl.

julia
julia> using ERA5Reanalysis

julia> SingleVariable("u100")
The Single-Level Variable "u100" has the following properties:
    Variable ID       (ID) : u100
    Long Name       (long) : 100m_u_component_of_wind
    Variable Name   (name) : 100 metre U wind component
    Variable Units (units) : m s**-1
    Is Analysis (analysis) : true
    Is Forecast (forecast) : true
    Invariant? (invariant) : false
    NetCDF ID       (ncID) : u100
    MARS ID         (mars) : 228246
    DRKZ ID         (dkrz) : 502

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 Type
julia
PressureVariable(
    ID :: AbstractString,
    ST = String;
    hPa   :: Int = 0
    throw :: Bool = true
) -> evar :: SingleLevel

Retrieve the basic properties of the Pressure-Level variable defined by ID at pressure-height indicated by hPa and put them in the evar SingleLevel type structure.

Arguments

  • ID : variable ID (in string format) used in the NetCDF file

Keyword Arguments

  • hPa : Integer specifying pressure-level height in hPa

  • throw : if hPa level does not exist and throw is true, throw error, otherwise find nearest pressure level

source
julia
julia> using ERA5Reanalysis

julia> PressureVariable("cc",hPa=1000)
The Pressure-Level Variable "cc" has the following properties:
    Variable ID       (ID) : cc
    Long Name       (long) : fraction_of_cloud_cover
    Variable Name   (name) : Cloud Cover Fraction (1000 hPa)
    Variable Units (units) : %
    Pressure Level   (hPa) : 1000
    Is Analysis (analysis) : true
    Is Forecast (forecast) : true
    Invariant? (invariant) : false
    NetCDF ID       (ncID) : cc
    MARS ID         (mars) : 248
    DRKZ ID         (dkrz) : 248

julia> PressureVariable("cc",hPa=890)
ERROR: 2026-02-08T04:03:00.536 - 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)
┌ Warning: 2026-02-08T04:03:00.572 - ERA5Reanalysis.jl - Pressure level specified in "hPa" argument does not exist, snapping to nearest pressure level
â”” @ ERA5Reanalysis ~/work/ERA5Reanalysis.jl/ERA5Reanalysis.jl/src/variable/pressure.jl:242
The Pressure-Level Variable "cc" has the following properties:
    Variable ID       (ID) : cc
    Long Name       (long) : fraction_of_cloud_cover
    Variable Name   (name) : Cloud Cover Fraction (900 hPa)
    Variable Units (units) : %
    Pressure Level   (hPa) : 900
    Is Analysis (analysis) : true
    Is Forecast (forecast) : true
    Invariant? (invariant) : false
    NetCDF ID       (ncID) : cc
    MARS ID         (mars) : 248
    DRKZ ID         (dkrz) : 248

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 Method
julia
era5Pressures() -> 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
source
julia
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.

Note

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).

Missing docstring.

Missing docstring for isSingle. Check Documenter's build log for details.

Missing docstring.

Missing docstring for isPressure. Check Documenter's build log for details.

julia
julia> using ERA5Reanalysis

julia> isSingle("tcwv")
ERROR: UndefVarError: `isSingle` not defined in `Main`
Suggestion: check for spelling errors or missing imports.