dycove.sim.outputs.OutputManager
- class dycove.sim.outputs.OutputManager(engine, save_freq=1, save_mort=True)[source]
For saving
VegCohortinstances to output files.Methods
__init__(engine[, save_freq, save_mort])cohort_indexing(year, ets)Log the year/ets combo and create (or append to) list for cohort file names
reconcile_vegetation_output(simstate)Merge vegetation outputs across MPI subdomains into single files.
save_cohort_index()save_netcdf(directory, filename, data[, ...])Save dict-like data as a NetCDF file using xarray
save_simulation_metadata(simstate)Save record of ecological time inputs for easier post-processing
save_vegetation_step(simstate, vts)Save vegetation cohort state for a given ecological timestep
Update file count for each cohort based on current number of cohorts.
- cohort_indexing(year, ets)[source]
Log the year/ets combo and create (or append to) list for cohort file names
- reconcile_vegetation_output(simstate)[source]
Merge vegetation outputs across MPI subdomains into single files.
We want one output file per cohort, per ecological timestep.
This executes on main processor only and can take a while for giant domains.
Method is part of the engine class because it uses domain-specific info to re-map files, but we should keep this access point in OutputManager for now because we may add other similar tasks here later (and b/c it involves I/O and directory access).
- save_netcdf(directory: Path, filename: str, data: dict, eco_year: int | None = None, ets: int | None = None, cohort_id: int | None = None, saved_attrs: dict | None = None)[source]
Save dict-like data as a NetCDF file using xarray
- save_simulation_metadata(simstate)[source]
Save record of ecological time inputs for easier post-processing