Site icon R-bloggers

Birth date temperature

[This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Valley of the roses – CC-BY-NC-ND by Riccardo Maria Mantero

Day 6 of 30DayMapChallenge: « Raster » (previously).

What was the temperature at your birth place when you were born?

Copernicus provides many climate datasets. We can use ERA5 post-processed daily statistics on single levels from 1940 to present to display the weather on your birth date.

Some packages help to download and manipulate ERA5 data ({KrigR}, {Ag5Tools}, {ecmwfr}, or directly by the CDS API,…) but for this one shot, we’ll do a manual download from the web interface.

You need to create a (free) account first.

Then we can chose the product:

< section id="data" class="level1">

Data

library(terra)

temperature <- rast("65361bd1333e205e6e593c9179183e4a.nc") |> 
  rotate()

temperature <- temperature - 273.15
crs(temperature) <- "+proj=longlat"
temperature <- project(temperature, "+proj=eqearth")
< section id="map" class="level1">

Map

plot(temperature,
     main = "Mean temperature on 1970-01-01",
     axes = FALSE,
     col = map.pal("magma"))
Figure 1: Mean temperature at 2 m on 1970-01-01 from ERA5
< !-- -->
To leave a comment for the author, please follow the link and comment on their blog: r.iresmi.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Exit mobile version