Parameter Sweeps
The parameter_sweep() function runs the model over the Cartesian product of any supported input parameters and returns a pandas DataFrame. This is useful for sensitivity analysis, look-up table generation, and exploring how albedo responds to changing conditions.
Basic usage
from biosnicar.drivers.sweep import parameter_sweep
df = parameter_sweep(
params={
"solzen": [30, 40, 50, 60, 70],
"rds": [100, 200, 500, 1000],
}
)
print(df[["solzen", "rds", "BBA"]])Impurity sweeps
df = parameter_sweep(
params={"black_carbon": [0, 1000, 10000]}
)
print(df[["black_carbon", "BBA"]])Including spectral output
By default, the sweep returns broadband values. To include the full 480-band spectral albedo:
df = parameter_sweep(
params={"rds": [500, 1000, 2000]},
return_spectral=True,
)Chaining to satellite bands
The sweep result supports .to_platform() to append band and index columns:
df = parameter_sweep(
params={"rds": [500, 1000], "solzen": [50, 60]},
).to_platform("sentinel2")
print(df[["rds", "solzen", "BBA", "B3", "NDSI"]])Multi-platform comparison:
df = parameter_sweep(
params={"rds": [500, 1000]},
).to_platform("sentinel2", "landsat8", "modis")
print(df[["rds", "sentinel2_NDSI", "landsat8_NDSI", "modis_NDSI"]])Pivot tables for analysis
df = parameter_sweep(
params={
"solzen": [30, 40, 50, 60, 70],
"rds": [100, 200, 500, 1000],
}
)
df.pivot_table(values="BBA", index="solzen", columns="rds").plot()Options
| Parameter | Type | Default | Description |
|---|---|---|---|
params | dict | required | {name: [values]} for each parameter to sweep |
solver | str | "adding-doubling" | "adding-doubling" or "toon" |
return_spectral | bool | False | Include 480-band spectral albedo in output |
progress | bool | True | Show tqdm progress bar |
Supported parameter keys: solzen, direct, incoming, rds, rho, dz, layer_type, and impurity names.