Metadata-Version: 2.1
Name: emsarray
Version: 0.7.0
Summary: xarray extension that supports multiple geometry conventions
Author-email: "Coastal Environmental Modelling team, Oceans and Atmosphere, CSIRO" <coasts@csiro.au>
License: Copyright 2023 Commonwealth Scientific and Industrial Research Organisation
        
        Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
        
Project-URL: Documentation, https://emsarray.readthedocs.io/
Project-URL: Release notes, https://emsarray.readthedocs.io/en/stable/releases/0.7.0/
Project-URL: Source, https://github.com/csiro-coasts/emsarray/
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: bottleneck>=1.3
Requires-Dist: geojson>=3.0
Requires-Dist: netcdf4>=1.6.4
Requires-Dist: numpy>=1.24
Requires-Dist: packaging>=23.1
Requires-Dist: shapely>=2.0
Requires-Dist: pyshp>=2.3
Requires-Dist: xarray[parallel]>=2023.5
Provides-Extra: plot
Requires-Dist: cartopy>=0.21; extra == "plot"
Requires-Dist: matplotlib>=3.7; extra == "plot"
Requires-Dist: pykdtree>=1.3; extra == "plot"
Requires-Dist: cfunits>=3.3; extra == "plot"
Provides-Extra: tutorial
Requires-Dist: pooch>=1.7; extra == "tutorial"
Provides-Extra: complete
Requires-Dist: emsarray[plot,tutorial]; extra == "complete"
Provides-Extra: docs
Requires-Dist: emsarray[complete]; extra == "docs"
Requires-Dist: sphinx~=6.2.1; extra == "docs"
Requires-Dist: sphinx_book_theme~=1.0.1; extra == "docs"
Requires-Dist: livereload~=2.6.3; extra == "docs"
Provides-Extra: testing
Requires-Dist: emsarray[complete]; extra == "testing"
Requires-Dist: pytest; extra == "testing"
Requires-Dist: pytest-cov; extra == "testing"
Requires-Dist: pytest-mpl; extra == "testing"
Requires-Dist: mypy; extra == "testing"
Requires-Dist: pandas-stubs; extra == "testing"
Requires-Dist: types-pytz; extra == "testing"
Requires-Dist: flake8; extra == "testing"
Requires-Dist: isort; extra == "testing"

# emsarray

[![Binder](https://mybinder.org/badge_logo.svg)][emsarray-binder]
[![Documentation Status](https://readthedocs.org/projects/emsarray/badge/?version=latest)](https://emsarray.readthedocs.io/en/latest/?badge=latest)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/emsarray.svg)](https://anaconda.org/conda-forge/emsarray)

The `emsarray` package provides a common interface
for working with the many model geometry conventions used at CSIRO.
It enhances [`xarray`][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:

```python
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:

```python
# 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](docs/_static/images/gbr4_temp.png)

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

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

## Links

* [Source code on Github][emsarray-source-code]
* [Documentation on Read The Docs][emsarray-documentation]
* [emsarray on PyPI][emsarray-pypi]
* [emsarray on conda-forge][emsarray-conda-forge]

## Examples

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


## Developing

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

```shell
$ 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`:

```shell
$ 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][emsarray-documentation].

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

```shell
$ 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`][livereload] server.

```shell
$ make -C docs/ live
```

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

[emsarray-binder]: https://mybinder.org/v2/gh/csiro-coasts/emsarray-notebooks/HEAD
[emsarray-conda-forge]: https://anaconda.org/conda-forge/emsarray/
[emsarray-documentation]: https://emsarray.readthedocs.io
[emsarray-notebooks]: https://github.com/csiro-coasts/emsarray-notebooks
[emsarray-pypi]: https://pypi.org/project/emsarray/
[emsarray-source-code]: https://github.com/csiro-coasts/emsarray
[livereload]: https://livereload.readthedocs.io/en/latest/
[xarray]: https://xarray.pydata.org/
