Metadata-Version: 2.5
Name: satpp
Version: 0.2.0
Summary: Satellite primary production models (PSM, VGPM, CbPM, CAFE, AbPM and others) with shared optics, light and physiology
Project-URL: Repository, https://github.com/PrimaryProduction/satpp
Project-URL: Issues, https://github.com/PrimaryProduction/satpp/issues
Author-email: Bror Jönsson <brorfred@gmail.com>
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: numpy>=2.1.2
Requires-Dist: pandas>=2.2.3
Requires-Dist: scipy>=1.14.1
Provides-Extra: data
Requires-Dist: netcdf4>=1.7.2; extra == 'data'
Requires-Dist: pydap>=3.5.2; extra == 'data'
Requires-Dist: xarray>=2024.10.0; extra == 'data'
Description-Content-Type: text/markdown

# satpp
Primary production models driven with satellite-derived data, as an installable package
(`src/satpp`) managed with [uv](https://docs.astral.sh/uv/).

    src/satpp/
      astronomy/       solar geometry and day length (yearday-based `solar`, datetime-based `daylight`)
      light/           surface PAR spectrum, clear-sky surface irradiance, daily course of PAR,
                       propagation with depth
      optics/          pure water, CDOM and phytoplankton absorption, Case-1 IOPs from Chl,
                       diffuse attenuation (Lee, Morel, Austin & Petzold, Secchi), euphotic depth
      chlorophyll/     vertical Chl profiles, size classes (Brewin), Uitz et al. (2006) class profiles
      physiology/      P-I curves, quantum yield (Kiefer & Mitchell), photoacclimation, temperature
      models/          one module per primary production model (psm, cafe, abpm, wrm, cbpm, cbpm05,
                       morel91, arrigo08, marra03, vgpm, drpp, kiefer_mitchell, uitz10, belanger13,
                       hirawake, zoffoli18, arteaga16, hirata09, kameda05, ondrusek01, and the
                       geostationary goci_abpm, asaoka20, son05, kosc_vgpm)
      diagnostics/     tools that run several models side by side (light_fields)
      hybrid.py        mix-and-match of optics, light and physiology from PSM, CAFE, AbPM and WRM
      config.py        default PSM wavelength and depth grids
      units.py         unit conversions
    model_notebooks/   one notebook per model (light_field = PSM), plus the comparisons
                       light_curves, light_attenuation and pp_depth
      geostationary/   notebooks for the GOCI models
    hybrid.ipynb       validations, factorial comparison, CbPM2 and nutrient sections
    docs/              Quarto documentation: interactive pages, component and experiment
                       notebooks, API reference (site configuration in _quarto.yml)
    tests/             regression test of every model against stored values
    rust/              Rust port of parts of the PSM

Relationships that are shared between models, or were not developed for a particular model,
live in the subpackages; a model module keeps only what is specific to that model.

## Usage

    uv sync                      # create .venv with the package (editable), dev and notebook tools
    uv run pytest                # regression tests
    uv run jupyter lab           # notebooks

```python
from satpp.models import cafe, vgpm
from satpp.optics.case1 import giop_inputs

iop = giop_inputs(0.5)                       # GIOP-style IOPs from Chl
cafe.cafe(40.0, 0.5, 30.0, 45.0, 150, **iop, sst=15.0)
vgpm.vgpm(40.0, 0.5, 15.0, 45.0, 150)
```

`uv sync --extra data` adds xarray, pydap and netCDF4.

## Documentation

The documentation is a [Quarto](https://quarto.org) website. It renders the notebooks
with their stored outputs, so only Quarto is needed:

    quarto render                # writes the site to _site/
    quarto preview               # live preview

`docs/scripts/make_interactive_data.py` regenerates the data behind the interactive
pages and `docs/scripts/make_reference.py` the API reference; run both with `uv run`
after changing the models.

