Skip to content

Commit 8e6a1d4

Browse files
authored
Feat/pixi depl (#514)
* add pixi basewd deployment * integrate pixi into pyproject * separate pixi.toml * improve deploy docs
1 parent 6d02db9 commit 8e6a1d4

4 files changed

Lines changed: 138 additions & 1 deletion

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ flowchart LR
6060
... and others
6161

6262

63+
## [Deploy](deploy.md)
64+
65+
---
66+
6367
## Data sources
6468

6569
> [!IMPORTANT]

deploy.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# pixi based deployment
2+
3+
Rapida provides a suite of tools for real-time crisis assessment, relying on a vast ecosystem of software libraries.
4+
Because many of these dependencies are written in C/C++ for performance and require complex, dynamic linking to
5+
system-level libraries, installation can be notoriously difficult.
6+
To eliminate this barrier, Rapida leverages pixi — a **fast, modern, and highly reproducible** package manager
7+
that guarantees a seamless setup across all platforms.
8+
9+
Pixi defaults to the biggest Conda package repository, conda-forge, which contains over 30,000 packages.
10+
## Install pixi
11+
12+
Refer to [pixi installation](https://pixi.prefix.dev/latest/#installation) docs
13+
14+
## Download
15+
16+
**Linux & macOS**
17+
```bash
18+
curl -O https://raw.githubusercontent.com/UNDP-Data/rapida/refs/heads/main/deploy/pixi.toml
19+
```
20+
**Windows**
21+
```shell
22+
curl.exe -O https://raw.githubusercontent.com/UNDP-Data/rapida/refs/heads/main/deploy/pixi.toml
23+
```
24+
25+
## .env file
26+
Create a .env file and define following environmental variables.
27+
Alternatively ensure the environmental variables defined below exists in your system
28+
```shell
29+
# for uploading to azure
30+
TENANT_ID=
31+
CLIENT_ID=
32+
# for downloading NTL data from Black Marble
33+
EARTHDATA_TOKEN=
34+
# for predicting precisely VIIRS orbits
35+
SPACETRACK_USER=
36+
SPACETRACK_PASSWORD=
37+
38+
# override road type default seed for connectivity analysis
39+
40+
#"motorway": 105,
41+
#"trunk": 90,
42+
#"primary": 75,
43+
#"secondary": 60,
44+
#"tertiary": 50,
45+
#"unclassified": 40,
46+
#"residential": 35,
47+
#"service": 25
48+
49+
MJOLNIR_SECONDARY_SPEED=40
50+
```
51+
52+
## run NTL
53+
```shell
54+
pixi run rapida ntl detect --help
55+
✨ Pixi task (rapida): dotenv -e .env rapida ntl detect --help
56+
Usage: rapida ntl detect [OPTIONS]
57+
58+
Options:
59+
-b, --bbox BBOX Bounding box xmin/west, ymin/south,
60+
xmax/east, ymax/north [required]
61+
--date [%Y-%m-%d] The human experience of a specific night,
62+
local time zone matched to the center of
63+
bbox [required]
64+
--dst-dir DIRECTORY Destination directory to save the downloaded
65+
the images. [default: /tmp]
66+
-d [noaa_outage|nasa_nrt_outage|nasa_outage]
67+
One or more of the RAPIDA NTL deliverables.
68+
[required]
69+
--popvar TEXT One or more RAPIDA population variable to
70+
compute zonal stats for outages
71+
-ot, --percentage_drop INTEGER Specify the outage drop threshold that wil
72+
determine the spatial structure of an outage
73+
event,
74+
-cm, --cmask Enable strict Cloud Masking (ignores pixels
75+
with NASA quality flags of 3). Disable this
76+
flag during major storm events to prevent
77+
atmospheric noise from erroneously masking
78+
out legitimate blackout signals.
79+
--display Show a graphic visualization of the outage
80+
analysis.Useful to inspect the input imagery
81+
and debug/understand the outage results
82+
--debug Enable debug logging.
83+
--help Show this message and exit.
84+
85+
86+
87+
pixi run rapida ntl search noaa -b -72.3,7.5,-64.16,13.72 --date 2026-07-10 -cm
88+
✨ Pixi task (rapida): dotenv -e .env rapida ntl search noaa -b -72.3,7.5,-64.16,13.72 --date 2026-07-10 -cm
89+
[07/17/26 01:32:59] INFO Skipping DescendingPass: SNPP-202607100504 because of low elevation angle 13.664044 search.py:396
90+
[07/17/26 01:33:07] INFO Skipping DescendingPass: N21-202607100429 because of low elevation angle 4.678326 search.py:396
91+
[07/17/26 01:33:09] INFO Skipping DescendingPass: N21-202607100749 because of low elevation angle 2.797944 search.py:396
92+
VIIRS satellites granules for the night of 2026-07-10 covering (-72.3, 7.5, -64.16, 13.72)
93+
┏━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓
94+
┃ Position ┃ Satellite ┃ Timestamp (UTC) ┃ Bbox offset from SSP (km) ┃ Elevation above bbox (degrees) ┃ Cloud coverage in bbox (%) ┃ Score (%) ┃ BBOX intersection (%) ┃
95+
┡━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩
96+
│ 1 │ N21 │ 202607100609 │ 115 │ 80.81 │ 89 │ 42 │ 81 │
97+
│ 2 │ SNPP │ 202607100644 │ 798 │ 39.82 │ 88 │ 24 │ 75 │
98+
│ 3 │ N20 │ 202607100523 │ 1191 │ 26.91 │ 93 │ 15 │ 43 │
99+
│ 4 │ N20 │ 202607100703 │ 1443 │ 20.95 │ 96 │ 11 │ 35 │
100+
└──────────┴───────────┴─────────────────┴───────────────────────────┴────────────────────────────────┴────────────────────────────┴───────────┴───────────────────────┘
101+
102+
103+
```

deploy/pixi.toml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
[workspace]
2+
name = "rapida"
3+
channels = ["conda-forge"]
4+
platforms = ["linux-64", "win-64", "osx-arm64"]
5+
6+
[dependencies]
7+
# Heavy binary geospatial drivers and libraries
8+
python = ">=3.12"
9+
numpy = "<2"
10+
gdal = ">=3.12.0"
11+
fiona = "*"
12+
rasterio = "*"
13+
geopandas = "*"
14+
shapely = "*"
15+
exactextract = "*"
16+
rio-cogeo = "*"
17+
pyarrow = "*"
18+
h5py = ">=3.16.0"
19+
satpy = ">=0.59.0"
20+
matplotlib = ">=3.10.9"
21+
netcdf4 = ">=1.7.3"
22+
h5netcdf = ">=1.8.1"
23+
24+
[pypi-dependencies]
25+
# Pixi natively understands Git URLs in the pypi section!
26+
rapida = { git = "https://github.com/UNDP-Data/rapida.git", branch = "main" }
27+
dotenv-cli="*"
28+
29+
[tasks]
30+
rapida = "dotenv -e .env rapida"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,4 @@ Issues = "https://github.com/UNDP-Data/rapida/issues"
8989
include = ["rapida*"]
9090

9191
# Initialize SCM to calculate versions from Git tags
92-
[tool.setuptools_scm]
92+
[tool.setuptools_scm]

0 commit comments

Comments
 (0)