RectifiedGrid
WARNING: Starting from version 2.0.0, rectifiedgrid grid has been refactored basing basing on xarray and rioxarray packages. Several API have been changed.
RectifiedGrid is a Python package which, combining into a single class several python packages (e.g. xarray, rioxarray, SciPy, shapely, fiona, geopandas, owslib, Cartopy), simplifies geospatial grid-based analyses. Numpy is a notable package for scientific computing with a support for large, multi-dimensional arrays and matrices: starting from version 2.0.0, RectifiedGrid extends xarray introducing an "rg" accessor for adding additional functionalities (e.g. rasterization, 3D manipulation). RectifiedGrid employs rasterio and fiona under the hood for raster and vector I/O and owslib to access data through OGC interoperable services.
RectifiedGrid has been initially developed to support Integrated Coastal Management and Maritime Spatial Planning analyses.
Installation
When using RectifiedGrid, you need to make sure that Geopandas is installed with rtree support. Refer to following link for more informations:
If you want to install Shapely dependency from source for compatibility with cartopy or if you want to use a different version of GEOS than the one included in the project wheels you should first install the GEOS library, Cython, and Numpy on your system (using apt, yum, brew, or other means) and then direct pip to ignore the binary wheels.
$ pip install shapely --no-binary shapely
Usage
Reading and plot GeoTIFF
import rectifiedgrid as rg
grid = rg.read_raster('test/data/adriatic_ionian.tiff', masked=True)
grid.plotmap()
Plotting options
RectifiedGrid wraps Matplotlib Basemap Toolkit functions.
grid.plotmap(rivers=True, countries=True,
grid=True, coast=True)
Map algebra: Ndvi calculation
import rectifiedgrid as rg
b4 = rg.read_raster('test/data/b04.tiff', masked=True)
b8 = rg.read_raster('test/data/b08.tiff', masked=True)
ndvi = (b8 - b4)/(b8 + b4)
ndvi.plotmap(cmap=cmap_ndvi, legend=True, vmin=-1, vmax=1)
Wrapping array-wise functions: distance from coast
RectifiedGrid implements a function wrapper (wrap_func) to apply array-wise functions.
In this example we use the distance_transform_bf (from scipy.ndimage,morphology) to calculate the distance from the coast for the Adriatic-Inonian region.
from scipy.ndimage.morphology import distance_transform_bf
distances = grid.wrap_func(distance_transform_bf)
# plotting
plt.figure(figsize=[10, 8])
distances.plotmap(rivers=True, countries=True,
grid=True, coast=True, legend=True)
How to Cite
Please, when you use rectifiedgrid cite as:
Menegon S, Sarretta A, Barbanti A, Gissi E, Venier C. (2016) Open source tools to support Integrated Coastal Management and Maritime Spatial Planning. PeerJ Preprints 4:e2245v2. doi: [10.5334/jors.106] (https://doi.org/10.7287/peerj.preprints.2245v2)
Metadata
Release files for rectifiedgrid 3.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rectifiedgrid-3.1.0.tar.gz | 34.8 kB | Without provenance | Details for rectifiedgrid-3.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rectifiedgrid-3.1.0-py3-none-any.whl | Python 3 | none | any | Details for rectifiedgrid-3.1.0-py3-none-any.whl |
Total release size: 67.9 kB
Release files / rectifiedgrid-3.1.0.tar.gz
| Download URL | rectifiedgrid-3.1.0.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57d5afc5c0b9b68514b687b7512212ba49a2e4930f66a3a021b5364857e2d12f
|
|
BLAKE2b-256 checksum How to use checksums |
ae18f5f830963793216ee66519b1dfe6f427815153586633525b51442915063c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / rectifiedgrid-3.1.0-py3-none-any.whl
| Download URL | rectifiedgrid-3.1.0-py3-none-any.whl |
|---|---|
| Size | 33.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
111ab434ef57c87bf97f4b9bb53a9be5436e9936103a51ec997f968524b08cc5
|
|
BLAKE2b-256 checksum How to use checksums |
c0aa6df189899d78adba87f876fcd35e81e1d28822187ca7a0323fde3908151b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for rectifiedgrid 3.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.