Skip to main content

Implements transformations on xarray data structures, to be used with eotransform streamed_process.

Project description

Coverage badge Documentation Status DOI

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)

snippet source | anchor

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

snippet source | anchor

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}
}

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

eotransform-xarray-2.5.3.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

eotransform_xarray-2.5.3-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file eotransform-xarray-2.5.3.tar.gz.

File metadata

  • Download URL: eotransform-xarray-2.5.3.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.1

File hashes

Hashes for eotransform-xarray-2.5.3.tar.gz
Algorithm Hash digest
SHA256 2b1d7fbc08466aa9592a5fa53dc95327624f2eaddfd0c7da217b8528ce96aec0
MD5 f749472ea710eb8b93cd13601337a848
BLAKE2b-256 622ca98d1df38c405f6d1abed016e7468c00cd13891fd7ef556083a37ff5643b

See more details on using hashes here.

File details

Details for the file eotransform_xarray-2.5.3-py3-none-any.whl.

File metadata

File hashes

Hashes for eotransform_xarray-2.5.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3da988d677db4584b503805dc759181c8838f8ef77441377590acbec6186d2cd
MD5 ad1e57ec2a845235fa3d88599e17afec
BLAKE2b-256 f79fcda687f1a2a5ae4ed0caa630fb3523212d7cdfc608bcc8930e27a314e5cf

See more details on using hashes here.

Supported by

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