atomica.cascade.get_cascade_data¶
- atomica.cascade.get_cascade_data(data, framework, cascade, pops=None, year=None)[source]¶
Get data values for a cascade
This function is the counterpart to
get_cascade_vals()
but it returns values from data rather than values from aResult
. Note that the inputs and outputs are slightly different - this function still needs the framework so that it can sanitize the requested cascade. Ifyear
is specified, the output is guaranteed to be the same size as the input year array, the same asget_cascade_vals()
. However, theget_cascade_vals()
defaults to all time points in the simulation output, whereas this function defaults to all data years. Thus, if the year is omitted, the returned time points may be different between the two functions. To make a plot superimposing data and model output, the year should be specified explicitly to ensure that the years match up.NB - In general, data probably will NOT exist Set the logging level to ‘DEBUG’ to have messages regarding this printed out
- Parameters:
data – A
ProjectData
instanceframework – A
ProjectFramework
instancecascade – A cascade representation supported by
sanitize_cascade()
pops – Supported population representation. Can be ‘all’, or a pop name, or a list of pop names, or a dict with one key
year – Optionally specify a subset of years to retrieve values for. Can be a scalar, list, or array. If
None
, all time points in theProjectData
instance will be used
- Returns:
A tuple with
(cascade_vals,t)
wherecascade_vals
is the form{stage_name:np.array}
andt
is anp.array
with the year values