Mapping#
Map data onto a geographic map!
geographic keywords#
For geographic annotations, there are these keywords:
ahlive keyword |
type |
scope |
description |
---|---|---|---|
|
|
subplot |
the data’s projection coordinate reference system (crs) |
|
|
subplot |
the desired output crs |
|
|
subplot |
the desired longitude in degrees to center on |
|
|
subplot |
whether to show country borders |
|
|
subplot |
whether to show coastlines |
|
|
subplot |
whether to show tiles |
|
|
subplot |
zoom level of tiles |
|
|
subplot |
whether to show land |
|
|
subplot |
whether to show ocean |
|
|
subplot |
whether to show lakes |
|
|
subplot |
whether to show rivers |
|
|
subplot |
whether to show US states’ borders |
|
|
subplot |
whether to set to global extents |
reference crs#
To utilize any geographic annotations, pass crs
OR projection
as an instantiated cartopy.crs
object the class name.
crs
specifies the data’s coordinate reference system; it’s often set to ccrs.PlateCarree()
, or conveniently 'platecarree'
, if the data is in degrees.
[1]:
import xarray as xr
import ahlive as ah
ds = xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 3))
ah_ds = ah.Dataset(ds, 'lon', 'lat', 'air', crs='platecarree')
ah_ds.render()
[1]:
projection crs#
projection
on the other hand specifies the desired output crs. If crs
is not specified, but projection
is set, crs
defaults to ccrs.PlateCarree()
.
[2]:
import xarray as xr
import ahlive as ah
ds = xr.tutorial.open_dataset('air_temperature').isel(time=slice(0, 3))
ah_ds = ah.Dataset(ds, 'lon', 'lat', 'air', projection='lambertconformal')
ah_ds.render()
[2]: