0.1.8
Loading...
Searching...
No Matches
pyhelios.StomatalConductance.StomatalConductanceModel Class Reference

High-level interface for stomatal conductance modeling and gas exchange calculations. More...

Detailed Description

High-level interface for stomatal conductance modeling and gas exchange calculations.

This class provides a user-friendly wrapper around the native Helios stomatal conductance plugin with automatic plugin availability checking and graceful error handling.

The stomatal conductance model implements five different stomatal response models:

  • BWB: Ball, Woodrow, Berry (1987) - original model
  • BBL: Ball, Berry, Leuning (1990, 1995) - includes VPD response
  • MOPT: Medlyn et al. (2011) - optimality-based model
  • BMF: Buckley, Mott, Farquhar - simplified mechanistic model
  • BB: Bailey - hydraulic-based model

The plugin includes a species library with pre-calibrated coefficients for common plant species (Almond, Apple, Avocado, Grape, Lemon, Olive, Walnut, etc.).

Both steady-state and dynamic (time-stepping) calculations are supported, with configurable time constants for stomatal opening and closing dynamics.

System requirements:

  • Cross-platform support (Windows, Linux, macOS)
  • No GPU required
  • No special dependencies
  • Stomatal conductance plugin compiled into PyHelios

Examples

>>> with Context() as context:
... # Add leaf geometry
... leaf_uuid = context.addPatch(center=[0, 0, 1], size=[0.1, 0.1])
...
... with StomatalConductanceModel(context) as stomatal:
... # Set model coefficients using species library
... stomatal.setBMFCoefficientsFromLibrary("Almond")
...
... # Run steady-state calculation
... stomatal.run()
...
... # Or run dynamic simulation with timestep
... stomatal.run(dt=60.0) # 60 second timestep
...
... # Set custom BMF coefficients for specific leaves
... bmf_coeffs = BMFCoefficients(Em=258.25, i0=38.65, k=232916.82, b=609.67)
... stomatal.setBMFCoefficients(bmf_coeffs, uuids=[leaf_uuid])

Definition at line 109 of file StomatalConductance.py.

Public Member Functions

 __init__ (self, Context context)
 Initialize StomatalConductanceModel with graceful plugin handling.
 
 __enter__ (self)
 Context manager entry.
 
 __exit__ (self, exc_type, exc_value, traceback)
 Context manager exit with proper cleanup.
 
 getNativePtr (self)
 Get the native pointer for advanced operations.
 
None enableMessages (self)
 Enable console output messages from the stomatal conductance model.
 
None disableMessages (self)
 Disable console output messages from the stomatal conductance model.
 
None run (self, Optional[List[int]] uuids=None, Optional[float] dt=None)
 Run the stomatal conductance model.
 
None setBWBCoefficients (self, BWBCoefficients coeffs, Optional[List[int]] uuids=None)
 Set Ball-Woodrow-Berry model coefficients.
 
None setBBLCoefficients (self, BBLCoefficients coeffs, Optional[List[int]] uuids=None)
 Set Ball-Berry-Leuning model coefficients.
 
None setMOPTCoefficients (self, MOPTCoefficients coeffs, Optional[List[int]] uuids=None)
 Set Medlyn et al.
 
None setBMFCoefficients (self, BMFCoefficients coeffs, Optional[List[int]] uuids=None)
 Set Buckley-Mott-Farquhar model coefficients.
 
None setBBCoefficients (self, BBCoefficients coeffs, Optional[List[int]] uuids=None)
 Set Bailey model coefficients.
 
None setBMFCoefficientsFromLibrary (self, str species, Optional[List[int]] uuids=None)
 Set BMF model coefficients using the built-in species library.
 
None setDynamicTimeConstants (self, float tau_open, float tau_close, Optional[List[int]] uuids=None)
 Set time constants for dynamic stomatal opening and closing.
 
None optionalOutputPrimitiveData (self, str label)
 Add optional output primitive data to the Context.
 
None printDefaultValueReport (self, Optional[List[int]] uuids=None)
 Print a report detailing usage of default input values.
 
bool is_available (self)
 Check if StomatalConductanceModel is available in current build.
 

Public Attributes

 context = context
 
 stomatal_model = None
 

Constructor & Destructor Documentation

◆ __init__()

pyhelios.StomatalConductance.StomatalConductanceModel.__init__ ( self,
Context context )

Initialize StomatalConductanceModel with graceful plugin handling.

Parameters
contextHelios Context instance
Exceptions
TypeErrorIf context is not a Context instance
StomatalConductanceModelErrorIf stomatal conductance plugin is not available

Definition at line 121 of file StomatalConductance.py.

Member Function Documentation

◆ __enter__()

pyhelios.StomatalConductance.StomatalConductanceModel.__enter__ ( self)

Context manager entry.

Definition at line 181 of file StomatalConductance.py.

◆ __exit__()

pyhelios.StomatalConductance.StomatalConductanceModel.__exit__ ( self,
exc_type,
exc_value,
traceback )

Context manager exit with proper cleanup.

Definition at line 185 of file StomatalConductance.py.

◆ disableMessages()

None pyhelios.StomatalConductance.StomatalConductanceModel.disableMessages ( self)

Disable console output messages from the stomatal conductance model.

Exceptions
StomatalConductanceModelErrorIf operation fails

Definition at line 217 of file StomatalConductance.py.

◆ enableMessages()

None pyhelios.StomatalConductance.StomatalConductanceModel.enableMessages ( self)

Enable console output messages from the stomatal conductance model.

Exceptions
StomatalConductanceModelErrorIf operation fails

Definition at line 205 of file StomatalConductance.py.

◆ getNativePtr()

pyhelios.StomatalConductance.StomatalConductanceModel.getNativePtr ( self)

Get the native pointer for advanced operations.

Definition at line 196 of file StomatalConductance.py.

◆ is_available()

bool pyhelios.StomatalConductance.StomatalConductanceModel.is_available ( self)

Check if StomatalConductanceModel is available in current build.

Returns
True if plugin is available, False otherwise

Definition at line 595 of file StomatalConductance.py.

◆ optionalOutputPrimitiveData()

None pyhelios.StomatalConductance.StomatalConductanceModel.optionalOutputPrimitiveData ( self,
str label )

Add optional output primitive data to the Context.

Parameters
labelName of primitive data to output (e.g., "Ci", "gs", "E")
Exceptions
ValueErrorIf label is invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> # Output stomatal conductance values
>>> stomatal.optionalOutputPrimitiveData("gs")
>>> # Output intercellular CO2 concentration
>>> stomatal.optionalOutputPrimitiveData("Ci")

Definition at line 553 of file StomatalConductance.py.

◆ printDefaultValueReport()

None pyhelios.StomatalConductance.StomatalConductanceModel.printDefaultValueReport ( self,
Optional[List[int]] uuids = None )

Print a report detailing usage of default input values.

Parameters
uuidsOptional list of primitive UUIDs. If None, reports on all primitives.
Exceptions
StomatalConductanceModelErrorIf operation fails

Examples

>>> # Print report for all primitives
>>> stomatal.printDefaultValueReport()
>>> # Print report for specific leaves
>>> stomatal.printDefaultValueReport(uuids=[leaf1_uuid, leaf2_uuid])

Definition at line 580 of file StomatalConductance.py.

◆ run()

None pyhelios.StomatalConductance.StomatalConductanceModel.run ( self,
Optional[List[int]] uuids = None,
Optional[float] dt = None )

Run the stomatal conductance model.

   This method supports multiple execution modes:
   - Steady state for all primitives: run()
   - Dynamic with timestep for all primitives: run(dt=60.0)
   - Steady state for specific primitives: run(uuids=[1, 2, 3])
   - Dynamic with timestep for specific primitives: run(uuids=[1, 2, 3], dt=60.0)
Parameters
uuidsOptional list of primitive UUIDs to process. If None, processes all primitives.
dtOptional timestep in seconds for dynamic simulation. If None, runs steady-state.
Exceptions
ValueErrorIf parameters are invalid
StomatalConductanceModelErrorIf calculation fails

Examples

>>> # Steady state for all primitives
>>> stomatal.run()
>>> # Dynamic simulation with 60-second timestep
>>> stomatal.run(dt=60.0)
>>> # Steady state for specific leaves
>>> stomatal.run(uuids=[leaf1_uuid, leaf2_uuid])
>>> # Dynamic simulation for specific leaves
>>> stomatal.run(uuids=[leaf1_uuid, leaf2_uuid], dt=30.0)

Definition at line 255 of file StomatalConductance.py.

◆ setBBCoefficients()

None pyhelios.StomatalConductance.StomatalConductanceModel.setBBCoefficients ( self,
BBCoefficients coeffs,
Optional[List[int]] uuids = None )

Set Bailey model coefficients.

Parameters
coeffsBB model coefficients (pi_0, pi_m, theta, sigma, chi)
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf coefficients are invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> bb_coeffs = BBCoefficients(pi_0=1.0, pi_m=1.67, theta=211.22, sigma=0.4408, chi=2.076)
>>> stomatal.setBBCoefficients(bb_coeffs)

Definition at line 433 of file StomatalConductance.py.

◆ setBBLCoefficients()

None pyhelios.StomatalConductance.StomatalConductanceModel.setBBLCoefficients ( self,
BBLCoefficients coeffs,
Optional[List[int]] uuids = None )

Set Ball-Berry-Leuning model coefficients.

Parameters
coeffsBBL model coefficients (gs0, a1, D0)
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf coefficients are invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> bbl_coeffs = BBLCoefficients(gs0=0.0743, a1=4.265, D0=14570.0)
>>> stomatal.setBBLCoefficients(bbl_coeffs)

Definition at line 325 of file StomatalConductance.py.

◆ setBMFCoefficients()

None pyhelios.StomatalConductance.StomatalConductanceModel.setBMFCoefficients ( self,
BMFCoefficients coeffs,
Optional[List[int]] uuids = None )

Set Buckley-Mott-Farquhar model coefficients.

Parameters
coeffsBMF model coefficients (Em, i0, k, b)
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf coefficients are invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> bmf_coeffs = BMFCoefficients(Em=258.25, i0=38.65, k=232916.82, b=609.67)
>>> stomatal.setBMFCoefficients(bmf_coeffs)

Definition at line 395 of file StomatalConductance.py.

◆ setBMFCoefficientsFromLibrary()

None pyhelios.StomatalConductance.StomatalConductanceModel.setBMFCoefficientsFromLibrary ( self,
str species,
Optional[List[int]] uuids = None )

Set BMF model coefficients using the built-in species library.

Parameters
speciesSpecies name from the library (e.g., "Almond", "Apple", "Grape", "Walnut")
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf species name is invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> # Set coefficients for almond tree
>>> stomatal.setBMFCoefficientsFromLibrary("Almond")
>>> # Set coefficients for specific leaves only
>>> stomatal.setBMFCoefficientsFromLibrary("Grape", uuids=[leaf1_uuid, leaf2_uuid])

Definition at line 476 of file StomatalConductance.py.

◆ setBWBCoefficients()

None pyhelios.StomatalConductance.StomatalConductanceModel.setBWBCoefficients ( self,
BWBCoefficients coeffs,
Optional[List[int]] uuids = None )

Set Ball-Woodrow-Berry model coefficients.

Parameters
coeffsBWB model coefficients (gs0, a1)
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf coefficients are invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> bwb_coeffs = BWBCoefficients(gs0=0.0733, a1=9.422)
>>> stomatal.setBWBCoefficients(bwb_coeffs)

Definition at line 291 of file StomatalConductance.py.

◆ setDynamicTimeConstants()

None pyhelios.StomatalConductance.StomatalConductanceModel.setDynamicTimeConstants ( self,
float tau_open,
float tau_close,
Optional[List[int]] uuids = None )

Set time constants for dynamic stomatal opening and closing.

Parameters
tau_openTime constant (seconds) for stomatal opening
tau_closeTime constant (seconds) for stomatal closing
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf time constants are invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> # Set time constants for all leaves
>>> stomatal.setDynamicTimeConstants(tau_open=120.0, tau_close=240.0)
>>> # Set different time constants for specific leaves
>>> stomatal.setDynamicTimeConstants(tau_open=60.0, tau_close=180.0, uuids=[leaf1_uuid])

Definition at line 519 of file StomatalConductance.py.

◆ setMOPTCoefficients()

None pyhelios.StomatalConductance.StomatalConductanceModel.setMOPTCoefficients ( self,
MOPTCoefficients coeffs,
Optional[List[int]] uuids = None )

Set Medlyn et al.

optimality model coefficients.

Parameters
coeffsMOPT model coefficients (gs0, g1)
uuidsOptional list of primitive UUIDs. If None, applies to all primitives.
Exceptions
ValueErrorIf coefficients are invalid
StomatalConductanceModelErrorIf operation fails

Examples

>>> mopt_coeffs = MOPTCoefficients(gs0=0.0825, g1=2.637)
>>> stomatal.setMOPTCoefficients(mopt_coeffs)

Definition at line 361 of file StomatalConductance.py.

Member Data Documentation

◆ context

pyhelios.StomatalConductance.StomatalConductanceModel.context = context

Definition at line 128 of file StomatalConductance.py.

◆ stomatal_model

pyhelios.StomatalConductance.StomatalConductanceModel.stomatal_model = None

Definition at line 129 of file StomatalConductance.py.


The documentation for this class was generated from the following file: