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 a Result. Note that the inputs and outputs are slightly different - this function still needs the framework so that it can sanitize the requested cascade. If year is specified, the output is guaranteed to be the same size as the input year array, the same as get_cascade_vals(). However, the get_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 instance

  • framework – A ProjectFramework instance

  • cascade – 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 the ProjectData instance will be used

Returns:

A tuple with (cascade_vals,t) where cascade_vals is the form {stage_name:np.array} and t is a np.array with the year values