Varunayan = Varun + ayan. In Vedic mythology, Varun is the god of the sky, order, truth and water. In Sanskrit, ayan means path.
The varunayan package downloads climate variables for any region of the globe from ERA5. ERA5 is a reanalysis. It combines models and historical observations to estimate many atmospheric, land and ocean variables from 1940 to the present. The package gets the data from the Copernicus Climate Data Store (CDS).
library(varunayan)
#> Registered S3 method overwritten by 'stars':
#> method from
#> st_interpolate_aw.stars sfTo get ERA5 data, you must have a CDS API key. Save the key one time only.
The three download functions share these arguments.
| Argument | Meaning |
|---|---|
request_id |
Name of the request. Use a unique name for each request. |
variables |
ERA5 variable names, for example "2m_temperature". |
start_date, end_date |
Dates as "YYYY-MM-DD". |
frequency |
"hourly" (default), "daily",
"weekly", "monthly" or
"yearly". |
resolution |
Grid size in degrees (default 0.25). |
dataset_type, pressure_levels |
Use "pressure" and a vector such as "850"
for pressure-level data. |
era5ify_bbox() gets the grid cells inside a box. Here we
get daily temperature and precipitation for five days around Delhi.
The output is in long format: one row for each time, grid cell and
variable. The variable column holds the ERA5 short name
(t2m is 2 m temperature, tp is total
precipitation). Temperatures are in °C. Precipitation is in mm and is
the total for each day.
era5ify_geojson() takes a path or URL of a GeoJSON file.
Here we use the LGD
state boundaries of India. With level = "feature", the
output has one row for each state, with the mean of the grid cells
inside it. The default level = "union" keeps each grid
cell.
era5ify_point() keeps the grid cell nearest to a
latitude and longitude. Here we get the daily temperature and
precipitation in Mumbai in the first week of August 2024, during the
monsoon.
ERA5 also gives the atmosphere at 37 pressure levels, from 1000 hPa
(near the surface) to 1 hPa. A lower pressure is a higher altitude: 850
hPa is approximately 1.5 km and 200 hPa is approximately 12 km. Set
dataset_type = "pressure" and give the levels in
pressure_levels. The output has a
pressure_level column (hPa).
Here we get the daily temperature at six levels over Delhi for three
days. spatial_mean() with
by = "pressure_level" gives the mean temperature at each
level. The temperature decreases as the altitude increases.
profile <- era5ify_bbox(
request_id = "quickstart_pressure",
variables = "temperature",
start_date = "2024-01-01",
end_date = "2024-01-03",
north = 29, south = 28, east = 78, west = 76.5,
dataset_type = "pressure",
pressure_levels = c("1000", "850", "700", "500", "300", "200"),
frequency = "daily"
)
head(profile)ERA5 has hundreds of variables. search_variable() finds
the variables that match a word, in the single-level and pressure-level
datasets.
search_variable("temperature", dataset_type = "all")
#> variable_name description units dataset_type
#> 1 2m_dewpoint_temperature 2 metre dewpoint temperature K single
#> 2 2m_temperature 2 metre temperature K single
#> 3 skin_temperature Skin temperature K single
#> 4 soil_temperature_level_1 Soil temperature level 1 K single
#> 5 soil_temperature_level_2 Soil temperature level 2 K single
#> 6 soil_temperature_level_3 Soil temperature level 3 K single
#> 7 soil_temperature_level_4 Soil temperature level 4 K single
#> 8 temperature Temperature K pressure
#> category
#> 1 temperature_and_pressure
#> 2 temperature_and_pressure
#> 3 temperature_and_pressure
#> 4 soil_variables
#> 5 soil_variables
#> 6 soil_variables
#> 7 soil_variables
#> 8 atmospheric_variablesdescribe_variables() gives a description and the unit of
each variable.
describe_variables(
c("2m_temperature", "total_precipitation", "surface_pressure"),
dataset_type = "single"
)
#> variable_name description units dataset_type
#> 1 2m_temperature 2 metre temperature K single
#> 2 total_precipitation Total precipitation m single
#> 3 surface_pressure Surface pressure Pa single
#> category
#> 1 temperature_and_pressure
#> 2 precipitation_variables
#> 3 temperature_and_pressureThe India Meteorological Department (IMD) gives gridded rainfall and temperature for India. You do not need credentials for IMD data.