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()
../_images/examples_04-domains-and-coordinate-reference-systems_3_0.png
[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()
../_images/examples_04-domains-and-coordinate-reference-systems_5_0.png
[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()
../_images/examples_04-domains-and-coordinate-reference-systems_6_0.png
[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()
../_images/examples_04-domains-and-coordinate-reference-systems_7_0.png
[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()
../_images/examples_04-domains-and-coordinate-reference-systems_9_0.png