Python Output Thermodynamics Module

class libs.thermo.output_thermodynamics.OutputVariable(name, units, shape)[source]

Bases: object

Class to output a variable with some of its metadata.

Attributes:
name (string):

Name of variable.

units (string):

Units of variable.

values (np.ndarray):

Values of variable; must be able to be appended to.

finalize()[source]

Convert values to a NumPy array.

set(val)[source]

Copy values ‘val’ to the entire array.

Parameters:

val (any): Value(s) of array.

write(val)[source]

Copy values ‘val’ to the array in slice along its first dimension.

Parameters:

val (any): Value(s) to append.

class libs.thermo.output_thermodynamics.OutputThermodynamics(shape, zhalf=None, xhalf=None, yhalf=None)[source]

Bases: object

Class is method and store for thermodynamic variables output during model timestep.

Thermodynamic variables include pressure, temperature, moist air density and the specific content (mass mixing ratio) of vapour and condensates.

Attributes:
time (OutputVariable):

time (s).

temp (OutputVariable):

Temperature (K).

rho (OutputVariable):

Density of moist air (kg/m3).

press (OutputVariable):

Pressure (Pa).

qvap (OutputVariable):

Specific water vapor content (kg/kg).

qcond (OutputVariable):

Specific cloud water content (kg/kg).

qice (OutputVariable):

Specific cloud ice content (kg/kg).

qrain (OutputVariable):

Specific rain content (kg/kg).

qsnow (OutputVariable):

Specific snow content kg/kg).

qgrau (OutputVariable):

Specific graupel content (kg/kg).

finalize()[source]

Finalize the thermodynamics output.

This method finalizes the output of thermodynamic variables by calling the finalize method of each output variable, e.g. to ensure that all variables are properly formatted for further use or analysis.

Returns:

None

output_thermodynamics(time: float, thermo: Thermodynamics)[source]

output thermodynamics from thermo to each variable in thermodynamics output.

This method writes time and thermodynamic variables from thermo such as temperature, density, pressure, and specific mass mixing ratios to the respective output variables.

Parameters:
time (float):

The time at which the thermodynamic variables are output (s).

thermo (Thermodynamics):

An instance of the Thermodynamics class containing the thermodynamic variables to output.

Returns:

None