geotoolbox
A collection of tools for geospatial, geotechnical, and statistical data processing and modelling.
Motivation
geotoolbox aims to provide a unified and user-friendly toolkit for professionals and researchers working with geospatial and geotechnical data. It streamlines common workflows for data processing, analysis, and modelling in Earth sciences and engineering applications.
Installation
You can install geotoolbox using pip:
pip install geotoolbox
For development or to install from source:
git clone https://github.com/eamontoyaa/geotoolbox.git
cd geotoolbox
pip install -e .
Usage
Import the package using the recommended alias:
import geotoolbox as gtb
# Check the version
print(gtb.__version__)
Lognormal fragility curves
Binary fragility curves are fitted directly to unbinned outcomes with a stable maximum-likelihood implementation:
from geotoolbox.fragility import fit_lognormal_fragility
fit = fit_lognormal_fragility(intensity, failed)
probability = fit.predict(intensity_grid)
probability, lower, upper = fit.confidence_band(intensity_grid)
print(fit.median_capacity, fit.sigma)
The fitted model is P(F | x) = Phi((log(x) - mu) / sigma). The result also
contains the observed-information covariance, parameter confidence intervals,
negative log-likelihood, and AIC.
Raster categories to vectors
geotoolbox.sig_helper.vectorize accepts masked arrays and numeric, NaN, or
undefined nodata values. Use dissolve=True to obtain one multipart feature per
categorical raster value.
Aligning raster inputs
Use one explicitly selected raster as the computational grid before combining cell values. Continuous fields are resampled bilinearly, categorical fields by nearest neighbour, and the returned Boolean mask is valid in every layer:
from geotoolbox.sig_helper import align_raster_stack, write_raster_like
layers, valid = align_raster_stack(
{
"elevation": "dem.tif",
"slope": "slope.tif",
"units": "geology.tif",
},
reference="elevation",
categorical=["units"],
)
elevation = layers["elevation"].data.filled(float("nan"))
units = layers["units"].data.filled(float("nan"))
result = elevation.copy() # Replace with the actual spatial model.
result[~valid] = float("nan")
write_raster_like("result.tif", result, layers["elevation"])
align_raster_stack checks CRS information, aligns extent, origin, resolution,
and array shape, and propagates source nodata/NaN masks. Do not use bilinear or
cubic resampling for class identifiers, inventories, or other categorical data.
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Collaborators
- Prof. Daniel F. Ruiz – EAFIT University
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for geotoolbox 0.2.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 | |
|---|---|---|---|
| geotoolbox-0.2.0.tar.gz | 43.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| geotoolbox-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.8 kB
Release files / geotoolbox-0.2.0.tar.gz
| Download URL | geotoolbox-0.2.0.tar.gz |
|---|---|
| Size | 43.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7900cbe169096756604bddfba6e06f5e0432f7d4278db05ae9ca8104aebee8b2
|
|
BLAKE2b-256 checksum How to use checksums |
4cab3033b77576215c18f269a0ebd89981a34cc441e87c0547b1c9dc950e7748
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|
Release files / geotoolbox-0.2.0-py3-none-any.whl
| Download URL | geotoolbox-0.2.0-py3-none-any.whl |
|---|---|
| Size | 48.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d892412196f5311a77b7957ce75b05016a12f0897b9f87732baf2355111a9b13
|
|
BLAKE2b-256 checksum How to use checksums |
7809062a319756b56a2f62697b533a35a9ea93f607bb0ccc5081df341ef07b49
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.13
|