Skip to main content

xarray extension that supports multiple geometry conventions

Project description

emsarray

Binder Documentation Status Conda Version

The emsarray package provides a common interface for working with the many model geometry conventions used at CSIRO. It enhances xarray Datasets and provides a set of common operations for manipulating datasets.

To use, open the dataset using the emsarray.open_dataset() function and use the dataset.ems attribute:

import emsarray
from shapely.geometry import Point

dataset = emsarray.tutorial.open_dataset('gbr4')
capricorn_group = Point(151.869, -23.386)
point_data = dataset.ems.select_point(capricorn_group)

Some methods take a DataArray as a parameter:

# Plot the sea surface temperature for time = 0
temp = dataset['temp'].isel(time=0, k=-1)
dataset.ems.plot(temp)

Plot of sea surface temperature from the GBR4 example file

A number of operations provide further functionality to manipulate datasets, export geometry, and select subsets of data:

from emsarray.operations import geometry
geometry.write_geojson(dataset, './gbr4.geojson')
geometry.write_shapefile(dataset, './gbr4.shp')

Links

Examples

Examples of using emsarray are available in the emsarray-notebooks repository. You can explore these notebooks online with Binder.

Developing

To get set up for development, make a virtual environment and install the dependencies:

$ python3 -m venv
$ source venv/bin/activate
$ pip install --upgrade pip>=21.3
$ pip install -e .[testing]

Tests

To run the tests, install and run tox:

$ python3 -m venv
$ source venv/bin/activate
$ pip install --upgrade pip>=21.3 tox
$ tox

Documentation

The documentation for the current stable version of emsarray is available on Read The Docs.

To build the documentation, install the development requirements as above and invoke Sphinx:

$ make -C docs/ html

While updating or adding to the documentation, run the live target to automatically rebuild the docs whenever anything changes. This will serve the documentation via a livereload server.

$ make -C docs/ live

You can the view the docs at http://localhost:5500

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

emsarray-0.9.0.tar.gz (101.1 kB view details)

Uploaded Source

Built Distribution

emsarray-0.9.0-py3-none-any.whl (105.8 kB view details)

Uploaded Python 3

File details

Details for the file emsarray-0.9.0.tar.gz.

File metadata

  • Download URL: emsarray-0.9.0.tar.gz
  • Upload date:
  • Size: 101.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for emsarray-0.9.0.tar.gz
Algorithm Hash digest
SHA256 d99029fe8380e18ef2791a379518aa903bed1b9e482fe5bafa8254d719c10723
MD5 1b9259e265abfb7cfe01ffe7ae9aef96
BLAKE2b-256 48b10b6fd763cd80b298cfa166be77680786634ea8ec4ac31b24edfd6e6c5340

See more details on using hashes here.

File details

Details for the file emsarray-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: emsarray-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 105.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for emsarray-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a1a9e0703b210e680eebc141a976e49539baf9609f9b852fcf0e547cf3a0c08
MD5 24f84f4f9aced380a6513ee53643cbe5
BLAKE2b-256 ea73264b0b3b64e2f3467326f3c2fbb182427cae8217d4db8c00dc340f0e2daf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page