4. Domains and coordinate reference systems
earthkit-maps offers quick and convenient ways to define domains and coordinate reference systems (CRS) for your visualisations.
[9]:
import earthkit.data
import earthkit.maps
[2]:
chart = earthkit.maps.Chart(domain="Europe")
chart.coastlines()
chart.land()
chart.borders()
chart.gridlines()
chart.show()
[3]:
chart[0].ax.get_extent()
[3]:
(2502500.0, 7497500.0, 752500.0, 5497500.0)
[4]:
chart = earthkit.maps.Chart(domain=[-20, 40, 32, 75])
chart.coastlines()
chart.land()
chart.borders()
chart.gridlines()
chart.show()
[5]:
import cartopy.crs as ccrs
chart = earthkit.maps.Chart(domain=[-20, 40, 32, 75], crs=ccrs.PlateCarree())
chart.coastlines()
chart.land()
chart.borders()
chart.gridlines()
chart.show()
[6]:
chart = earthkit.maps.Chart(rows=2, columns=3)
DOMAINS = [
"France",
"Africa",
[30, 70, 0, 40],
"Central Europe",
"North Atlantic",
None,
]
for domain in DOMAINS:
chart.add_subplot(domain=domain)
chart.coastlines()
chart.land()
chart.borders()
chart.gridlines()
chart.subplot_titles("{domain}")
chart.show()
[13]:
earthkit.data.download_example_file("era5-2m-temperature-dec-1993.grib")
data = earthkit.data.from_source("file", "era5-2m-temperature-dec-1993.grib")
[16]:
chart = earthkit.maps.Chart(rows=2, columns=3)
CRS = [
ccrs.PlateCarree(),
ccrs.Robinson(),
ccrs.InterruptedGoodeHomolosine(),
ccrs.AlbersEqualArea(central_latitude=72, central_longitude=-43),
None,
ccrs.LambertAzimuthalEqualArea(),
]
for crs in CRS:
subplot = chart.add_subplot(domain="Greenland", crs=crs)
subplot.plot(data)
chart.coastlines()
chart.land()
chart.borders()
chart.gridlines()
chart.subplot_titles("{domain} ({crs})")
chart.show()