Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dymaxionlabs/dask-rasterio
Read and write rasters in parallel using Rasterio and Dask
https://github.com/dymaxionlabs/dask-rasterio
dask gdal python rasterio
Last synced: about 1 month ago
JSON representation
Read and write rasters in parallel using Rasterio and Dask
- Host: GitHub
- URL: https://github.com/dymaxionlabs/dask-rasterio
- Owner: dymaxionlabs
- License: bsd-3-clause
- Created: 2018-06-06T19:03:20.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-28T14:35:47.000Z (over 3 years ago)
- Last Synced: 2024-04-24T12:14:09.084Z (2 months ago)
- Topics: dask, gdal, python, rasterio
- Language: Python
- Homepage:
- Size: 813 KB
- Stars: 94
- Watchers: 5
- Forks: 8
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Lists
- awesome-earthobservation-code - dask-rasterio - Read and write rasters in parallel using Rasterio and Dask `Python` (`Python` processing of optical imagery (non deep learning) / Python libraries related to EO)
- Awesome-Geospatial - dask-rasterio - Read and write rasters in parallel using Rasterio and Dask. (Python)
- awesome-gis - dask-rasterio - Read and write rasters in parallel using Rasterio and Dask. (Geospatial Library / Python)
- awesome-dask - dask-rasterio (source code)
- awesome-gis - dask-rasterio - Read and write rasters in parallel using Rasterio and Dask. (Geospatial Library / Python)
README
# dask-rasterio
[![Build Status](https://travis-ci.org/dymaxionlabs/dask-rasterio.svg?branch=master)](https://travis-ci.org/dymaxionlabs/dask-rasterio)
[![codecov](https://codecov.io/gh/dymaxionlabs/dask-rasterio/branch/master/graph/badge.svg)](https://codecov.io/gh/dymaxionlabs/dask-rasterio) [![Join the chat at https://gitter.im/dymaxionlabs/dask-rasterio](https://badges.gitter.im/dymaxionlabs/dask-rasterio.svg)](https://gitter.im/dymaxionlabs/dask-rasterio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)`dask-rasterio` provides some methods for reading and writing rasters in
parallel using [Rasterio](https://github.com/mapbox/rasterio) and
[Dask](https://dask.pydata.org) arrays.## Usage
#### Read a multiband raster
```python
>>> from dask_rasterio import read_raster>>> array = read_raster('tests/data/RGB.byte.tif')
>>> array
dask.array>>> array.mean()
dask.array
>>> array.mean().compute()
40.858976977533935
```#### Read a single band from a raster
```python
>>> from dask_rasterio import read_raster>>> array = read_raster('tests/data/RGB.byte.tif', band=3)
>>> array
dask.array
```#### Write a singleband or multiband raster
```python
>>> from dask_rasterio import read_raster, write_raster>>> array = read_raster('tests/data/RGB.byte.tif')
>>> new_array = array & (array > 100)
>>> new_array
dask.array>>> prof = ... # reuse profile from tests/data/RGB.byte.tif...
>>> write_raster('processed_image.tif', new_array, **prof)
```#### Chunk size
Both `read_raster` and `write_raster` accept a `block_size` argument that
acts as a multiplier to the block size of rasters. The default value is 1,
which means the dask array chunk size will be the same as the block size of
the raster file. You will have to adjust this value depending on the
specification of your machine (how much memory do you have, and the block
size of the raster).## Install
Install with pip:
```
pip install dask-rasterio
```## Development
This project is managed by [Poetry](https://github.com/sdispater/poetry). If
you do not have it installed, please refer to
[Poetry instructions](https://github.com/sdispater/poetry#installation).Now, clone the repository and run `poetry install`. This will create a virtual
environment and install all required packages there.Run `poetry run pytest` to run all tests.
Run `poetry build` to build package on `dist/`.
## Issue tracker
Please report any bugs and enhancement ideas using the GitHub issue tracker:
https://github.com/dymaxionlabs/dask-rasterio/issues
Feel free to also ask questions on our
[Gitter channel](https://gitter.im/dymaxionlabs/dask-rasterio), or by email.## Help wanted
Any help in testing, development, documentation and other tasks is highly
appreciated and useful to the project.For more details, see the file [CONTRIBUTING.md](CONTRIBUTING.md).
## License
Source code is released under a BSD-2 license. Please refer to
[LICENSE.md](LICENSE.md) for more information.