bowser-insar 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bowser_insar-0.2.0/.env +8 -0
- bowser_insar-0.2.0/.github/dependabot.yml +7 -0
- bowser_insar-0.2.0/.github/release.yml +5 -0
- bowser_insar-0.2.0/.github/workflows/cd.yml +37 -0
- bowser_insar-0.2.0/.github/workflows/ci.yml +43 -0
- bowser_insar-0.2.0/.gitignore +33 -0
- bowser_insar-0.2.0/.pre-commit-config.yaml +38 -0
- bowser_insar-0.2.0/MANIFEST.in +3 -0
- bowser_insar-0.2.0/PKG-INFO +150 -0
- bowser_insar-0.2.0/README.md +129 -0
- bowser_insar-0.2.0/docs/demo-timeseries.jpg +0 -0
- bowser_insar-0.2.0/docs/walkthrough-disp-s1.md +70 -0
- bowser_insar-0.2.0/environment.yml +29 -0
- bowser_insar-0.2.0/index.html +120 -0
- bowser_insar-0.2.0/package-lock.json +4475 -0
- bowser_insar-0.2.0/package.json +24 -0
- bowser_insar-0.2.0/pyproject.toml +100 -0
- bowser_insar-0.2.0/scripts/combine-jsons.py +82 -0
- bowser_insar-0.2.0/setup.cfg +4 -0
- bowser_insar-0.2.0/src/basemap.ts +41 -0
- bowser_insar-0.2.0/src/bowser/__init__.py +0 -0
- bowser_insar-0.2.0/src/bowser/_prepare_disp_s1.py +169 -0
- bowser_insar-0.2.0/src/bowser/_prepare_nisar.py +81 -0
- bowser_insar-0.2.0/src/bowser/_prepare_utils.py +144 -0
- bowser_insar-0.2.0/src/bowser/_version.py +21 -0
- bowser_insar-0.2.0/src/bowser/add_overviews.py +130 -0
- bowser_insar-0.2.0/src/bowser/cli.py +648 -0
- bowser_insar-0.2.0/src/bowser/config.py +37 -0
- bowser_insar-0.2.0/src/bowser/dist/index.css +133 -0
- bowser_insar-0.2.0/src/bowser/dist/index.html +121 -0
- bowser_insar-0.2.0/src/bowser/dist/index.js +24361 -0
- bowser_insar-0.2.0/src/bowser/main.py +403 -0
- bowser_insar-0.2.0/src/bowser/readers.py +595 -0
- bowser_insar-0.2.0/src/bowser/titiler.py +212 -0
- bowser_insar-0.2.0/src/bowser/utils.py +120 -0
- bowser_insar-0.2.0/src/bowser_insar.egg-info/PKG-INFO +150 -0
- bowser_insar-0.2.0/src/bowser_insar.egg-info/SOURCES.txt +83 -0
- bowser_insar-0.2.0/src/bowser_insar.egg-info/dependency_links.txt +1 -0
- bowser_insar-0.2.0/src/bowser_insar.egg-info/entry_points.txt +2 -0
- bowser_insar-0.2.0/src/bowser_insar.egg-info/requires.txt +6 -0
- bowser_insar-0.2.0/src/bowser_insar.egg-info/top_level.txt +1 -0
- bowser_insar-0.2.0/src/main.ts +476 -0
- bowser_insar-0.2.0/src/mouse.ts +83 -0
- bowser_insar-0.2.0/src/style.css +133 -0
- bowser_insar-0.2.0/src/vite-env.d.ts +1 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_connected_component_labels.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_persistent_scatterer_mask.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_phase_similarity.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_recommended_mask.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_shp_counts.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_temporal_coherence.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/average_timeseries_inversion_residuals.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20160801.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20160825.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20160918.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20161012.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20161105.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20161129.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20161217.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/connected_component_labels_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20160801.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20160825.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20160918.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20161012.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20161105.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20161129.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20161217.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/displacement_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/persistent_scatterer_mask_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/phase_similarity_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20160801.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20160825.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20160918.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20161012.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20161105.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20161129.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20161217.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/recommended_mask_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/shp_counts_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/temporal_coherence_20160708_20161223.tif +0 -0
- bowser_insar-0.2.0/tests/data/geotiffs/water_mask.tif +0 -0
- bowser_insar-0.2.0/tests/requirements.txt +2 -0
- bowser_insar-0.2.0/tests/test_main.py +81 -0
- bowser_insar-0.2.0/tsconfig.json +23 -0
- bowser_insar-0.2.0/vite.config.ts +22 -0
bowser_insar-0.2.0/.env
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Update this if deploying elsewhere besides locally
|
|
2
|
+
DOMAIN=localhost
|
|
3
|
+
BOWSER_DATASET_CONFIG_FILE="bowser_rasters.json"
|
|
4
|
+
|
|
5
|
+
# Backend
|
|
6
|
+
BACKEND_CORS_ORIGINS="[\"http://localhost\", \"http://localhost:5173\", \"http://localhost:8000\", \"http://127.0.0.1:8000\", \"https://localhost\", \"https://localhost:5173\", \"https://localhost:8000\"]"
|
|
7
|
+
|
|
8
|
+
LOG_LEVEL=WARNING
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This workflow will build a Python Package and upload to pypi. See:
|
|
2
|
+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
|
|
3
|
+
# https://github.com/marketplace/actions/pypi-publish
|
|
4
|
+
name: CD
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
release:
|
|
9
|
+
types: [created]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
pypi-publish:
|
|
13
|
+
name: upload release to PyPI
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
environment: release
|
|
16
|
+
permissions:
|
|
17
|
+
id-token: write
|
|
18
|
+
steps:
|
|
19
|
+
# retrieve your distributions here
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
fetch-depth: 0
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: '3.x'
|
|
27
|
+
- name: Install build dependencies and package
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip setuptools_scm
|
|
30
|
+
pip install build
|
|
31
|
+
- name: Get version and Build
|
|
32
|
+
run: |
|
|
33
|
+
# Version added upon installing package
|
|
34
|
+
python -m pip install --no-deps .
|
|
35
|
+
python -m build --sdist --wheel
|
|
36
|
+
- name: Publish package distributions to PyPI
|
|
37
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on: [pull_request, push]
|
|
4
|
+
|
|
5
|
+
concurrency:
|
|
6
|
+
group: ${{ github.workflow }}-${{ github.head_ref }}
|
|
7
|
+
cancel-in-progress: true
|
|
8
|
+
|
|
9
|
+
env:
|
|
10
|
+
# https://github.com/pytest-dev/pytest/issues/2042#issuecomment-429289164
|
|
11
|
+
PY_IGNORE_IMPORTMISMATCH: 1
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
pytest:
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, macos-latest]
|
|
18
|
+
|
|
19
|
+
fail-fast: false
|
|
20
|
+
name: ${{ matrix.os }}
|
|
21
|
+
runs-on: ${{ matrix.os }}
|
|
22
|
+
defaults:
|
|
23
|
+
run:
|
|
24
|
+
shell: bash -l {0}
|
|
25
|
+
steps:
|
|
26
|
+
- name: Checkout
|
|
27
|
+
uses: actions/checkout@v4
|
|
28
|
+
- name: Setup environment
|
|
29
|
+
uses: mamba-org/setup-micromamba@v2
|
|
30
|
+
with:
|
|
31
|
+
environment-file: environment.yml
|
|
32
|
+
environment-name: bowser-env
|
|
33
|
+
generate-run-shell: false
|
|
34
|
+
condarc: |
|
|
35
|
+
channels:
|
|
36
|
+
- conda-forge
|
|
37
|
+
- name: Install
|
|
38
|
+
run: |
|
|
39
|
+
pip install .[test,remote,geopandas]
|
|
40
|
+
pip install xarray dask
|
|
41
|
+
- name: Test
|
|
42
|
+
run: |
|
|
43
|
+
pytest -vv
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
pnpm-debug.log*
|
|
8
|
+
lerna-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
*.local
|
|
12
|
+
|
|
13
|
+
# Editor directories and files
|
|
14
|
+
.vscode/*
|
|
15
|
+
!.vscode/extensions.json
|
|
16
|
+
.idea
|
|
17
|
+
.DS_Store
|
|
18
|
+
*.suo
|
|
19
|
+
*.ntvs*
|
|
20
|
+
*.njsproj
|
|
21
|
+
*.sln
|
|
22
|
+
*.sw?
|
|
23
|
+
|
|
24
|
+
.vite
|
|
25
|
+
|
|
26
|
+
# Python
|
|
27
|
+
__pycache__
|
|
28
|
+
*egg-info*
|
|
29
|
+
# Autogenerated:
|
|
30
|
+
_version.py
|
|
31
|
+
|
|
32
|
+
data/
|
|
33
|
+
.ipynb_checkpoints
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ci:
|
|
2
|
+
autofix_prs: false
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: "v5.0.0"
|
|
7
|
+
hooks:
|
|
8
|
+
# https://github.com/pre-commit/pre-commit-hooks/issues/718
|
|
9
|
+
# - id: check-added-large-files # Fails with git v1.8.3
|
|
10
|
+
- id: check-case-conflict
|
|
11
|
+
- id: check-docstring-first
|
|
12
|
+
- id: check-merge-conflict
|
|
13
|
+
- id: check-yaml
|
|
14
|
+
args: [--allow-multiple-documents]
|
|
15
|
+
- id: debug-statements
|
|
16
|
+
- id: end-of-file-fixer
|
|
17
|
+
- id: file-contents-sorter
|
|
18
|
+
files: (requirements.txt)$
|
|
19
|
+
- id: mixed-line-ending
|
|
20
|
+
- id: trailing-whitespace
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
24
|
+
rev: v0.1.14
|
|
25
|
+
hooks:
|
|
26
|
+
- id: ruff
|
|
27
|
+
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
|
|
28
|
+
- id: ruff-format
|
|
29
|
+
|
|
30
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
31
|
+
rev: "v1.8.0"
|
|
32
|
+
hooks:
|
|
33
|
+
- id: mypy
|
|
34
|
+
additional_dependencies:
|
|
35
|
+
- types-setuptools
|
|
36
|
+
- types-requests
|
|
37
|
+
- "pydantic>=2.4"
|
|
38
|
+
- types-simplejson
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bowser-insar
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Web UI for browsing InSAR time series
|
|
5
|
+
Author-email: Scott Staniewicz <scott.stanie@gmail.com>
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Intended Audience :: Science/Research
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Provides-Extra: docs
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: httpx; extra == "test"
|
|
20
|
+
Requires-Dist: pytest; extra == "test"
|
|
21
|
+
|
|
22
|
+
# Bowser
|
|
23
|
+
|
|
24
|
+

|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mamba env create
|
|
30
|
+
conda activate bowser-env
|
|
31
|
+
pip install .
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Note: if viewing files on S3, please install `s5cmd`:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
mamba install s5cmd
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quickstart for dolphin
|
|
41
|
+
|
|
42
|
+
- `bowser setup-dolphin` is preconfigured to make a JSON file pointing to the outputs inside `work_directory` of dolphin
|
|
43
|
+
- `bowser run` starts the web server on `localhost`:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
$ bowser setup-dolphin work/
|
|
47
|
+
Reading raster metadata: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 236.13it/s]
|
|
48
|
+
Reading raster metadata: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 95.74it/s]
|
|
49
|
+
Reading raster metadata: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 266.77it/s]
|
|
50
|
+
Reading raster metadata: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 100.49it/s]
|
|
51
|
+
Reading raster metadata: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 94.88it/s]
|
|
52
|
+
|
|
53
|
+
$ bowser run
|
|
54
|
+
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
|
55
|
+
INFO: Started parent process [99855]
|
|
56
|
+
...
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Click on the `http://127.0.0.1:8000` link to open the map.
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
**Note for running over ssh**: you will need to run an ssh command creating a tunnel from your local computer to wherever the `bowser` server is.
|
|
63
|
+
For example, if you machine is `myserver`, you would run in a local terminal
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
ssh -N -L 8000:localhost:8000 myserver
|
|
67
|
+
```
|
|
68
|
+
after starting the web server.
|
|
69
|
+
|
|
70
|
+
## Quickstart for DISP-S1 NetCDFs
|
|
71
|
+
|
|
72
|
+
Until GDAL puts work into the NetCDF driver, reading remote HDF5/NetCDF files has very poor support. Additionally, there is no standard overview format as there is with GeoTIFFs, so `titiler` is very unhappy.
|
|
73
|
+
|
|
74
|
+
We can get around this to some degree by creating [VRTs](https://gdal.org/drivers/raster/vrt.html) and [making external overviews](https://gdal.org/programs/gdaladdo.html) pointing at these VRTs.
|
|
75
|
+
|
|
76
|
+
1. Download the NetCDFs (hopefully on some server which has fast access to the S3 bucket).
|
|
77
|
+
2. Run `bowser prepare-disp-s1` to create VRT files pointing in the `.nc` files, one per dataset we wish to browse.
|
|
78
|
+
3. Run `bowser setup-disp-s1` to make a JSON file containing all the file metadata, so the browser knows where to look.
|
|
79
|
+
4. `bowser run`
|
|
80
|
+
|
|
81
|
+
In detail:
|
|
82
|
+
|
|
83
|
+
1. Download
|
|
84
|
+
I use [`s5cmd`](https://github.com/peak/s5cmd) for faster copying, but the `aws` CLI tool works too:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
mkdir my_disp_files; cd my_disp-files
|
|
88
|
+
s5cmd --numworkers 4 cp 's3://opera-bucket/OPERA_L3_DISP-S1_IW_F11115*/OPERA_L3_DISP-S1_IW_F11115*.nc' .
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
2. Extract VRTS
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
bowser prepare-disp-s1 -o vrts *.nc
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
3. Create `bowser_rasters.json` metadata
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
bowser setup-disp-s1 vrts
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
4. Run
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
bowser run
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
If this is on a server instead of your laptop, you'll need (on your laptop)
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
ssh -N -L 8000:localhost:8000 myserver
|
|
113
|
+
```
|
|
114
|
+
for whatever port pops up after `bowser run`
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
## CLI Usage
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
$ bowser --help
|
|
121
|
+
Usage: bowser [OPTIONS] COMMAND [ARGS]...
|
|
122
|
+
|
|
123
|
+
CLI for bowser.
|
|
124
|
+
|
|
125
|
+
Options:
|
|
126
|
+
--help Show this message and exit.
|
|
127
|
+
|
|
128
|
+
Commands:
|
|
129
|
+
addo Add compressed GDAL overviews to files.
|
|
130
|
+
run Run the web server.
|
|
131
|
+
set-data Specify what raster data to use.
|
|
132
|
+
setup-dolphin Set up output data configuration for a dolphin workflow.
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
To manually specify a raster/set of rasters, use the interactive `bowser set-data`
|
|
136
|
+
|
|
137
|
+
## Developer Setup
|
|
138
|
+
|
|
139
|
+
`npm` is used to manage javascript dependencies.
|
|
140
|
+
|
|
141
|
+
`npm install` will install all dependencies.
|
|
142
|
+
|
|
143
|
+
After making HTML or CSS changes, run `npm run build` to build the project.
|
|
144
|
+
Currently the `dist/` HTML and CSS files are checked in to git for easier deployment for non-javascript users.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
Copyright 2024, by the California Institute of Technology. ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged. Any commercial use must be negotiated with the Office of Technology Transfer at the California Institute of Technology.
|
|
149
|
+
|
|
150
|
+
This software may be subject to U.S. export control laws. By accepting this software, the user agrees to comply with all applicable U.S. export laws and regulations. User has the responsibility to obtain export licenses, or other export authority as may be required before exporting such information to foreign countries or providing access to foreign persons.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Bowser
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
mamba env create
|
|
9
|
+
conda activate bowser-env
|
|
10
|
+
pip install .
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Note: if viewing files on S3, please install `s5cmd`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
mamba install s5cmd
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quickstart for dolphin
|
|
20
|
+
|
|
21
|
+
- `bowser setup-dolphin` is preconfigured to make a JSON file pointing to the outputs inside `work_directory` of dolphin
|
|
22
|
+
- `bowser run` starts the web server on `localhost`:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
$ bowser setup-dolphin work/
|
|
26
|
+
Reading raster metadata: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 236.13it/s]
|
|
27
|
+
Reading raster metadata: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 95.74it/s]
|
|
28
|
+
Reading raster metadata: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 2/2 [00:00<00:00, 266.77it/s]
|
|
29
|
+
Reading raster metadata: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 100.49it/s]
|
|
30
|
+
Reading raster metadata: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 94.88it/s]
|
|
31
|
+
|
|
32
|
+
$ bowser run
|
|
33
|
+
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
|
|
34
|
+
INFO: Started parent process [99855]
|
|
35
|
+
...
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Click on the `http://127.0.0.1:8000` link to open the map.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
**Note for running over ssh**: you will need to run an ssh command creating a tunnel from your local computer to wherever the `bowser` server is.
|
|
42
|
+
For example, if you machine is `myserver`, you would run in a local terminal
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
ssh -N -L 8000:localhost:8000 myserver
|
|
46
|
+
```
|
|
47
|
+
after starting the web server.
|
|
48
|
+
|
|
49
|
+
## Quickstart for DISP-S1 NetCDFs
|
|
50
|
+
|
|
51
|
+
Until GDAL puts work into the NetCDF driver, reading remote HDF5/NetCDF files has very poor support. Additionally, there is no standard overview format as there is with GeoTIFFs, so `titiler` is very unhappy.
|
|
52
|
+
|
|
53
|
+
We can get around this to some degree by creating [VRTs](https://gdal.org/drivers/raster/vrt.html) and [making external overviews](https://gdal.org/programs/gdaladdo.html) pointing at these VRTs.
|
|
54
|
+
|
|
55
|
+
1. Download the NetCDFs (hopefully on some server which has fast access to the S3 bucket).
|
|
56
|
+
2. Run `bowser prepare-disp-s1` to create VRT files pointing in the `.nc` files, one per dataset we wish to browse.
|
|
57
|
+
3. Run `bowser setup-disp-s1` to make a JSON file containing all the file metadata, so the browser knows where to look.
|
|
58
|
+
4. `bowser run`
|
|
59
|
+
|
|
60
|
+
In detail:
|
|
61
|
+
|
|
62
|
+
1. Download
|
|
63
|
+
I use [`s5cmd`](https://github.com/peak/s5cmd) for faster copying, but the `aws` CLI tool works too:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
mkdir my_disp_files; cd my_disp-files
|
|
67
|
+
s5cmd --numworkers 4 cp 's3://opera-bucket/OPERA_L3_DISP-S1_IW_F11115*/OPERA_L3_DISP-S1_IW_F11115*.nc' .
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
2. Extract VRTS
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
bowser prepare-disp-s1 -o vrts *.nc
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
3. Create `bowser_rasters.json` metadata
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bowser setup-disp-s1 vrts
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
4. Run
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
bowser run
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If this is on a server instead of your laptop, you'll need (on your laptop)
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
ssh -N -L 8000:localhost:8000 myserver
|
|
92
|
+
```
|
|
93
|
+
for whatever port pops up after `bowser run`
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
## CLI Usage
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
$ bowser --help
|
|
100
|
+
Usage: bowser [OPTIONS] COMMAND [ARGS]...
|
|
101
|
+
|
|
102
|
+
CLI for bowser.
|
|
103
|
+
|
|
104
|
+
Options:
|
|
105
|
+
--help Show this message and exit.
|
|
106
|
+
|
|
107
|
+
Commands:
|
|
108
|
+
addo Add compressed GDAL overviews to files.
|
|
109
|
+
run Run the web server.
|
|
110
|
+
set-data Specify what raster data to use.
|
|
111
|
+
setup-dolphin Set up output data configuration for a dolphin workflow.
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
To manually specify a raster/set of rasters, use the interactive `bowser set-data`
|
|
115
|
+
|
|
116
|
+
## Developer Setup
|
|
117
|
+
|
|
118
|
+
`npm` is used to manage javascript dependencies.
|
|
119
|
+
|
|
120
|
+
`npm install` will install all dependencies.
|
|
121
|
+
|
|
122
|
+
After making HTML or CSS changes, run `npm run build` to build the project.
|
|
123
|
+
Currently the `dist/` HTML and CSS files are checked in to git for easier deployment for non-javascript users.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
Copyright 2024, by the California Institute of Technology. ALL RIGHTS RESERVED. United States Government Sponsorship acknowledged. Any commercial use must be negotiated with the Office of Technology Transfer at the California Institute of Technology.
|
|
128
|
+
|
|
129
|
+
This software may be subject to U.S. export control laws. By accepting this software, the user agrees to comply with all applicable U.S. export laws and regulations. User has the responsibility to obtain export licenses, or other export authority as may be required before exporting such information to foreign countries or providing access to foreign persons.
|
|
Binary file
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Bowser Walkthrough: Disp-S1
|
|
2
|
+
|
|
3
|
+
## 0. Environment Setup
|
|
4
|
+
|
|
5
|
+
This walkthrough assumes mamba (conda) is set up. If you don't have it installed:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"
|
|
9
|
+
bash Miniforge3-$(uname)-$(uname -m).sh
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Clone the repository and create the environment:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/opera-adt/bowser.git && cd bowser
|
|
16
|
+
conda env create && conda activate bowser-env && python -m pip install "opera-utils[disp]>=0.22" dask
|
|
17
|
+
# Note: The extra pip installs are temporary and will be unnecessary soon
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 1. Download a Frame Subset Over New Orleans
|
|
21
|
+
|
|
22
|
+
This will require an Earthdata username/password, either as a `~/.netrc` file:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
$ cat ~/.netrc
|
|
26
|
+
machine urs.earthdata.nasa.gov
|
|
27
|
+
login your_username
|
|
28
|
+
password your_password
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
or set as environment variables `EARTHDATA_USERNAME` and `EARTHDATA_PASSWORD`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
export EARTHDATA_USERNAME="your_username"
|
|
35
|
+
export EARTHDATA_PASSWORD="your_password"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Run the download and subset command using `opera-utils`:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
mkdir data && cd data
|
|
42
|
+
opera-utils disp-s1-download --frame-id 44055 --wkt "POLYGON((-90.3919 29.8235,-89.7986 29.8235,-89.7986 30.1904,-90.3919 30.1904,-90.3919 29.8235))" --output-dir subsets-new-orleans
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
I found the WKT polygon by clicking around on [ASF search](https://search.asf.alaska.edu/#/?maxResults=250&polygon=POLYGON((-90.3919%2029.8235,-89.7986%2029.8235,-89.7986%2030.1904,-90.3919%2030.1904,-90.3919%2029.8235))&dataset=OPERA-S1&productTypes=DISP-S1&zoom=8.272¢er=-90.008,29.439&resultsLoaded=true&granule=OPERA_L3_DISP-S1_IW_F44054_VV_20240415T000222Z_20241024T000222Z_v1.0_20250419T145258Z).
|
|
46
|
+
|
|
47
|
+
If you'd like to download less data, you can add a `--start-datetime` or `--end-datetime` parameter.
|
|
48
|
+
|
|
49
|
+
The download took about 15-20 minutes on my laptop on the east coast, or about 3-4 minutes on a JPL server.
|
|
50
|
+
|
|
51
|
+
The result should be:
|
|
52
|
+
- 209 files
|
|
53
|
+
- About 1400 x 1800 pixels each
|
|
54
|
+
- About 4 GB of disk space
|
|
55
|
+
|
|
56
|
+
## 2. Reformat the Data to Remove the "Moving Reference"
|
|
57
|
+
|
|
58
|
+
We'll create one 3D stack of data with all the layers in it that has taken care of the moving reference date. This lets us plot the continuous time series from the start without re-calculating it on every click.
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
opera-utils disp-s1-reformat --output-name new-orleans-F44055.zarr --input-files subsets-new-orleans/OPERA_L3_DISP-S1_IW_F44055*.nc
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The reformatting takes approximately 80-90 seconds on my laptop.
|
|
65
|
+
|
|
66
|
+
## 3. Run Bowser
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bowser run --workers 3 --stack-file new-orleans-F44055.zarr
|
|
70
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
name: bowser-env
|
|
2
|
+
channels:
|
|
3
|
+
- conda-forge
|
|
4
|
+
dependencies:
|
|
5
|
+
- python>=3.10
|
|
6
|
+
- pip>=21.3 # https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#editable-installation
|
|
7
|
+
- fastapi
|
|
8
|
+
- pydantic>=2.1
|
|
9
|
+
- pydantic-settings
|
|
10
|
+
- pyproj>=3.3
|
|
11
|
+
- matplotlib-base
|
|
12
|
+
- numpy>=1.22
|
|
13
|
+
- rasterio>=1.3
|
|
14
|
+
- rioxarray
|
|
15
|
+
- gdal>=3.7
|
|
16
|
+
- libgdal-netcdf
|
|
17
|
+
- libgdal-hdf5
|
|
18
|
+
- opera-utils
|
|
19
|
+
- titiler-core
|
|
20
|
+
- tqdm
|
|
21
|
+
- typing_extensions>=3.10
|
|
22
|
+
- uvicorn
|
|
23
|
+
- xarray
|
|
24
|
+
# # Optional for reading from S3:
|
|
25
|
+
- s5cmd
|
|
26
|
+
- boto3
|
|
27
|
+
- pip:
|
|
28
|
+
- titiler.xarray[minimal,http]
|
|
29
|
+
- starlette-cramjam
|