Development Status
- 5 - Production/Stable
Intended Audience
- Science/Research
License
- OSI Approved :: MIT License
Topic
- Scientific/Engineering
- Scientific/Engineering :: GIS
- Software Development :: Libraries
Programming Language
- Python :: 3
- Python :: 3.8
- Python :: 3.9
Operating System
- Microsoft :: Windows
- POSIX
Natural Language
- English
eotransform-xarray
What can I use eotransform-xarray for?
The eotransform-xarray package provides common transformations on raster data represented as xarray data structures, following the Transformer protocol of eotransform.
This makes them easy to mix and match, and you can quickly chain processing pipelines, using other eotransform protocols.
Additionally, processing pipelines constructed from these Transformers, can be automatically applied to the streamed_process
function from eotransform, to benefit from I/O hiding.
Getting Started
Installation
pip install eotransform-xarray
Example: streamed processing pipeline
In the following example swath data is resampled, masked and written out as a GeoTIFF stack.
resample = ResampleWithGauss(swath_geometry, raster_geometry, sigma=2e5, neighbours=4, lookup_radius=1e6)
mask = MaskWhere(lambda x: x > 2, np.nan)
squeeze = Squeeze()
with ThreadPoolExecutor(max_workers=3) as ex:
pipeline = Compose([resample, mask, squeeze])
streamed_process(input_src, pipeline, SinkToGeoTiff(dst_dir, lambda i, da: f"out_{i}.tif"), ex)
Note, that this example uses eotransform's streamed_process function to hide the I/O operations, using the compute resources more effectively.
Support & Documentation
Dependencies:
eotransform-xarray requires Python 3.8 and has these dependencies:
eotransform>=1.8
xarray
rioxarray
numpy
affine
more_itertools
Citation
If you find this repository useful, please consider giving it a star or a citation:
@software{eotransform_xarray_2023_8002854,
author = {Raml, Bernhard},
title = {eotransform-xarray},
month = jun,
year = 2023,
publisher = {Zenodo},
version = {2.4.1},
doi = {10.5281/zenodo.8002854},
url = {https://doi.org/10.5281/zenodo.8002854}
}