forcingkit 0.21.0__tar.gz → 0.22.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.
- {forcingkit-0.21.0 → forcingkit-0.22.0}/PKG-INFO +1 -1
- forcingkit-0.22.0/docs/source/cache_viewer.rst +146 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/conf.py +1 -1
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/doppio.rst +2 -3
- {forcingkit-0.21.0 → forcingkit-0.22.0}/pyproject.toml +1 -1
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/main.py +2 -2
- forcingkit-0.22.0/service/forcingkit_serve/routers/view.py +218 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/routers/viewer.py +1 -721
- forcingkit-0.22.0/service/forcingkit_serve/view_store.py +1133 -0
- forcingkit-0.22.0/static/app.js +282 -0
- forcingkit-0.22.0/static/cells_map.js +336 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/static/coverage.js +52 -2
- forcingkit-0.22.0/static/index.html +200 -0
- forcingkit-0.22.0/static/preview.js +534 -0
- forcingkit-0.22.0/static/scene3d.js +613 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/static/styles.css +271 -51
- forcingkit-0.22.0/static/view_api.js +123 -0
- forcingkit-0.22.0/tests/unit/test_view_store.py +289 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/uv.lock +1 -1
- forcingkit-0.21.0/docs/source/cache_viewer.rst +0 -67
- forcingkit-0.21.0/service/forcingkit_serve/routers/plotly_api.py +0 -150
- forcingkit-0.21.0/static/app.js +0 -649
- forcingkit-0.21.0/static/index.html +0 -175
- forcingkit-0.21.0/static/preview3d.js +0 -350
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.agents/forcingkit.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.claude/CLAUDE.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.env.template +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.github/copilot-instructions.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.github/workflows/docs.yml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.github/workflows/publish-client.yml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.github/workflows/publish.yml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.github/workflows/tests.yml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.gitignore +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.markdownlint.yaml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.pre-commit-config.yaml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/.python-version +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/AGENTS.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/CONTRIBUTING.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/Dockerfile +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/LICENSE +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/README.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/LICENSE +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/README.md +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/pyproject.toml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/src/forcingkit_client/__init__.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/src/forcingkit_client/client.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/src/forcingkit_client/schema.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/src/forcingkit_client/store.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/src/forcingkit_client/trajectory.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/tests/conftest.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/tests/test_client.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/tests/test_schema.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/tests/test_trajectory.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/client/uv.lock +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docker-compose.yml +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/Makefile +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/make.bat +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/requirements-docs.txt +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/_extra/CNAME +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/_static/forcingkit-noreaster-wind.gif +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/atmospheric_forcing.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/client.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/fetchers.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/hycom.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/index.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/layered_mesh.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/mesh_frames.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/necofs.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/nyofs.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/rivers.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/roadmap.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/shelf_models.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/sources.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/docs/source/waves.rst +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/main.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/__init__.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/__init__.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/jobs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/routers/bathymetry.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/routers/removed.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/routers/stores.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/forcingkit_serve/stac.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/service/run_server.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/__init__.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/data/rivers/northeast_us.json +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/dispatcher.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/coastwatch.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/dbofs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/doppio.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/erddap.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hfradar.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hrdps.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hrrr.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hrrr_atmosphere.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hrrr_levels.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hrrr_points.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hycom.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/hydrography.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/ndbc.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/necofs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/noaa.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/nwps.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/nyofs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/usgs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/fetchers/usgs_rivers.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/layered_mesh.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/mesh_frames.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/ramps/currents_lis.csv +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/ramps/currents_lis_dark.csv +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/ramps/currents_lis_deep.csv +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/ramps/currents_lis_haline.csv +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/render.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/settings.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/src/forcingkit/zarr_stream.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/static/favicon.ico +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/static/favicon.svg +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/static/logo.svg +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/__init__.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_auth.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_erddap_fetch.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_mesh_frames_necofs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_necofs_volume_live.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_nwps_nomads.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_nyofs_obc_fetch.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_obc_offshore_nj.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_ofs_archive_paths.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/integration/test_s3_roms_fetchers.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/scripts/inspect_dem.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/scripts/inspect_grib.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/scripts/inspect_zarr.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/data/doppio_reanalysis_20220811_corner.nc +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_cache_inventory.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_coastwatch.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_dbofs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_dispatcher.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_doppio.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_erddap.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hfradar.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hrdps.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hrrr_atm.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hrrr_idx.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hrrr_levels.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hrrr_points.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_hycom.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_jobs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_layered_mesh.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_main.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_mesh_frames.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_ndbc.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_necofs_hindcast.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_necofs_mesh_cache.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_necofs_parent.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_necofs_volume.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_noaa_currents.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_noaa_datum.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_nwps.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_nyofs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_obc_donor_report.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_obc_pipeline.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_removed_routes.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_settings.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_usgs.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_usgs_rivers.py +0 -0
- {forcingkit-0.21.0 → forcingkit-0.22.0}/tests/unit/test_zarr_stream.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: forcingkit
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.0
|
|
4
4
|
Summary: Spatiotemporal forcing for computational Earth-system models: selects, regrids and serves model-ready time series with provenance.
|
|
5
5
|
Project-URL: Documentation, https://forcingkit.docs.lhzn.io
|
|
6
6
|
Project-URL: Issues, https://github.com/lhzn-io/forcingkit/issues
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Cache viewer
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
The service serves a page at ``/ui/`` that lists every store in ``FORCINGKIT_CACHE_DIR``: the
|
|
5
|
+
Zarr stores it built and the raw GRIB and NetCDF files it fetched. The page polls
|
|
6
|
+
``/api/v1/cache/inventory`` every two seconds, so new stores appear while a request is still
|
|
7
|
+
running.
|
|
8
|
+
|
|
9
|
+
Coverage
|
|
10
|
+
--------
|
|
11
|
+
|
|
12
|
+
The **Coverage** tab answers which stores cover a place and a time:
|
|
13
|
+
|
|
14
|
+
- **Map.** Each store's footprint is drawn as an outline, colored by its source family (NECOFS,
|
|
15
|
+
Doppio, HRRR, HYCOM, HF radar and so on). Hovering an outline names the store, its kind and its
|
|
16
|
+
time span; clicking it selects the store and opens its preview.
|
|
17
|
+
- **Coverage strip.** One row per source family and one column per UTC day. The shade is the
|
|
18
|
+
number of hours of that day covered by the stores in the current map view, so panning or
|
|
19
|
+
zooming the map changes the strip. Clicking a cell filters the list and the map to that day.
|
|
20
|
+
|
|
21
|
+
The filters above the list apply to both: the family chips (click to hide or show a family,
|
|
22
|
+
double-click to show only it), the kind, a date range, and **In map view**, which lists only
|
|
23
|
+
the stores that overlap the map.
|
|
24
|
+
|
|
25
|
+
Preview
|
|
26
|
+
-------
|
|
27
|
+
|
|
28
|
+
The **Preview** tab draws the selected store on its own cells: an unstructured mesh (NECOFS
|
|
29
|
+
FVCOM) by its triangles, a regular or curvilinear grid (HRRR, NWPS, Doppio, the parent-ocean
|
|
30
|
+
stores) by its cells, and a store of sites (river mouths) as one circle per site. It reads every
|
|
31
|
+
store the inventory lists, including those in subfolders.
|
|
32
|
+
|
|
33
|
+
- **Map.** One color per cell over the basemap, one record at a time. Choose the field (a speed
|
|
34
|
+
is derived from each east and north pair), the layer and the record; **Play** steps through the
|
|
35
|
+
records. The readout under the pointer gives the cell's value, the layer's depth, the bed and
|
|
36
|
+
the cell's index in the source.
|
|
37
|
+
- **3D.** The surface cells, see-through and with faint cell edges, over a lit bed tinted from
|
|
38
|
+
shallow to deep: a mesh's own faceted bed where the store holds the depth at its nodes, else
|
|
39
|
+
each cell flat at its own bed with walls between neighbors. Tracers show the current or wind
|
|
40
|
+
below: in a thinned set of columns and up to six levels down each, one segment per cell moves
|
|
41
|
+
along that cell's velocity and wraps inside the cell, colored by depth in the column. Up to
|
|
42
|
+
four level maps draw whole layers at their heights. Navigation is
|
|
43
|
+
`vantagekit <https://github.com/lhzn-io/vantagekit>`__: drag to orbit, keys while the view has
|
|
44
|
+
focus, double-click to turn about a point.
|
|
45
|
+
- **Section.** Click points on the map and double-click (or press Enter) to finish: the panel
|
|
46
|
+
shows the field along the line in every layer, with the bed, and the 3D view hangs it as a
|
|
47
|
+
curtain.
|
|
48
|
+
|
|
49
|
+
The link in the address bar (``#<store>&f=<field>&k=<layer>&t=<record>&v=3d``) reopens the same
|
|
50
|
+
view.
|
|
51
|
+
|
|
52
|
+
The preview draws what the store holds and nothing more:
|
|
53
|
+
|
|
54
|
+
- **No interpolation.** A cell is drawn flat in its own color; a section sample takes its host
|
|
55
|
+
cell's value. Records are held, not blended, during playback.
|
|
56
|
+
- **Fixed scales.** A field's scale is set once per store from the 1st to the 99th percentile of
|
|
57
|
+
its values weighted by cell area (symmetric about zero, at the 99.5th percentile of the
|
|
58
|
+
magnitude, for signed fields), so a color means the same value in every record and layer.
|
|
59
|
+
Water speed uses the packaged ``currents_lis_dark`` ramp at its own speeds (0.02 to 3.1 m/s on
|
|
60
|
+
a log axis), so different stores compare directly.
|
|
61
|
+
- **True heights.** Layers run from the surface down and are labeled with their mean depth:
|
|
62
|
+
fixed levels from the store's vertical coordinate, sigma layers from ``siglay`` and the water
|
|
63
|
+
depth ``h``, atmosphere levels from their heights. Sigma layers in a store without ``h`` are
|
|
64
|
+
labeled by sigma and stacked evenly in 3D, and the legend says so.
|
|
65
|
+
- **Large grids.** A grid with more than 400,000 cells (120,000 in 3D) is shown every *n*-th
|
|
66
|
+
cell in each direction; each drawn cell carries one source cell's value, never an average, and
|
|
67
|
+
the legend says when.
|
|
68
|
+
|
|
69
|
+
Drawing API
|
|
70
|
+
-----------
|
|
71
|
+
|
|
72
|
+
The page draws through ``/api/v1/cache/view/{id}/...``; other tools can use it too. ``detail``
|
|
73
|
+
(``2d`` or ``3d``) picks the cell budget, and element numbering is fixed for a store and detail.
|
|
74
|
+
|
|
75
|
+
.. list-table::
|
|
76
|
+
:header-rows: 1
|
|
77
|
+
:widths: 25 75
|
|
78
|
+
|
|
79
|
+
* - Route
|
|
80
|
+
- Returns
|
|
81
|
+
* - ``manifest``
|
|
82
|
+
- JSON: fields (label, units, scale ``lo`` and ``hi``, ``log``, ticks, and a 256-entry RGBA
|
|
83
|
+
ramp indexed by byte code), layers surface first with mean heights, record times and
|
|
84
|
+
cadence, cell counts, stride and bounding box.
|
|
85
|
+
* - ``mesh``
|
|
86
|
+
- Binary: node longitudes and latitudes (Float64) then triangles (Uint32, three per element).
|
|
87
|
+
* - ``frame?field=&layer=&t=``
|
|
88
|
+
- Binary: one byte per element on the field's scale (0: no value; 1 to 255 from ``lo`` to
|
|
89
|
+
``hi``), as ``forcingkit.layered_mesh.FieldMeta.encode`` writes it.
|
|
90
|
+
* - ``heights?layer=&t=``, ``bed``
|
|
91
|
+
- Binary Float32 per element: the layer center's height and the bed's (m, positive up).
|
|
92
|
+
``bed?at=node`` gives the bed per mesh node where the store holds the depth at its nodes.
|
|
93
|
+
* - ``point?lon=&lat=&field=&layer=&t=``
|
|
94
|
+
- JSON: the cell under the point, its value, height, bed and source index.
|
|
95
|
+
* - ``section?pts=lon,lat;...&field=&t=&n=``
|
|
96
|
+
- JSON: values and heights in every layer at ``n`` points along the polyline.
|
|
97
|
+
* - ``tracers?pair=&t=&levels=&limit=``
|
|
98
|
+
- JSON: up to ``limit`` columns thinned evenly (their elements, the same at every level) and
|
|
99
|
+
up to ``levels`` layers from the surface down, each with east and north components and
|
|
100
|
+
heights per column.
|
|
101
|
+
|
|
102
|
+
Inventory fields
|
|
103
|
+
----------------
|
|
104
|
+
|
|
105
|
+
Besides the display strings, each inventory entry carries structured fields for other tools:
|
|
106
|
+
|
|
107
|
+
.. list-table::
|
|
108
|
+
:header-rows: 1
|
|
109
|
+
:widths: 20 80
|
|
110
|
+
|
|
111
|
+
* - Field
|
|
112
|
+
- Meaning
|
|
113
|
+
* - ``bbox``
|
|
114
|
+
- ``[west, south, east, north]`` in degrees (longitudes in -180 to 180), from the store's
|
|
115
|
+
longitude and latitude coordinates or variables (mesh nodes and river mouths included),
|
|
116
|
+
else from its ``bbox`` or ``requested_bbox`` attribute. ``null`` when neither exists.
|
|
117
|
+
* - ``time_start``, ``time_end``
|
|
118
|
+
- ISO 8601 UTC times of the first and last records, or the target date of a snapshot.
|
|
119
|
+
* - ``family``
|
|
120
|
+
- The source model or provider, read from the store's path and its ``type``, ``source``
|
|
121
|
+
and donor attributes.
|
|
122
|
+
* - ``kind``
|
|
123
|
+
- ``ocean boundary``, ``ocean volume``, ``initial condition``, ``atmosphere``,
|
|
124
|
+
``atmosphere levels``, ``waves``, ``rivers``, ``surface currents (radar)`` or
|
|
125
|
+
``raw donor file``.
|
|
126
|
+
|
|
127
|
+
Entries are cached per store and rebuilt only when the store's metadata files change.
|
|
128
|
+
|
|
129
|
+
Basemap
|
|
130
|
+
-------
|
|
131
|
+
|
|
132
|
+
By default the maps use `OpenFreeMap <https://openfreemap.org/>`__ vector tiles
|
|
133
|
+
(OpenStreetMap data), which need no key, cut down to land, water, the shoreline and faint
|
|
134
|
+
rivers: no roads, buildings, place names or boundaries, so the data drawn over it carries the
|
|
135
|
+
map. The credit sits behind the (i) button in the map's corner. To draw your own relief instead, put PMTiles archives of raster tiles (WebP or PNG, 256 px) in a folder and point the
|
|
136
|
+
service at it:
|
|
137
|
+
|
|
138
|
+
.. code-block:: bash
|
|
139
|
+
|
|
140
|
+
export FORCINGKIT_BASEMAP_DIR=/path/to/basemaps
|
|
141
|
+
export FORCINGKIT_BASEMAP_ATTRIBUTION="Relief: NOAA, USGS"
|
|
142
|
+
|
|
143
|
+
Every ``<name>.pmtiles`` in the folder is drawn, coarsest first (by deepest zoom), dimmed for the
|
|
144
|
+
dark page; a ``<name>.coast.geojson`` beside it is drawn as a shoreline. The page reads the
|
|
145
|
+
archives in byte ranges from ``/api/v1/cache/basemap/files/<file>``, and
|
|
146
|
+
``/api/v1/cache/basemap`` lists them.
|
|
@@ -120,9 +120,8 @@ Limits
|
|
|
120
120
|
- **Sea level datum.** ``zeta`` is relative to the model's own mean sea level; the Rutgers
|
|
121
121
|
metadata names no geodetic datum.
|
|
122
122
|
- **Cache viewer.** The cache viewer (:doc:`cache_viewer`) lists the stores under
|
|
123
|
-
``doppio/volume
|
|
124
|
-
|
|
125
|
-
volume stores.
|
|
123
|
+
``doppio/volume/``, draws their footprints on its coverage map and previews them on their
|
|
124
|
+
own curvilinear cells, every layer at its height from ``siglay`` and ``h``.
|
|
126
125
|
|
|
127
126
|
Credit
|
|
128
127
|
------
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "forcingkit"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.22.0"
|
|
8
8
|
description = "Spatiotemporal forcing for computational Earth-system models: selects, regrids and serves model-ready time series with provenance."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -24,9 +24,9 @@ from forcingkit_serve.jobs import Job # noqa: E402
|
|
|
24
24
|
from forcingkit_serve.routers import ( # noqa: E402
|
|
25
25
|
viewer,
|
|
26
26
|
bathymetry,
|
|
27
|
-
plotly_api,
|
|
28
27
|
removed,
|
|
29
28
|
stores,
|
|
29
|
+
view as view_api,
|
|
30
30
|
)
|
|
31
31
|
from forcingkit.fetchers.noaa import fetch_noaa_tide_data # noqa: E402
|
|
32
32
|
from importlib.metadata import version as _package_version # noqa: E402
|
|
@@ -103,7 +103,7 @@ app.add_middleware(
|
|
|
103
103
|
|
|
104
104
|
app.include_router(viewer.router)
|
|
105
105
|
app.include_router(bathymetry.router)
|
|
106
|
-
app.include_router(
|
|
106
|
+
app.include_router(view_api.router)
|
|
107
107
|
app.include_router(stores.router)
|
|
108
108
|
# 410 Gone stubs for the routes removed on 2026-10-05; drop at the next release.
|
|
109
109
|
app.include_router(removed.router)
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"""The cache viewer's drawing API: any cached store on its own cells (see `view_store`).
|
|
2
|
+
|
|
3
|
+
Every route takes the store id from the inventory and `detail` (``2d`` or ``3d``, the cell
|
|
4
|
+
budget for large grids; element numbering is fixed for a store and detail). Binary bodies are
|
|
5
|
+
little-endian.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import logging
|
|
11
|
+
from typing import Any, Callable
|
|
12
|
+
|
|
13
|
+
import numpy as np
|
|
14
|
+
from fastapi import APIRouter, HTTPException, Query
|
|
15
|
+
from fastapi.responses import JSONResponse, Response
|
|
16
|
+
from starlette.concurrency import run_in_threadpool
|
|
17
|
+
|
|
18
|
+
from forcingkit_serve import view_store
|
|
19
|
+
from forcingkit_serve.routers.viewer import _crawl_inventory
|
|
20
|
+
|
|
21
|
+
logger = logging.getLogger(__name__)
|
|
22
|
+
|
|
23
|
+
router = APIRouter(prefix="/api/v1/cache/view", tags=["Cache Viewer"])
|
|
24
|
+
|
|
25
|
+
Detail = Query("2d", pattern="^(2d|3d)$", description="Cell budget: 2d or 3d")
|
|
26
|
+
BINARY = "application/octet-stream"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _view(dataset_id: str, detail: str) -> view_store.StoreView:
|
|
30
|
+
items = _crawl_inventory()
|
|
31
|
+
path = view_store.resolve_store(dataset_id, items)
|
|
32
|
+
if path is None:
|
|
33
|
+
raise HTTPException(
|
|
34
|
+
status_code=404, detail=f"No store {dataset_id} in the cache."
|
|
35
|
+
)
|
|
36
|
+
item = next(i for i in items if i.id == dataset_id)
|
|
37
|
+
try:
|
|
38
|
+
return view_store.get_view(
|
|
39
|
+
dataset_id, path, detail, (item.modified_time, item.size_mb)
|
|
40
|
+
)
|
|
41
|
+
except ValueError as e:
|
|
42
|
+
raise HTTPException(status_code=422, detail=str(e))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
async def _run(fn: Callable[[], Any]) -> Any:
|
|
46
|
+
try:
|
|
47
|
+
return await run_in_threadpool(fn)
|
|
48
|
+
except HTTPException:
|
|
49
|
+
raise
|
|
50
|
+
except KeyError as e:
|
|
51
|
+
raise HTTPException(status_code=404, detail=str(e).strip("'\""))
|
|
52
|
+
except ValueError as e:
|
|
53
|
+
raise HTTPException(status_code=422, detail=str(e))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _cells_only(view: view_store.StoreView) -> None:
|
|
57
|
+
if view.store == "points":
|
|
58
|
+
raise HTTPException(status_code=422, detail="this store holds sites, not cells")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _field(view: view_store.StoreView, name: str) -> None:
|
|
62
|
+
if name not in view.fields:
|
|
63
|
+
raise HTTPException(
|
|
64
|
+
status_code=404,
|
|
65
|
+
detail=f"no field {name!r}; fields: {', '.join(view.fields)}",
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@router.get("/{dataset_id}/manifest")
|
|
70
|
+
async def manifest(dataset_id: str, detail: str = Detail):
|
|
71
|
+
"""Fields (label, units, fixed scale, ticks, 256-entry RGBA ramp by byte code), layers
|
|
72
|
+
surface first with mean heights, record times and cadence, cell counts and stride."""
|
|
73
|
+
return JSONResponse(await _run(lambda: _view(dataset_id, detail).manifest()))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@router.get("/{dataset_id}/mesh")
|
|
77
|
+
async def mesh(dataset_id: str, detail: str = Detail):
|
|
78
|
+
"""Node longitudes, node latitudes (Float64 each) and triangles (Uint32, three per
|
|
79
|
+
element). Sizes are in the manifest (n_node, n_elem)."""
|
|
80
|
+
|
|
81
|
+
def body():
|
|
82
|
+
view = _view(dataset_id, detail)
|
|
83
|
+
_cells_only(view)
|
|
84
|
+
return view.mesh_bytes()
|
|
85
|
+
|
|
86
|
+
return Response(await _run(body), media_type=BINARY)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@router.get("/{dataset_id}/frame")
|
|
90
|
+
async def frame(
|
|
91
|
+
dataset_id: str,
|
|
92
|
+
field: str = Query(..., description="Field name from the manifest"),
|
|
93
|
+
layer: int = Query(0, ge=0, description="Layer, 0 at the surface"),
|
|
94
|
+
t: int = Query(0, ge=0, description="Record index"),
|
|
95
|
+
detail: str = Detail,
|
|
96
|
+
):
|
|
97
|
+
"""One byte per element on the field's fixed scale (0: no value): for sites, one per site."""
|
|
98
|
+
|
|
99
|
+
def body():
|
|
100
|
+
view = _view(dataset_id, detail)
|
|
101
|
+
_field(view, field)
|
|
102
|
+
return view.codes(field, t, layer)
|
|
103
|
+
|
|
104
|
+
return Response(await _run(body), media_type=BINARY)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@router.get("/{dataset_id}/heights")
|
|
108
|
+
async def heights(
|
|
109
|
+
dataset_id: str,
|
|
110
|
+
layer: int = Query(0, ge=0),
|
|
111
|
+
t: int = Query(0, ge=0),
|
|
112
|
+
detail: str = Detail,
|
|
113
|
+
):
|
|
114
|
+
"""Float32 per element: the layer center's height (m, positive up); 404 when the store
|
|
115
|
+
holds no heights."""
|
|
116
|
+
|
|
117
|
+
def body():
|
|
118
|
+
view = _view(dataset_id, detail)
|
|
119
|
+
_cells_only(view)
|
|
120
|
+
z = view.heights(t, layer)
|
|
121
|
+
if z is None:
|
|
122
|
+
raise HTTPException(
|
|
123
|
+
status_code=404, detail="this store holds no layer heights"
|
|
124
|
+
)
|
|
125
|
+
return np.asarray(z, "<f4").tobytes()
|
|
126
|
+
|
|
127
|
+
return Response(await _run(body), media_type=BINARY)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@router.get("/{dataset_id}/bed")
|
|
131
|
+
async def bed(
|
|
132
|
+
dataset_id: str,
|
|
133
|
+
at: str = Query("element", pattern="^(element|node)$"),
|
|
134
|
+
detail: str = Detail,
|
|
135
|
+
):
|
|
136
|
+
"""Float32 per element (or, with at=node, per mesh node, where the store holds the depth at
|
|
137
|
+
its nodes): the bed's height (m, positive up), or the ground's for an atmosphere; 404 when
|
|
138
|
+
the store holds none."""
|
|
139
|
+
|
|
140
|
+
def body():
|
|
141
|
+
view = _view(dataset_id, detail)
|
|
142
|
+
_cells_only(view)
|
|
143
|
+
b = view.bed_nodes() if at == "node" else view.bed()
|
|
144
|
+
if b is None:
|
|
145
|
+
raise HTTPException(status_code=404, detail="this store holds no bed")
|
|
146
|
+
return np.asarray(b, "<f4").tobytes()
|
|
147
|
+
|
|
148
|
+
return Response(await _run(body), media_type=BINARY)
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@router.get("/{dataset_id}/point")
|
|
152
|
+
async def point(
|
|
153
|
+
dataset_id: str,
|
|
154
|
+
lon: float = Query(..., ge=-180, le=180),
|
|
155
|
+
lat: float = Query(..., ge=-90, le=90),
|
|
156
|
+
field: str = Query(...),
|
|
157
|
+
layer: int = Query(0, ge=0),
|
|
158
|
+
t: int = Query(0, ge=0),
|
|
159
|
+
detail: str = Detail,
|
|
160
|
+
):
|
|
161
|
+
"""The cell under a point: value, layer height, bed, source cell index, record time (for a
|
|
162
|
+
store of sites, the nearest site)."""
|
|
163
|
+
|
|
164
|
+
def body():
|
|
165
|
+
view = _view(dataset_id, detail)
|
|
166
|
+
_field(view, field)
|
|
167
|
+
return view.point(lon, lat, field, t, layer)
|
|
168
|
+
|
|
169
|
+
return JSONResponse(await _run(body))
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@router.get("/{dataset_id}/section")
|
|
173
|
+
async def section(
|
|
174
|
+
dataset_id: str,
|
|
175
|
+
pts: str = Query(..., description="lon,lat;lon,lat;... (two or more points)"),
|
|
176
|
+
field: str = Query(...),
|
|
177
|
+
t: int = Query(0, ge=0),
|
|
178
|
+
n: int = Query(200, ge=2, le=1000),
|
|
179
|
+
detail: str = Detail,
|
|
180
|
+
):
|
|
181
|
+
"""Values in every layer at n points along a polyline, each from its host cell."""
|
|
182
|
+
|
|
183
|
+
def body():
|
|
184
|
+
try:
|
|
185
|
+
points = [[float(x) for x in p.split(",")] for p in pts.split(";") if p]
|
|
186
|
+
except ValueError:
|
|
187
|
+
raise HTTPException(
|
|
188
|
+
status_code=422, detail="pts must be lon,lat;lon,lat;..."
|
|
189
|
+
)
|
|
190
|
+
if len(points) > 50:
|
|
191
|
+
raise HTTPException(status_code=422, detail="at most 50 points")
|
|
192
|
+
view = _view(dataset_id, detail)
|
|
193
|
+
_cells_only(view)
|
|
194
|
+
_field(view, field)
|
|
195
|
+
return view.section(points, field, t, n)
|
|
196
|
+
|
|
197
|
+
return JSONResponse(await _run(body))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
@router.get("/{dataset_id}/tracers")
|
|
201
|
+
async def tracers(
|
|
202
|
+
dataset_id: str,
|
|
203
|
+
pair: str = Query(..., description="speed or wind_speed"),
|
|
204
|
+
t: int = Query(0, ge=0),
|
|
205
|
+
levels: int = Query(6, ge=1, le=12),
|
|
206
|
+
limit: int = Query(3000, ge=10, le=20000),
|
|
207
|
+
detail: str = Detail,
|
|
208
|
+
):
|
|
209
|
+
"""East and north components for tracers kept inside their own cells: up to `limit`
|
|
210
|
+
columns (thinned evenly, the same at every level), each column's element, and up to
|
|
211
|
+
`levels` layers from the surface down with their heights."""
|
|
212
|
+
|
|
213
|
+
def body():
|
|
214
|
+
view = _view(dataset_id, detail)
|
|
215
|
+
_cells_only(view)
|
|
216
|
+
return view.tracers(pair, t, levels, limit)
|
|
217
|
+
|
|
218
|
+
return JSONResponse(await _run(body))
|