Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

saberpro-py

Python interface to SABERPRO : a semi-analytical Bayesian aquatic radiative transfer model for inverting remote sensing reflectance (Rrs) into water optical properties and benthic parameters.


Installation

Express one click setup:

install.sh sets up everything in one shot on Ubuntu/Debian:

git clone https://github.com/homas01123/saberpro-py.git
bash saberpro-py/install.sh                          # python packages put in same loc
bash saberpro-py/install.sh --rcnet-root /your/path  # custom loc for python packages

Manual setup:

# 1. System deps
sudo apt install r-base r-base-dev gfortran cmake libnlopt-dev pkg-config \
                 libssl-dev libcurl4-openssl-dev libxml2-dev python3-venv git

# 2. SABERPRO R package ( R/C cross platform compilation and installation)
devtools::install_github("homas01123/SABERPRO", dependencies = TRUE)

# 3. saberpro-py (MUST create it's own venv)
git clone https://github.com/homas01123/saberpro-py.git && cd saberpro-py
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"   # pulls in python dependencies

# 4. radcalnet_oc (VRTE driven Ed calculation, suitable for super high spectral res)
git clone https://github.com/homas01123/radcalnet_oc.git
cd radcalnet_oc && python3 -m venv .rcnet_venv
.rcnet_venv/bin/pip install -e .

Additional information : setting up radcalnet_oc ENV_VAR

Ed_source="radcalnet_oc" routes through R's reticulate to call the radcalnet_oc Python package. The three vars below tell reticulate which Python to use : they must be exported before starting Python / JupyterLab, not inside a notebook cell.

export RCNET_OC_ROOT="/path/to/radcalnet_oc"
export RCNET_OC_VENV="$RCNET_OC_ROOT/.rcnet_venv"
export RETICULATE_PYTHON="$RCNET_OC_VENV/bin/python"

Add to ~/.bashrc to make permanent. install.sh prints the exact paths at the end of its run.


Tutorials

Notebook Description
notebooks/forward_inverse_basics.ipynb IOP computation, elastic AM03 forward model, SICF-enabled forward model (AM03-SICF), gradient-MAP and MCMC inversion, Level-2 products, and anisotropic correction.
notebooks/irradiance_modes_sicf.ipynb Comparison of the two downwelling irradiance models (Gregg & Carder 1990 vs radcalnet_oc) for SICF forward simulation and inversion, including logit-bounded optimisation.

API reference

Function Description
list_benthic_classes() List available benthic class names
select_benthic_classes(classes) Load benthic classes into C cache
compute_r_rs_b_lmm(fractions) Mixed benthic reflectance spectrum
iop_from_oac(wavelength, par) Compute IOPs from OAC parameters
forward_am03(...) Elastic forward model (sub-surface Rrs)
forward_am03_sicf(...) Elastic + SICF forward model
rrs_0p_to_0m(rrs) Above : sub-surface Rrs conversion
rrs_0m_to_0p(rrs) Sub : above-surface Rrs conversion
make_inversion_params(...) Build inversion configuration
inverse_gradient(rrs_df, cfg) Gradient-based MAP inversion
inverse_mcmc(rrs_df, cfg, ...) MCMC posterior inversion
compute_l2_products(...) Reconstruct Rrs, IOPs, Kd, GoF

Citation

If you use SABERPRO in your work, please cite:

Mukherjee, S. et al. A Semi-Analytical Bayesian Estimate Retrieval (SABER) algorithm for the inversion of Remote Sensing Reflectance in optically deep and shallow waters. https://doi.org/10.1002/lom3.70004

About

Python Interface for SABER; a C/R tool for forward and inverse RT modeling in optically complex waters

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages