Geospatial analysis environment.
Project description
Spatial Analysis Environment
This repo abstracts the basics of a spatial analysis environment, so it can be used consistently across microservices.
A slightly weird thing right now:
- We want to use conda for installation, because it helps manage a lot of the dependencies (GDAL)
- But we can't use conda for publishing, because the path to get on conda-forge seems like a pain and we haven't prioritized it. Eventually we'll use pixi, but pixi build is still in development.
- So we're using
uvto publish, and that introduces some dependency mismatches. We can see what those are with thecreate-mismatch-reporttarget. So far they have been minor. We don't use this report for anything, but it's a useful sanity check. Keep in mind this is just a mismatch between the base environment incondaanduv. Downstream environments pip install base via conda, so there are no mismatches between analysis services (iejupyteranddask) - Eventually we'll switch to conda publishing, probably via
pixi
Environments
The environments directory contains the base environment and any other environments that are needed.
The base environment is the core dependencies for all later tooling and environments.
The analysis environment is used for later tooling that is specific to analysis (like RasterOps and VectorOps).
The jupyter environment is used for the Jupyter notebook and includes RasterOps and VectorOps.
The pmtiles environment is used for the PMTiles tooling.
Publishing Base Environment
Adding a new dependency
When adding a new dependency to the project:
- Add the package to
environments/base/base.yml:
dependencies:
- new-package>=1.0.0
- Add the same package to
pyproject.toml:
dependencies = [
"new-package>=1.0.0",
]
Publishing the base environment to PyPI
- Build the base environment:
make base-build
make base-run
- Update the lock files, within the running container:
make lock
This also generates a mismatch report at version_info/mismatch_report.txt to ensure version alignment between conda and uv.
-
Review the mismatch report at
version_info/mismatch_report.txtto ensure version alignment between conda and uv: -
Test the environment: You will need a PyPI token to publish, in
.env.publish. Ask someone who has it.
make publish
This publishes the base environment to PyPI, so it can be used in downstream repos (rasterops, vectorops, etc).
Building downstream environments
To keep things consistent, we use the base environment to build downstream environments. It gets pip installed via conda to ensure compatibility with the base environment. Downstream environments also need to include the same version of gdal, installed via conda.
Example rasterops environment
name: rasterops
channels:
- conda-forge
dependencies:
- python>=3.12.0,<3.13.0
- gdal>=3.10.0
- pip:
- geospatial-analysis-environment>=0.1.9
- coastal_resilience_utilities>=0.1.35
Building the analysis environment
-
Update any dependencies in
environments/analysis/analysis.yml -
Build the analysis environment:
make analysis-build
make analysis-run
Building the jupyter environment
-
Update any dependencies in
environments/jupyter/jupyter.yml -
Build the jupyter environment:
make jupyter-build
make jupyter-run
Prerequisites
- Install
helm(On MacOSX):
brew install helm
See https://helm.sh/docs/intro/install/ for other systems.
- Configure AWS credentials:
Create a file named
.env.s3with your Nautilus Cept S3 credentials:
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_ENDPOINT_URL=your_endpoint_url
Deployment
Create a deployment with a pod, ingress, and persistent volume unique to you:
make jupyter-push
make jupyter-deploy
Release resources when you're done:
make jupyter-teardown
Developing Dependencies on a deployed Jupyter server
You will need to have fswatch installed (brew install fswatch). To develop
rasterops just run:
make dev-rasterops
Once we have vectorops as a dependency it will be possible to also run:
make dev-vectorops
If it's common to develop both at the same time let me know and we can pretty easily add that.
Both of these commands will ensure that there is a server running at
https://dev-jupyter.nrp-nautilus.io.
Don't forget to use importlib to reload dependencies from disk:
import importlib
import rasterops
# If you change a file locally, wait for it to be synced and then run:
importlib.reload(rasterops)
If you want to make sure that the dev server is shut down you can just run
helm uninstall dev
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spatialoperations-0.1.22.tar.gz.
File metadata
- Download URL: spatialoperations-0.1.22.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3839d9621c1c7cade6893e0fdec53c9819e2de3237373c6d972c48cf36828c8b
|
|
| MD5 |
a4917e8944bfa1c0c81f9511ea74f74f
|
|
| BLAKE2b-256 |
b20a512abdc63ec903d50d4158efc71f1b645c238032eb0ca7f9c7ce6b145eb8
|
File details
Details for the file spatialoperations-0.1.22-py3-none-any.whl.
File metadata
- Download URL: spatialoperations-0.1.22-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ccd4e541469de314a0e55c91f0aba11e5a2b5ece6fc33b614ae3fe13bdd49b30
|
|
| MD5 |
0c0b11908ff65dbb35ca0c462d1d4888
|
|
| BLAKE2b-256 |
ddb1debb5ae2ae056cf519b082967d565a9e2a228fbf1f3bd9a5a051525a8647
|