Package: coupling-metrics
Calculate various state-of-the-art land-atmosphere coupling metricsFree software: MIT licenseInstallationpip install coupling-metricsYou can also install the in-development version with:pip install https://github.com/abtawfik/coupling-metrics/archive/master.zipDocumentationTo use CoMeT either on the command-line or in your python code check out the docs.https://coupling-metrics.readthedocs.io/Example UsageThere are two ways to use CoMeT after installation. Using the python API or on the command-line. See both uses below.CLI ExampleSay you are trying to compute the terrestrial coupling index for NARR data (North American Regional Reanalysis) between latent heat flux and soil moisture for a single year. You invoke this one the command-line:comet coupling --xname=soilm --yname=lhtfl --averaging=season --outname=NARR_lhf_vs_soilm_2017.nc lhtfl.2017.nc soilm.2017.ncBe mindful of memory in this case because currently all the data need to be loaded into memory. This might change in the future.If you want to see a list of metrics:comet --helpTo see the arguments for a list of metrics:comet mixing --helpPython APIEach metric can also be called directly from python.import comet as cm
import xarray as xr
from glob import glob

# Load data using xarray
latent_heat_files = glob('lhtfl.????.nc')
soilm_files       = glob('soilm.????.nc')
ds                = xr.open_mfdataset(latent_heat_files + soilm_files)

# Compute coupling index
terra_coupling = cm.CouplingIndex()
terra_coupling = terra_coupling.compute(ds, xname='soilm', yname='lhtfl', averaging='month')

# Output it to a file (may take a while depending on how much data is being processed)
terra_coupling.to_netcdf('My_new_NARR_Terra_coupling_lhf_vs_soilm.nc')To see a list of metricsimport comet as cm
print(cm.list_metrics)When to Use CoMeT?The metrics are meant to facilitate use of the most common land-atmosphere coupling metrics for research purposes.List of available metrics1.Convective Triggering Potential(aka CTP-HiLow or just CTP)
Evaluates morning atmospheric profiles to determine whether dry or wet soils are more likely to trigger convection2.Mixing DiagramsUses the diurnal covariation of temperature and humidity to quantify heat and moisture fluxes into the planetary boundary layer3.Terrestrial Coupling Index(aka terrestrial coupling parameter)
Quantifies the degree to which soil moisture variations control changes in surface energy fluxes.  Can be latent or sensible heat flux and is generally enough to apply to other surface variables such as the relationship between LAI and sensible heat flux.4.Heated Condensation FrameworkAssesses the atmospheric background state with respect to convective initiation and identifies local versus non-locally triggered moist convection.5.Relative Humidity TendencyReturns the contribution of surface energy fluxes, dry air entrainment, heat entrainment, and boundary layer growth to changes in top of boundary layer relative humidity.6.Soil Moisture Memory(the statisitcal form)
Determines the timescale at which initial soil moisture anomalies are retained over time.  The lagged autocorrelation of soil moisture is used to make the determination of memory.DevelopmentTo run the all tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog1.0.0 (2020-01-10)First release on PyPI.