How oceanmodeling/seanode works
1. What this repository is
- seanode is a Python library for extracting ocean/atmospheric model values at station or point locations.
- It is not an application server; the main boundary is a callable library API exposed through seanode.api.
2. Primary entry point
- The top-level workflow starts with get_surge_model_at_stations(...) in seanode/api.py.
- That function likely accepts a request describing stations, model choice, variables, and time range, then returns extracted model data.
3. Request and configuration layer
- request.py and request_options.py define the input contract and query options.
- This layer separates user-facing parameters from the internal execution logic, which is important for diagramming the front edge of the system.
4. Model selection and routing
- model_factory.py chooses the correct model implementation based on the request.
- seanode/models/ contains model-specific adapters for supported datasets: gfs, hrrr, stofs_2d_glo, and stofs_3d_atl.
- model_task_creator.py suggests a second routing step that turns a model choice into the appropriate analysis task.
5. Grid vs mesh processing paths
- The codebase has distinct task modules for analysis_task_grid.py and analysis_task_mesh.py, plus a shared analysis_task.py.
- This indicates two major data geometry paths:
- grid-based models such as GFS and HRRR
- mesh-based models such as STOFS variants
- This split is a key architecture boundary.
6. Field sourcing and data access
- field_source.py appears to abstract where model fields come from.
- data_stores.py and data_store_factory.py indicate a pluggable storage/access layer, likely hiding whether data comes from local files, remote URLs, or cached references.
- kerchunker.py suggests support for kerchunk-based virtual datasets, which is a material part of the data-access architecture.
7. Model-specific implementations
- Each model module likely encodes dataset-specific metadata, variable names, coordinate conventions, and extraction rules.
- The tests show separate coverage for each model and for kerchunked GFS, implying model adapters are not generic wrappers but contain important model logic.
8. Core data flow
- The likely flow is:
- user calls the API
- request/options are normalized
- a model adapter is selected
- a task creator builds a grid or mesh analysis task
- the task resolves the backing data store / kerchunk source
- fields are extracted at station locations
- results are returned to the caller
- For an architecture diagram, this is the central left-to-right pipeline.
9. Supported model families
- The repository explicitly supports:
- GFS: global forecast system, grid-based
- HRRR: high-resolution rapid refresh, grid-based
- STOFS 2D GLO: likely a global 2D storm surge/ocean product
- STOFS 3D ATL: likely an Atlantic 3D product
- The STOFS entries each have both standard and _mesh tests, reinforcing the geometry split.
10. Testing and validation
- The tests/ directory is extensive and model-specific, with separate API tests, model tests, and mesh/grid tests.
- This suggests the repository’s correctness depends heavily on validating model-specific extraction behavior rather than just generic library mechanics.
11. Developer-facing examples
- example_points_query.ipynb and the tests serve as usage examples.
- The notebook likely demonstrates the end-to-end point-query workflow from Python code.
12. Project shape and tooling
- This is a packaged Python library managed by pyproject.toml and requirements.txt.
- There is no visible runtime infrastructure, queue, database, or web service layer in the tree; the architecture is focused on in-process data extraction and model adaptation.
13. Important architectural boundary
- The key abstraction boundary is between request/model selection and dataset access/extraction mechanics.
- Another important boundary is grid vs mesh, because those paths imply different interpolation or indexing strategies.
14. How to draw it
- A good diagram would show a single public API feeding a request/configuration layer, then branching into model-specific adapters, then into grid/mesh analysis tasks, then into data-store/kerchunk-backed field retrieval, and finally into extracted station results.
Main entry points: model_factory.py Model Factory · model_task_creator.py Task Creator · data_store_factory.py Store Factory · analysis_task.py Analysis
Components 17
Public API
User-facing entry points and request normalization.
Model Routing
Selects model-specific behavior and task shape.
- Model Factory · Chooses the appropriate model implementation.
seanode/model_factory.py - Task Creator · Turns a model choice into a concrete analysis task.
seanode/models/model_task_creator.py
Analysis Tasks
Grid and mesh extraction execution paths.
Data Access
Field sourcing, storage, and kerchunk-backed dataset resolution.
- Field Source · Abstracts where model fields come from.
seanode/field_source.py - Store Factory · Selects a concrete data store implementation.
seanode/data_store_factory.py - Data Stores · Pluggable backing store implementations.
seanode/data_stores.py - Kerchunk · Resolves kerchunk-backed dataset references.
seanode/kerchunker.py
Model Adapters
Supported model-family implementations.
- GFS · Global Forecast System adapter and metadata.
seanode/models/gfs.py - HRRR · High-resolution rapid refresh adapter and metadata.
seanode/models/hrrr.py - STOFS 2D · 2D STOFS global adapter and geometry rules.
seanode/models/stofs_2d_glo.py - STOFS 3D · 3D STOFS Atlantic adapter and geometry rules.
seanode/models/stofs_3d_atl.py
Connections 22
- API → Request: accepts · Public API receives the request object and parameters.
- API → Options: uses · API consults request options for query configuration.
- Request → Model Factory: selects · Request drives model selection.
- Options → Model Factory: constrains · Options refine the model and extraction route.
- Model Factory → GFS: routes · Chooses the GFS adapter for grid-based extraction.
- Model Factory → HRRR: routes · Chooses the HRRR adapter for grid-based extraction.
- Model Factory → STOFS 2D: routes · Chooses the STOFS 2D adapter for mesh-based extraction.
- Model Factory → STOFS 3D: routes · Chooses the STOFS 3D adapter for mesh-based extraction.
- GFS → Task Creator: builds · Model adapter informs which task to create.
- HRRR → Task Creator: builds · Model adapter informs which task to create.
- STOFS 2D → Task Creator: builds · Model adapter informs which task to create.
- STOFS 3D → Task Creator: builds · Model adapter informs which task to create.
- Task Creator → Grid Task: creates · Grid models are executed through the grid task path.
- Task Creator → Mesh Task: creates · Mesh models are executed through the mesh task path.
- Grid Task → Analysis: shares · Grid path reuses common analysis behavior.
- Mesh Task → Analysis: shares · Mesh path reuses common analysis behavior.
- Analysis → Field Source: reads · Analysis resolves model fields through the source abstraction.
- Field Source → Store Factory: selects · Field source chooses an appropriate store implementation.
- Store Factory → Data Stores: opens · Factory returns a concrete storage backend.
- Store Factory → Kerchunk: may use · Factory may resolve kerchunk-backed virtual datasets.
- Data Stores → Results: feeds · Backends provide data used for extraction.
- Kerchunk → Results: feeds · Kerchunk references provide data used for extraction.