hypso.processing.l2b#

L2A to L2B: geophysical products in their own files.

An L2B product holds products derived from one L2A product, one group per file (hypso.io.naming.L2B_GROUPS), as PACE OCI’s suites: BGC holds chlorophyll-a and suspended matter, IOP absorption, scattering, backscattering and Kd. Like PACE’s OC_AOP suite, the L2A keeps Rrs and the AC tool’s aerosol optical depth. An L2B file has 2D variables only, no band cube; per-wavelength quantities are separate variables (aph_443, bbp_443), as in NASA’s OC_IOP files. It keeps the L2A’s geometry, pixel_flags, grid and metadata, so it can be regridded, windowed and read by Satpy like any other level. File names: ...L2B.<GROUP>.<source>.nc, where the source is the algorithm (e.g. oc4) or the AC tool whose own product it is (e.g. polymer). An OC-SMART run thus writes L2A.RRS (Rrs, aod), L2B.BGC, L2B.IOP and L2A.AUX.

The AC tool’s other per-band outputs (OC-SMART’s Lt, Lr, Lrc, Lwp, tg_sol, tg_sen, …) go to another file next to the L2A, ...L2A.AUX.<method>.nc (split_intermediates()), built the same way: 2D variables only, one per quantity and band (Lt_434), with the L2A’s geometry and flags.

Functions#

derive(tree, group[, algorithm])

An L2B tree from one of the package's algorithms on an L2A.

make_l2b(tree, group, source, variables[, parameters])

An L2B tree from an L2A tree and the derived variables.

split_intermediates(tree)

Separate an L2A's AC-tool intermediates (its other per-band outputs).

split_tool_products(tree)

Separate an L2A's AC-tool products from its reflectance.

tool_product_group(name)

The L2B group of an AC tool's variable (e.g. "chla" -> "BGC"),

Module Contents#

hypso.processing.l2b.derive(tree, group, algorithm=None)[source]#

An L2B tree from one of the package’s algorithms on an L2A.

Parameters:
  • tree (xarray.DataTree) – An L2A tree; most algorithms need Rrs (L2A.RRS.*).

  • group (str) – L2B group, "BGC" or "IOP".

  • algorithm (str, optional) – See hypso.processing.l2b_algorithms.ALGORITHMS; default the group’s default (BGC: "oci", IOP: "qaa").

Returns:

...L2B.<group>.<algorithm>.

Return type:

xarray.DataTree

hypso.processing.l2b.make_l2b(tree, group, source, variables, parameters=None)[source]#

An L2B tree from an L2A tree and the derived variables.

Parameters:
  • tree (xarray.DataTree) – The L2A product the variables were derived from.

  • group (str) – Product group, a key of hypso.io.naming.L2B_GROUPS.

  • source (str) – Algorithm or tool, e.g. "oc4" or "polymer" (a file-name token).

  • variables (dict) – {name: xarray.DataArray or (array, attrs)}, each of the product’s spatial shape; attributes should include units and long_name.

  • parameters (dict, optional) – Recorded in the l2b_<group>_<source> provenance step.

Return type:

xarray.DataTree

hypso.processing.l2b.split_intermediates(tree)[source]#

Separate an L2A’s AC-tool intermediates (its other per-band outputs).

Parameters:

tree (xarray.DataTree) – An L2A tree from hypso.processing.correct_atmosphere(); the intermediates are its hypso.io.product.INTERMEDIATES_NODE child (2D variables such as Lt_434).

Returns:

(l2a_tree, aux_tree or None): the L2A without the intermediates, and an L2A.AUX tree (l2a_quantity AUX, no cube) holding them with the L2A’s geometry, flags and metadata, or None when there are none.

Return type:

tuple

hypso.processing.l2b.split_tool_products(tree)[source]#

Separate an L2A’s AC-tool products from its reflectance.

Parameters:

tree (xarray.DataTree) – An L2A tree, e.g. from hypso.processing.correct_atmosphere() or an L2A file written before the products moved to L2B.

Returns:

(l2a_tree, {group: l2b_tree}): the L2A without the products, and one L2B tree per group (hypso.io.naming.L2B_GROUPS), named after the AC tool (L2B.BGC.polymer). The tool’s flag variables are kept in the L2A and copied into each L2B.

Return type:

tuple

hypso.processing.l2b.tool_product_group(name)[source]#

The L2B group of an AC tool’s variable (e.g. "chla" -> "BGC"), or None if it stays in the L2A.

Parameters:

name (str)