toolsrtm.marmit

MARMIT-1 and MARMIT-2 soil reflectance models (dry -> wet soil spectrum). Direct port of ToolsRTM/R/marmit1.R, marmit2.R / get.marmit.rsoil.R. MARMIT-2 additionally accounts for soil particle size/refractive index and is generally more accurate for coarser soils; select it via get_marmit_rsoil(..., version='marmit2').

MARMIT-1 and MARMIT-2 soil reflectance models (ported from ToolsRTM/R/marmit1.R, marmit2.R and the get.marmit.rsoil() wrapper added to ToolsRTM this session).

Only the Bablet_2016 soil database (17 IDs) is bundled – same deliberate scoping as the R side’s get.marmit.rsoil() (see ToolsRTM/R/get.marmit.rsoil.R): only the driest spectrum per soil ID is needed (MARMIT computes wet reflectance FROM that one dry reference), so that’s all that’s bundled here, exported via python/scratch/scratch_export_marmit.py.

class toolsrtm.marmit.MarmitSoil(wavelength, rsoil_dry, rsoil_wet, smc)[source]

Bases: object

Result of get_marmit_rsoil().

Parameters:
wavelength: ndarray
rsoil_dry: ndarray
rsoil_wet: ndarray
smc: float
toolsrtm.marmit.marmit1(n, alpha, rd, L, eps)[source]

Wet-soil reflectance from a dry reference spectrum (MARMIT-1, Bablet et al. 2018).

Parameters:
  • n (spectral optical index of water (real refractive index).)

  • alpha (water absorption spectral coefficient, cm^-1.)

  • rd (reflectance of the dry soil reference.)

  • L (thickness of the surface water layer, cm.)

  • eps (fraction of the soil surface that is wet (0-1).)

Return type:

Wet soil reflectance, same shape as n/alpha/rd.

toolsrtm.marmit.marmit2(n_w, alpha_w, n_i, k_i, rd, L, eps, d_i, wls)[source]

Wet-soil reflectance from a dry reference spectrum (MARMIT-2, accounts for soil particle size/refractive index – generally more accurate than marmit1() for coarser soils).

Direct port of ToolsRTM::get.marmit2. Differs from marmit1() in two ways: the effective medium’s refractive index (n/k, hence the water-layer transmittance tw_diffuse) is a dielectric mixture of water (n_w/alpha_w) and soil particles (n_i/ k_i, weighted by the particle volume fraction d_i), not pure water optics; and the wet/dry mixing uses a power-law (Hapke-like) rule with exponent 1/2.27 instead of marmit1()’s linear mixing.

Parameters:
  • n_w (spectral optical index of water (real refractive index).)

  • alpha_w (water absorption spectral coefficient, cm^-1.)

  • n_i (real part of the soil particles' refractive index.)

  • k_i (imaginary part of the soil particles' refractive index.)

  • rd (reflectance of the dry soil reference.)

  • L (thickness of the surface water layer, cm.)

  • eps (fraction of the soil surface that is wet (0-1).)

  • d_i (particle volume fraction of the water/particle mixture.)

  • wls (wavelengths, nm (needed for the water absorption -> imaginary) – refractive index conversion, unlike marmit1()).

Return type:

Wet soil reflectance, same shape as n_w/alpha_w/rd/wls.

toolsrtm.marmit.sigmoid_soil(phi, k, a, psi)[source]

Soil moisture content (gravimetric %) from the wetness parameter phi = L*eps.

Parameters:
  • phi (float)

  • k (float)

  • a (float)

  • psi (float)

Return type:

float

toolsrtm.marmit.get_marmit_rsoil(soil_id=1, L=0.05, eps=0.3, version='marmit1', n_i=1.53, k_i=0.001, d_i=0.0005, wl_out=None, database='Bablet_2016', db_root=None)[source]

Build a canopy-model-ready soil reflectance spectrum from MARMIT-1 or MARMIT-2.

Python port of ToolsRTM::get.marmit.rsoil(). Only the Bablet_2016 soil database (17 IDs) is bundled with the package, to keep install size small. The other 7 MARMIT databases (Dupiau 2020, Humper 2015, Lesaignoux 2008, Liu 2002, Lobell 2002, Marcq 2012, Philpot 2014 – see https://pss-gitlab.math.univ-paris-diderot.fr/marmit/marmit) ship in the RTM-Suite monorepo’s own databases/ folder (repo root, ~200MB total, not bundled here either). Point at it directly with db_root, e.g. get_marmit_rsoil(database="Liu_2002", db_root="databases") run from the repo root – no copying required. Any other folder with the same layout (an index CSV <name>/<name>.csv with columns ID, Refl_file, SMCg, K, a, psi – extra columns ignored – plus <name>/spectra/<Refl_file> tab-separated Wvl,R files) works the same way. See that R function’s docstring for the physical background.

Parameters:
  • soil_id (soil ID within the database’s index (the ID column). For) – Bablet_2016, 1-17.

  • L (thickness of the surface water layer, cm.)

  • eps (fraction of the soil surface that is wet (0-1).)

  • version ({'marmit1', 'marmit2'}. MARMIT-2 additionally accounts for) – soil particle size/refractive index (n_i/k_i/d_i) and is generally more accurate for coarser soils; MARMIT-1 is simpler and matches the original 2018 paper.

  • n_i (MARMIT-2-only soil-particle parameters (real) – refractive index, imaginary refractive index, particle volume fraction). Ignored when version='marmit1'. Defaults match the MARMIT Shiny app’s defaults.

  • k_i (MARMIT-2-only soil-particle parameters (real) – refractive index, imaginary refractive index, particle volume fraction). Ignored when version='marmit1'. Defaults match the MARMIT Shiny app’s defaults.

  • d_i (MARMIT-2-only soil-particle parameters (real) – refractive index, imaginary refractive index, particle volume fraction). Ignored when version='marmit1'. Defaults match the MARMIT Shiny app’s defaults.

  • wl_out (wavelength grid (nm) to resample/pad onto. Defaults to) – np.arange(400, 2501) (400-2500nm, 1nm step), matching toolsrtm.canopy.foursail()’s default 2101-point grid.

  • database (soil database name. Default "Bablet_2016", the only one) – bundled with the package (ignored – always Bablet_2016 – unless db_root is given).

  • db_root (directory containing database subfolders (e.g. "databases") – at the RTM-Suite repo root, which has all 8 MARMIT databases – see above). When None (default), only the bundled Bablet_2016 database is available and database is ignored.

Return type:

MarmitSoil