Cumulative Flux Visualization

Cumulative time series plots showing running totals across all time periods. Useful for tracking cumulative fluxes and total mass balance.

Best for: Cumulative flux budgets, total mass balance analysis

import diive as dv

Load and prepare data

df_orig = dv.load_exampledata_parquet()

# Convert units: umol CO2 m-2 s-1 --> g C m-2 30min-1
conversion_factor = 0.02161926
series_units = r'($\mathrm{gC\ m^{-2}}$)'

print(f"Loaded {len(df_orig)} records")
print(f"Unit conversion factor: {conversion_factor}")
  > Loaded .parquet file
/home/docs/checkouts/diive/checkouts/latest/diive/configs/exampledata/exampledat
a_PARQUET_CH-DAV_FP2022.5_2013-2022_ID20230206154316_30MIN.parquet (0.050
seconds).
Loaded 175296 records
Unit conversion factor: 0.02161926

Cumulative flux across all years

Plot cumulative totals for multiple USTAR filtering scenarios. Shows how cumulative flux diverges between conservative and generous thresholds.

Chrome (title and font sizes) is described once with a FormatStyle and passed via format_style=. The data units stay on the Cumulative constructor (they belong to the series, not to the shared style), and the colorbar-free line styling stays on the constructor/plot call.

df_cum = df_orig[['NEE_CUT_16_f', 'NEE_CUT_REF_f', 'NEE_CUT_84_f']].copy()
df_cum = df_cum.multiply(conversion_factor)

style = dv.plotting.FormatStyle(
    title='Cumulative NEE by USTAR scenario (2015-2019)',
    axlabel_fontsize=12,
)

dv.plotting.Cumulative(
    df=df_cum,
    units=series_units,
    start_year=2015,
    end_year=2019
).plot(format_style=style)

print("\nPlotted cumulative flux comparing USTAR filtering scenarios")
print("USTAR scenarios: CUT_16 (conservative), CUT_REF (reference), CUT_84 (generous)")
Cumulatives (2015-01-01 00:15:00-2019-12-31 23:45:00)
Plotted cumulative flux comparing USTAR filtering scenarios
USTAR scenarios: CUT_16 (conservative), CUT_REF (reference), CUT_84 (generous)

Total running time of the script: (0 minutes 0.376 seconds)

Gallery generated by Sphinx-Gallery