model.parameterization.pft_lookup

Override rules

  • Parameters whose resolved source is pft_based use the LUT.

  • Data-provided parameters and explicit parameterization entries exclude the same parameter from LUT-based lookup.

PFT-based lookup-table parameterization for ADELM.

The canonical per-PFT values live in PFT_LOOKUP.txt (same directory), formatted as a tab-separated table:

- Column 1 : parameter name
- Column 2 : units (informational only)
- Columns 3+: one column per PFT, named by the header row

PFTBasedParams reads the table at import time, then at runtime computes effective parameter values as a PFT-fraction-weighted average:

param_eff[location] = sum_i( pft_fraction[location, i] * lut_value[i] )

Module Contents

Classes

PFTBasedParams

PFT lookup-table parameterization.

Functions

load_pft_lut

Load a custom PFT lookup table and return (pft_names, lut).

get_pft_values

Return an ordered list of LUT values for param_name.

API

model.parameterization.pft_lookup.load_pft_lut(path) tuple[list[str], dict[str, dict[str, float]]]

Load a custom PFT lookup table and return (pft_names, lut).

The file must follow the same tab-separated format as the built-in PFT_LOOKUP.txt. Call this when config.data.resources.pft_lut_path is set.

Parameters:

path (str or Path)

Returns:

Same structure as the module-level PFT_NAMES and PFT_LUT.

Return type:

pft_names, lut

model.parameterization.pft_lookup.get_pft_values(param_name: str, pft_names: list[str]) list[float]

Return an ordered list of LUT values for param_name.

Parameters:
  • param_name (str) – Must be a key in PFT_LUT.

  • pft_names (list[str]) – Ordered PFT names matching attris["pft_fraction"] columns. Every name must appear as a column in PFT_LOOKUP.txt.

Return type:

list[float]

Raises:

KeyError – If param_name is not in the table or a PFT name is unknown.

class model.parameterization.pft_lookup.PFTBasedParams(lut: dict[str, dict[str, float]], active_params: list[str])

PFT lookup-table parameterization.

Given entity-level PFT area fractions (attris["pft_fraction"], shape [n_entities, n_pfts]) and a fixed per-PFT lookup table loaded from pft_lut.txt, computes effective parameter values as a PFT-fraction-weighted average.

Parameters

pft_lut : dict[str, list[float]] Mapping of parameter name to a list of per-PFT values. The list order must match the column order declared in config.pft.pft_names.

Examples

pft_params = PFTBasedParams.from_runtime_config(config) updates = pft_params(attris) # attris[“pft_fraction”]: [n_entities, n_pfts] updates[“canopy_height”] # Tensor of shape [n_entities]

Initialization

classmethod from_runtime_config(config)

Build a PFTBasedParams instance from the LUT and runtime config.

PFT names and their column order are not taken from config; they are read from attris["pft_names"] at call time, after the attris data have been loaded from the NetCDF file.

This method only resolves:

  • Which lookup table to use (built-in or custom pft_lut_path).

  • Which parameters are overridden by config and therefore excluded from LUT-based lookup.

Returns None when all pft_based parameters are overridden in config (i.e. the LUT would be a no-op).

Parameters

config : RuntimeConfig

Returns

PFTBasedParams or None

__call__(fcover: dict) dict[str, torch.Tensor]

Compute effective parameter values from site PFT cover fractions.

Parameters

fcover : dict[str, Tensor[n_entities]] Fractional land cover per PFT. Keys are PFT names (e.g. "PFT_TREES-NE"); values are [n_entities] tensors. Values may be in percent (summing to ~100) or fraction (summing to ~1); the weighted average is the same either way.

Returns

dict[str, torch.Tensor] Mapping of parameter name to a tensor of shape [n_entities].