https://github.com/xarray-contrib/xdggs
Xarray extension for DGGS
https://github.com/xarray-contrib/xdggs
Last synced: 21 days ago
JSON representation
Xarray extension for DGGS
- Host: GitHub
- URL: https://github.com/xarray-contrib/xdggs
- Owner: xarray-contrib
- License: apache-2.0
- Created: 2023-11-06T16:11:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T20:34:22.000Z (almost 2 years ago)
- Last Synced: 2024-04-01T21:38:30.405Z (almost 2 years ago)
- Language: Python
- Size: 159 KB
- Stars: 19
- Watchers: 4
- Forks: 4
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/xarray-contrib/xdggs/actions/ci.yml?query=branch%3Amain+event%3Apush)
[](https://xdggs.readthedocs.io)
[](https://pypi.org/project/xdggs)
[](https://github.com/python/black)
[](https://github.com/conda-forge/xdggs-feedstock)
---

# xdggs: discrete global grid systems with xarray
`xdggs` is an open-source Python package that provides tools for handling geospatial data using Discrete Global Grid Systems (DGGS).
It enables efficient manipulation and analysis of multi-dimensional gridded data within a DGGS framework, supporting spatial data processing, resampling, and aggregation on both global and regional scales.
Inspired by the growing need for scalable geospatial data analysis with DGGS, `xdggs` is built upon the robust [Xarray](https://xarray.pydata.org/) ecosystem, which simplifies working with labeled multi-dimensional arrays.
As an extension of Xarray, `xdggs` leverages Xarray's capabilities, including seamless access to formats like [NetCDF](https://www.unidata.ucar.edu/software/netcdf/), [Zarr](https://zarr.readthedocs.io/), and parallelization through [Dask](https://www.dask.org/), to provide a powerful and flexible toolkit for geospatial analysis.
## Key Features
- **Seamless Integration with Xarray**: Use `xdggs` alongside Xarray's powerful tools for managing labeled, multi-dimensional data.
- **Support for DGGS**: Convert geospatial data into DGGS representations, allowing for uniform spatial partitioning of the Earth's surface.
- **Spatial Resampling**: Resample data on DGGS grids, enabling downscaling or upscaling across multiple resolutions.
- **DGGS Aggregation**: Perform spatial aggregation of data on DGGS cells.
- **Efficient Data Management**: Manage large datasets with Xarray's lazy loading, Dask integration, and chunking to optimize performance.
## Documentation
You can find the documentation in [https://xdggs.readthedocs.io/en/latest/](https://xdggs.readthedocs.io/en/latest/).
## Demo

## Getting Started
As an example, this is how you would use `xdggs` to reconstruct geographical coordinates from the cell ids then create an interactive plot indicating cell ids, data values and the associated geographical coordinates:
```python
import xarray as xr
import xdggs
ds = xdggs.tutorial.open_dataset("air_temperature", "h3")
# Decode DGGS coordinates
ds_idx = ds.pipe(xdggs.decode)
# Assign geographical coordinates
ds_idx = ds_idx.dggs.assign_latlon_coords()
# Interactive visualization
ds_idx["air"].isel(time=0).compute().dggs.explore(center=0, cmap="viridis", alpha=0.5)
```
## Roadmap
We have exciting plans to expand xdggs with new features and improvements. You can check out our roadmap in the [design_doc.md](https://github.com/xarray-contrib/xdggs/blob/main/design_doc.md) file for details on the design of xdggs, upcoming features, and future enhancements.
## Contributing
We welcome contributions to `xdggs`! Please follow these steps to get involved:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature-branch`).
3. Make your changes and write tests.
4. Ensure all tests pass (`pytest`).
5. Submit a pull request!
## License
`xdggs` is licensed under the Apache License. See [LICENSE](https://github.com/xarray-contrib/xdggs/blob/main/LICENSE) for more details.
## Acknowledgments
This project was initiated using funding from CNES (PANGEO IAOCEA, contract R&T R-S23/DU-0002-025-01) and the European Union (ERC, WaterSmartLand, 101125476, Interreg-BSR, HyTruck, #C031).