ModelOutput

class psipy.model.base.ModelOutput(path)

Bases: abc.ABC

The results from a single model run.

This is a storage object that contains a number of Variable objects. It is not designed to be used directly, but must be sub-classed for different models.

Data is stored in the _data attribute. This is a mapping of variable names to xarray.DataArray variables. Each data array must have

  • Four dimensions

  • These dimensions must be labelled ['r', 'theta', 'phi', 'time']

  • The phi values must be latitude and not co-latitude (ie. must be in the range \([-\pi / 2, \pi / 2]\))

  • The theta values must be in the range \([0, 2\pi]\)

Parameters
path

Path to the directry containing the model output files.

Notes

Variables are loaded on demand. To see the list of available variables use ModelOutput.variables, and to see the list of already loaded variables use ModelOutput.loaded_variables.

Attributes Summary

loaded_variables

List of loaded variable names.

variables

List of all variable names present in the directory.

Methods Summary

get_unit(var)

Return the units for a variable, and the factor needed to convert from the model output to those units.

get_variables()

Returns

load_file(var)

Load data for variable var.

Attributes Documentation

loaded_variables

List of loaded variable names.

variables

List of all variable names present in the directory.

Methods Documentation

abstract get_unit(var)

Return the units for a variable, and the factor needed to convert from the model output to those units.

Returns
unitastropy.units.Unit
factorfloat
abstract get_variables()
Returns
list

A list of all variable names present in the directory.

abstract load_file(var)

Load data for variable var.