Source code for pycif.plugins.transforms.complex.diagmet.utils.cloud_optical_thickness
import numpy as np
[docs]
def cloud_optical_thickness(transf, inout_datastore, ddi, mapper):
"""Compute cloud optical thickness for low, medium, and high cloud layers.
Combines fixed reference optical depths for low/medium/high cloud layers,
scaled by the ECMWF cloud-cover fraction of each layer, into a broadband
cloud attenuation factor (``atte``). Only the "read cloud cover fraction"
option is currently implemented; the liquid/ice-water-path and
relative-humidity-based options are not yet ported from the original
``diagmet.f90``. See :doc:`/documentation/doc-models/chimere/diagmet`
(section 14) for the full derivation.
Args:
transf (Plugin): diagmet transform instance.
inout_datastore (dict): mutable datastore.
ddi (datetime): current sub-simulation date.
mapper (dict): transform mapper.
"""
# Fixed parameters
cloh0 = 2.0 # High clouds optical depth for cl fraction=1
clom0 = 10.0 # Medium clouds optical depth for cl fraction=1
clol0 = 50.0 # Low clouds optical depth for cl fraction=1
clol2 = 0.025 # Low clouds optical depth /m for RH=1
clom2 = 0.010 # Medium clouds optical depth /m for RH=1
cloh2 = 0.005 # High clouds optical depth /m for RH=1
topl = 2500. # Low cloud top altidue AGL
topm = 6000. # Medium cloud top altidue AGL
toph = 20000. # High cloud top altidue AGL
# Parameters
clol = 0 # Low cloud option (0=read cloudiness, 1=Use Liq. Wat., 2=Use RH)
crhl = 0.85
clom = 0 # Medium cloud option for attenuation ...
crhm = 0.95
cloh = 0 # High cloud option for attenuation ...
crhh = 0.95
# Inputs
alti = inout_datastore["outputs"][("meteo", "alti")][ddi]["spec"].values
clol = inout_datastore["inputs"][("meteo", "clol")][ddi]["spec"].values
clom = inout_datastore["inputs"][("meteo", "clom")][ddi]["spec"].values
cloh = inout_datastore["inputs"][("meteo", "cloh")][ddi]["spec"].values
# First determination of levels just below separation altitudes
levl = np.maximum(0, np.argmin(alti <= topl, axis=1) - 1)
levm = np.maximum(0, np.argmin(alti <= topm, axis=1) - 1)
levh = np.maximum(0, np.argmin(alti <= toph, axis=1) - 1)
# missing: XXXX Determination of liq/ice-water integrated COT
# Using cloudiness
# missing: XXX options for using op
opdh = cloh0 * cloh
opdm = clom0 * clom
opdl = clol0 * clol
# missing: option for using relative humidity
# Contribution from all cloud levels
totopd = opdl + opdm + opdh
inout_datastore["outputs"][("meteo", "atte")][ddi]["spec"] = \
0. * inout_datastore["inputs"][("meteo", "hght")][ddi]["spec"] \
+ np.exp(-0.11 * totopd ** 0.67)