Mapping¶

Map data onto a geographic map!

geographic keywords¶

For geographic annotations, there are these keywords:

ahlive keyword

type

scope

description

crs

str

subplot

the data’s projection coordinate reference system (crs)

projection

str

subplot

the desired output crs

central_lon

float

subplot

the desired longitude in degrees to center on

borders

bool

subplot

whether to show country borders

coastline

bool

subplot

whether to show coastlines

tiles

bool

subplot

whether to show tiles

zoom

int

subplot

zoom level of tiles

land

bool

subplot

whether to show land

ocean

bool

subplot

whether to show ocean

lakes

bool

subplot

whether to show lakes

rivers

bool

subplot

whether to show rivers

states

bool

subplot

whether to show US states’ borders

worldwide

bool

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()

/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:825: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(multi_line_string) > 1:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:877: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
for line in multi_line_string:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:944: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(p_mline) > 0:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:825: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(multi_line_string) > 1:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:877: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
for line in multi_line_string:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:944: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(p_mline) > 0:

[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()

/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:825: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(multi_line_string) > 1:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:836: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
line_strings = list(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:836: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
line_strings = list(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:877: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
for line in multi_line_string:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:944: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(p_mline) > 0:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:982: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
line_strings.extend(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:982: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
line_strings.extend(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:825: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(multi_line_string) > 1:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:836: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
line_strings = list(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:836: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
line_strings = list(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:877: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
for line in multi_line_string:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:944: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
if len(p_mline) > 0:
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:982: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the geoms property to access the constituent parts of a multi-part geometry.
line_strings.extend(multi_line_string)
/home/docs/checkouts/readthedocs.org/user_builds/ahlive/conda/main/lib/python3.9/site-packages/cartopy/crs.py:982: ShapelyDeprecationWarning: __len__ for multi-part geometries is deprecated and will be removed in Shapely 2.0. Check the length of the geoms property instead to get the  number of parts of a multi-part geometry.
line_strings.extend(multi_line_string)

[2]: