esmvaltool/preprocessor/_derive.py
def calc_toz(cubes):
    """Compute total column ozone from ozone mol fraction on pressure levels.

    The surface pressure is used as a lower integration bound. A fixed upper
    integration bound of 0 Pa is used.

    @R. Checa-Garcia: this could be update to calculate also tropospheric
    ozone column or stratospheric ozone column. The last one will just took
    the tropopause pressure instead of the surface_air_pressure. I have added
    two new function named calc_tropoz and calc_straoz, but formally all
    could be one single function with an extra argument indicating with is the
    desired case.

    Arguments
    ---------
        cubes: cubelist containing tro3_cube (mole_fraction_of_ozone_in_air)
               and ps_cube (surface_air_pressure).

    Returns
    -------
        Cube containing total column ozone.

    """
    tro3_cube = cubes.extract_strict(
        Constraint(name='mole_fraction_of_ozone_in_air'))
    ps_cube = cubes.extract_strict(Constraint(name='surface_air_pressure'))

    p_layer_widths = _pressure_level_widths(tro3_cube, ps_cube, top_limit=0)


    #==========================================================================
    # toz = (tro3_cube * p_layer_widths
    #       / g_cte.value * mw_O3_cte.value
    #       / mw_air_cte.value)
    # toz = toz.collapsed('air_pressure', iris.analysis.SUM)
    # toz.units = (tro3_cube.units * p_layer_widths.units
    #             / g_cte.units * mw_O3_cte.units
    #             / mw_air_cte.units)
    # Convert from kg m^-2 to Dobson unit (2.69e20 m^-2 )
    # toz = toz / mw_O3_cte.value * avo_cte.value
    # toz.units = toz.units / mw_O3_cte.units * avo_cte.units
    # toz.convert_units(DU_cte.units)
    #==========================================================================

    toz = tro3_cube * p_layer_widths / g * mw_O3 / mw_air
    toz = toz.collapsed('air_pressure', iris.analysis.SUM)
    toz.units = (tro3_cube.units * p_layer_widths.units / g_unit * mw_O3_unit /
                 mw_air_unit)
    toz = toz / mw_O3 * Avogadro_const
    toz.units = toz.units / mw_O3_unit * Avogadro_const_unit
    toz.convert_units(Dobson_unit)

    toz.data = np.ma.array(toz.data, dtype=np.dtype('float32'))
    toz.var_name = 'toz'
    toz.standard_name='equivalent_thickness_at_stp_of_atmosphere_ozone_content'
    #toz.standard_name='total_ozone_column'
    toz.long_name='Total Ozone Column'

    return toz
Compute total column ozone from ozone mol fraction on pressure levels.

    The surface pressure is used as a lower integration bound. A fixed upper
    integration bound of 0 Pa is used.

    @R. Checa-Garcia: this could be update to calculate also tropospheric
    ozone column or stratospheric ozone column. The last one will just took
    the tropopause pressure instead of the surface_air_pressure. I have added
    two new function named calc_tropoz and calc_straoz, but formally all
    could be one single function with an extra argument indicating with is the
    desired case.

    Arguments
    ---------
        cubes: cubelist containing tro3_cube (mole_fraction_of_ozone_in_air)
               and ps_cube (surface_air_pressure).

    Returns
    -------
        Cube containing total column ozone.

    
Compute total column ozone from ozone mol fraction on pressure levels.
The surface pressure is used as a lower integration bound. A fixed upper
integration bound of 0 Pa is used.
Compute total column ozone from ozone mol fraction on pressure levels . The surface pressure is used as a lower integration bound . A fixed upper integration bound of 0 Pa is used .
def calc_toz(cubes):
    tro3_cube = cubes.extract_strict(
        Constraint(name='mole_fraction_of_ozone_in_air'))
    ps_cube = cubes.extract_strict(Constraint(name='surface_air_pressure'))
    p_layer_widths = _pressure_level_widths(tro3_cube, ps_cube, top_limit=0)
    toz = tro3_cube * p_layer_widths / g * mw_O3 / mw_air
    toz = toz.collapsed('air_pressure', iris.analysis.SUM)
    toz.units = (tro3_cube.units * p_layer_widths.units / g_unit * mw_O3_unit /
                 mw_air_unit)
    toz = toz / mw_O3 * Avogadro_const
    toz.units = toz.units / mw_O3_unit * Avogadro_const_unit
    toz.convert_units(Dobson_unit)
    toz.data = np.ma.array(toz.data, dtype=np.dtype('float32'))
    toz.var_name = 'toz'
    toz.standard_name='equivalent_thickness_at_stp_of_atmosphere_ozone_content'
    toz.long_name='Total Ozone Column'
    return toz
def calc_toz ( cubes ) : tro3_cube = cubes . extract_strict ( Constraint ( name = 'mole_fraction_of_ozone_in_air' ) ) ps_cube = cubes . extract_strict ( Constraint ( name = 'surface_air_pressure' ) ) p_layer_widths = _pressure_level_widths ( tro3_cube , ps_cube , top_limit = 0 ) toz = tro3_cube * p_layer_widths / g * mw_O3 / mw_air toz = toz . collapsed ( 'air_pressure' , iris . analysis . SUM ) toz . units = ( tro3_cube . units * p_layer_widths . units / g_unit * mw_O3_unit / mw_air_unit ) toz = toz / mw_O3 * Avogadro_const toz . units = toz . units / mw_O3_unit * Avogadro_const_unit toz . convert_units ( Dobson_unit ) toz . data = np . ma . array ( toz . data , dtype = np . dtype ( 'float32' ) ) toz . var_name = 'toz' toz . standard_name = 'equivalent_thickness_at_stp_of_atmosphere_ozone_content' toz . long_name = 'Total Ozone Column' return toz
Compute total column ozone from ozone mol fraction on pressure levels.
Compute total column ozone from ozone mol fraction on pressure levels .
"""Compute total column ozone from ozone mol fraction on pressure levels.

    The surface pressure is used as a lower integration bound. A fixed upper
    integration bound of 0 Pa is used.

    @R. Checa-Garcia: this could be update to calculate also tropospheric
    ozone column or stratospheric ozone column. The last one will just took
    the tropopause pressure instead of the surface_air_pressure. I have added
    two new function named calc_tropoz and calc_straoz, but formally all
    could be one single function with an extra argument indicating with is the
    desired case.

    Arguments
    ---------
        cubes: cubelist containing tro3_cube (mole_fraction_of_ozone_in_air)
               and ps_cube (surface_air_pressure).

    Returns
    -------
        Cube containing total column ozone.

    """ #========================================================================== # toz = (tro3_cube * p_layer_widths #       / g_cte.value * mw_O3_cte.value #       / mw_air_cte.value) # toz = toz.collapsed('air_pressure', iris.analysis.SUM) # toz.units = (tro3_cube.units * p_layer_widths.units #             / g_cte.units * mw_O3_cte.units #             / mw_air_cte.units) # Convert from kg m^-2 to Dobson unit (2.69e20 m^-2 ) # toz = toz / mw_O3_cte.value * avo_cte.value # toz.units = toz.units / mw_O3_cte.units * avo_cte.units # toz.convert_units(DU_cte.units) #========================================================================== #toz.standard_name='total_ozone_column'
cubes
Garcia
this could be update to calculate also tropospheric
ozone column or stratospheric ozone column. The last one will just took
the tropopause pressure instead of the surface_air_pressure. I have added
two new function named calc_tropoz and calc_straoz, but formally all
could be one single function with an extra argument indicating with is the
desired case.

Arguments

cubelist containing tro3_cube (mole_fraction_of_ozone_in_air)
and ps_cube (surface_air_pressure).

Returns

Cube containing total column ozone.
this could be update to calculate also tropospheric ozone column or stratospheric ozone column . The last one will just took the tropopause pressure instead of the surface_air_pressure . I have added two new function named calc_tropoz and calc_straoz but formally all could be one single function with an extra argument indicating with is the desired case . Arguments cubelist containing tro3_cube ( mole_fraction_of_ozone_in_air ) and ps_cube ( surface_air_pressure ) . Returns Cube containing total column ozone .