Skip to content

CyrilJl/mapflow

Repository files navigation

mapflow logo

mapflow

PyPI version Conda version CI Documentation Status

mapflow transforms 3D xr.DataArray (time, y, x) into video files in one line of code.

Documentation

The full documentation is available at mapflow.readthedocs.io.

Installation

pip install mapflow

Or:

conda install -c conda-forge -y mapflow

Features

  • Automatic Coordinate Detection: Identifies x, y, and time coordinates in xarray DataArrays, with fallback options for manual input if needed.
  • CRS Handling: Detects the Coordinate Reference System (CRS) of the data or accepts user-defined CRS when unavailable.
  • Robust Colorbar: Generates a colorbar that handles outliers effectively while allowing customization.
  • Built-in World Borders: Includes default world border data but supports user-provided GeoSeries or GeoDataFrames.
  • Simplified Visualization: The plot_da function provides a one-line alternative to cartopy for quick plotting.

Animate

import xarray as xr
from mapflow import animate

ds = xr.tutorial.open_dataset("era5-2mt-2019-03-uk.grib")
animate(da=ds['t2m'].isel(time=slice(120)), path='animation.mp4', video_width=1280, pad_inches=0.2)
animation.mp4

Static plot

import xarray as xr
from mapflow import plot_da

ds = xr.tutorial.open_dataset("era5-2mt-2019-03-uk.grib")
plot_da(da=ds['t2m'].isel(time=0))

plot_da

About

xarray dataarrays to videos

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages