Usage

To use MARBLE in a project:

import marble

MARBLE uses the Sympl framework. You can read more in the Sympl documentation. MARBLE comes with code examples, which can be accessed from your local installation or the MARBLE github repo.

Aliases

As of writing this documentation, one shortcoming of Sympl is the need to explicitly write the long name of any quantities that are accessed from a state dictionary in the run script or analysis code. This package adds some helper tools that avoid this requirement, by allowing you to refer to long names using aliases that you register at the top of your run script. This retains the benefit of having quantities explicitly defined, because anyone reading your code can look at the top where you register aliases to figure out what your short aliases mean.

For example:

import marble
import sympl

marble.register_alias('rt', 'total_water_mixing_ratio')
# or
# marble.register_alias_dict({'rt': 'total_water_mixing_ratio'})

state = {
    'total_water_mixing_ratio': sympl.DataArray(0., dims=[], attrs={'units': 'kg/kg'})
}

state = marble.AliasDict(state)
print(state['rt'])  # gets state['total_water_mixing_ratio']
marble.register_alias(alias, long_name)[source]
marble.register_alias_dict(alias_dict)[source]
class marble.AliasDict(*args, **kwargs)[source]

Initialization

State initialization is not performed by the MARBLE module, but we do give an example initialization code. To call the modules, you need to create a state that has all the required quantities with defined dimensions and units.

One thing to keep in mind, which we will discuss more below, is that MARBLE runs using principal components of its vertically-resolved quantities. Those principal components are pre-defined, and assume that their height-resolved inputs are on a 3km, 20-point equidistant grid with points at 0km and 3km.

Decomposition

As we just said, MARBLE runs using principal components of its vertically-resolved quantities. Those principal components are pre-defined, and assume that their height-resolved inputs are on a 3km, 20-point equidistant grid with points at 0km and 3km.

When MARBLE is run, it operates on principal components of vertically-resolved quantities. This means that before integration, the state needs to be converted into principal components, and after integration they need to be converted back to height coordinates before plotting or analysis.

To convert between height and principal components, we provide two helper functions that operate on one quantity at a time, and three Sympl components which operate on commonly-grouped quantities.

marble.convert_height_to_principal_components(array, basis_name, subtract_mean=True)[source]

Converts a numpy array from height coordinates on a 20-point equidistant grid from 0 to 3km (inclusive) into principal components required by MARBLE.

Parameters:
  • array – numpy array whose final dimension is of size 20
  • basis_name – short alias name of the quantity whose principal components to use. For example, ‘rt’, ‘sl’, ‘cld’, ‘rcld’, ‘rrain’, or ‘w’.
  • subtract_mean – whether to subtract the mean vertical profile of the basis quantity from the numpy array before converting into principal components. Generally this is True if you are converting the basis quantity itself, and False if you are converting a difference to apply to the basis quantity (such as a tendency).
Returns:

numpy array whose final dimension length is equal to the

number of principal components used for hte basis quantity.

Return type:

return_array

marble.convert_principal_components_to_height(array, basis_name, add_mean=True)[source]

Converts a numpy array from principal components as used by MARBLE to height coordinates on a 20-point equidistant grid from 0 to 3km (inclusive).

Parameters:
  • array – numpy array whose final dimension is principal component number
  • basis_name – short alias name of the quantity whose principal components are used. For example, ‘rt’, ‘sl’, ‘cld’, ‘rcld’, ‘rrain’, or ‘w’.
  • add_mean – whether to add in the mean vertical profile of the basis quantity from the numpy array after converting to height coordinates. Generally this is True if you are converting the basis quantity itself, and False if you are converting a difference applied to the basis quantity (such as a tendency).
Returns:

numpy array whose final dimension length is 20.

Return type:

return_array

class marble.InputHeightToPrincipalComponents[source]
Converts MARBLE’s vertically-resolved inputs from height coordinates to principal components.

Input Properties:

liquid_water_static_energy:
alias: sl, dims: [‘*’, ‘z_star’], units: J/kg,
total_water_mixing_ratio:
alias: rt, dims: [‘*’, ‘z_star’], units: kg/kg,
vertical_wind:
alias: w, dims: [‘*’, ‘z_star’], units: m/s,

Diagnostic Properties:

liquid_water_static_energy_components:
alias: sl_latent, dims: [‘*’, ‘sl_latent’], units: ,
total_water_mixing_ratio_components:
alias: rt_latent, dims: [‘*’, ‘rt_latent’], units: ,
vertical_wind_components:
alias: w_latent, dims: [‘*’, ‘w_latent’], units: ,
class marble.InputPrincipalComponentsToHeight[source]
Converts MARBLE’s vertically-resolved inputs from principal components to height coordinates.

Input Properties:

liquid_water_static_energy_components:
alias: sl, dims: [‘*’, ‘sl_latent’], units: ,
total_water_mixing_ratio_components:
alias: rt, dims: [‘*’, ‘rt_latent’], units: ,
vertical_wind_components:
alias: w, dims: [‘*’, ‘w_latent’], units: ,

Diagnostic Properties:

liquid_water_static_energy:
alias: sl, dims: [‘*’, ‘z_star’], units: J/kg,
total_water_mixing_ratio:
alias: rt, dims: [‘*’, ‘z_star’], units: kg/kg,
vertical_wind:
alias: w, dims: [‘*’, ‘z_star’], units: m/s,
class marble.DiagnosticPrincipalComponentsToHeight[source]
Converts MARBLE’s vertically-resolved diagnostic outputs from principal components to height coordinates.

Input Properties:

cloud_water_mixing_ratio_components:
alias: rcld, dims: [‘*’, ‘rcld_latent’], units: ,
rain_water_mixing_ratio_components:
alias: rrain, dims: [‘*’, ‘rrain_latent’], units: ,
cloud_fraction_components:
alias: cld, dims: [‘*’, ‘cld_latent’], units: ,
clear_sky_radiative_heating_rate_components:
alias: sl_rad_clr, dims: [‘*’, ‘sl_latent’], units: hr^-1,

Diagnostic Properties:

cloud_water_mixing_ratio:
alias: rcld, dims: [‘*’, ‘z_star’], units: ,
rain_water_mixing_ratio:
alias: rrain, dims: [‘*’, ‘z_star’], units: ,
cloud_fraction:
alias: cld, dims: [‘*’, ‘z_star’], units: ,
clear_sky_radiative_heating_rate:
alias: sl_rad_clr, dims: [‘*’, ‘z_star’], units: degK hr^-1,

Forcing

We use an extremely simple component to apply horizontal advective forcings that are defined in the state as tendencies to the prognostic quantities. The horizontal advective forcings need to be defined in principal component space. This can be achieved using marble.convert_height_to_principal_components().

class marble.LatentHorizontalAdvectiveForcing(TendencyComponent)[source]

MARBLE component which applies advective forcings in latent space (inputs and outputs denormalized principal components) without converting to or from the real height coordinate.

Works by applying an advective tendency already loaded and specified in the model state.

MARBLE

MARBLE itself is contained in a TendencyComponent. Note that the surface latent and sensible heat fluxes should be expressed as downward values, as in the flux into the surface.

class marble.LatentMarble(tendencies_in_diagnostics=False, name=None)[source]
MARBLE component which works in latent space (inputs and outputs denormalized principal components) without converting to or from the real height coordinate.

Input Properties:

liquid_water_static_energy_components:
alias: sl, dims: [‘*’, ‘sl_latent’], units: ,
total_water_mixing_ratio_components:
alias: rt, dims: [‘*’, ‘rt_latent’], units: ,
vertical_wind_components:
alias: w, dims: [‘*’, ‘w_latent’], units: ,
liquid_water_static_energy_at_3km:
alias: sl_domain_top, dims: [‘*’], units: J/kg,
total_water_mixing_ratio_at_3km:
alias: rt_domain_top, dims: [‘*’], units: kg/kg,
surface_latent_heat_flux:
alias: lhf, dims: [‘*’], units: W/m^2,
surface_sensible_heat_flux:
alias: shf, dims: [‘*’], units: W/m^2,
surface_temperature:
alias: sst, dims: [‘*’], units: degK,
mid_cloud_fraction:
alias: cldmid, dims: [‘*’], units: ,
high_cloud_fraction:
alias: cldhigh, dims: [‘*’], units: ,
downwelling_shortwave_radiation_at_top_of_atmosphere:
alias: swdn_toa, dims: [‘*’], units: W/m^2,
downwelling_shortwave_radiation_at_3km:
alias: swdn_tod, dims: [‘*’], units: W/m^2,
surface_air_pressure:
alias: p_surface, dims: [‘*’], units: Pa,
rain_water_mixing_ratio_at_3km:
alias: rrain_domain_top, dims: [‘*’], units: kg/kg,

Diagnostic Properties:

cloud_water_mixing_ratio_components:
alias: rcld, dims: [‘*’, ‘rcld_latent’], units: ,
rain_water_mixing_ratio_components:
alias: rrain, dims: [‘*’, ‘rrain_latent’], units: ,
cloud_fraction_components:
alias: cld, dims: [‘*’, ‘cld_latent’], units: ,
clear_sky_radiative_heating_rate_components:
alias: sl_rad_clr, dims: [‘*’, ‘sl_latent’], units: hr^-1,
low_cloud_fraction:
alias: cldlow, dims: [‘*’], units: ,
surface_precipitation_rate:
alias: precip, dims: [‘*’], units: mm/hr,
column_cloud_water:
alias: ccw, dims: [‘*’], units: kg/m^2,
height:
alias: z, dims: [‘z_star’], units: m,

Tendency Properties:

liquid_water_static_energy_components:
alias: sl, dims: [‘*’, ‘sl_latent’], units: hr^-1,
total_water_mixing_ratio_components:
alias: rt, dims: [‘*’, ‘rt_latent’], units: hr^-1,