xarray extension that supports EMS model formats
Project description
emsarray
The emsarray
package provides a common interface
for working with the many model formats 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
import json
dataset = emsarray.tutorial.open_dataset('gbr4')
with open("geometry.geojson", "w") as f:
json.dump(dataset.ems.make_geojson_geometry(), f)
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)
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 . -r continuous-integration/requirements.txt
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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.