# Why Animate¶

Here are some reasons you may want to use ahlive to animate your data to life!

Data can be mapped to color, and also time!

[1]:

import ahlive as ah
import xarray as xr

ds = xr.tutorial.open_dataset("air_temperature")
ds["month"] = ds["time"].dt.strftime("%m - %b")
ds = ds.groupby("month").mean()

ds_kcmi = ds["air"].sel(lon=-88.5 + 360, lat=40, method="nearest")
tmpf_inline = ds_kcmi * 1.8 - 459.67

ah.Dataset(
ds,
xs="lon",
ys="lat",
cs="air",
state_labels="month",
title="2013-2014 Monthly Averaged Temperatures",
projection="LambertConformal",
coastline=True,
revert="boomerang",
fps=10
).reference(
x0s=[-88.5] * 12,  # help wanted to simplify this method!
y0s=[40] * 12,
inline_labels=tmpf_inline
).config(**{
"ref_inline": dict(suffix="°F", color="black"),
"ref_plot": dict(color="black"),
"state": dict(color="black")
}).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: 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: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: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: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)

[1]: