core.CCOutput

core.CCOutput(
    time,
    state_variables,
    state_variable_names,
    diagnostic_variables,
    solution,
    run_name,
)

Container for the results of one call to CCModel.integrate().

CCOutput carries the full trajectory produced by the solver and exposes output-focused operations (noise addition, pyleoclim export, time resampling). Keeping these on the output rather than on the model means a single model instance can produce multiple independent outputs without them overwriting each other.

Attributes

model_time : ndarray of float

Raw time axis as returned by the solver. Never modified after construction; inspect this to understand the solver’s actual grid.

time : ndarray of float

User-facing time axis. Starts equal to model_time; replaced by reframe_time_axis when a different grid is requested. state_variables is always aligned to time.

state_variables : structured ndarray

Named state variable arrays, indexed by variable name.

state_variable_names : list of str

Ordered list of state variable names.

diagnostic_variables : dict of str → ndarray

Named diagnostic arrays.

solution : object

Raw solver output (retained for dense-output resampling via reframe_time_axis).

run_name : str

Label for this integration run.

Methods

Name Description
add_noise Add externally provided noise to an output variable.
get_series_by_name Return a variable’s array and its storage location.
reframe_time_axis Resample state variables onto a new time axis.
remove_noise Restore a variable to its pre-noise values.
to_pyleo Export one or more variables as pyleoclim Series objects.

add_noise

core.CCOutput.add_noise(var_name, noise_ts)

Add externally provided noise to an output variable.

The unmodified values are saved on the first call so that remove_noise can restore the clean series.

Parameters

var_name : str

Name of a state or diagnostic variable.

noise_ts : array - like

Noise series with the same shape as the target variable.

get_series_by_name

core.CCOutput.get_series_by_name(var_name)

Return a variable’s array and its storage location.

State variables live in a structured numpy array; diagnostic variables live in a dict. Returning the location string lets callers that write back (e.g. add_noise) know which container to update.

Returns

values : ndarray of float
location : {'state', 'diagnostic'}

reframe_time_axis

core.CCOutput.reframe_time_axis(t_eval)

Resample state variables onto a new time axis.

Uses the dense output from solve_ivp when available (accurate polynomial interpolation); falls back to linear interpolation for fixed-step solvers.

After this call, time is replaced by t_eval and state_variables is replaced by the interpolated values. model_time is never modified and always reflects the solver’s original grid.

Parameters

t_eval : array - like

Target time axis.

Returns

reframed : structured ndarray or ndarray

Resampled state variables on t_eval.

remove_noise

core.CCOutput.remove_noise(var_name)

Restore a variable to its pre-noise values.

Reverses add_noise by replacing the noisy array with the clean copy saved on the first add_noise call.

to_pyleo

core.CCOutput.to_pyleo(var_names=None)

Export one or more variables as pyleoclim Series objects.

Parameters

var_names : str or list of str = None

Name(s) of state or diagnostic variable(s) to export.

Returns

: pyleoclim.Series or pyleoclim.MultipleSeries