-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature_361_aggstats_for_linetypes
- Loading branch information
Showing
17 changed files
with
2,387 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,4 @@ python: | |
sphinx: | ||
builder: html | ||
configuration: docs/conf.py | ||
fail_on_warning: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{ fullname | escape | underline}} | ||
|
||
.. automodule:: {{ fullname }} | ||
|
||
{% block attributes %} | ||
{% if attributes %} | ||
.. rubric:: {{ _('Module Attributes') }} | ||
|
||
.. autosummary:: | ||
{% for item in attributes %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block functions %} | ||
{% if functions %} | ||
.. rubric:: {{ _('Functions') }} | ||
|
||
.. autosummary:: | ||
:toctree: | ||
{% for item in functions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block classes %} | ||
{% if classes %} | ||
.. rubric:: {{ _('Classes') }} | ||
|
||
.. autosummary:: | ||
{% for item in classes %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block exceptions %} | ||
{% if exceptions %} | ||
.. rubric:: {{ _('Exceptions') }} | ||
|
||
.. autosummary:: | ||
{% for item in exceptions %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} | ||
|
||
{% block modules %} | ||
{% if modules %} | ||
.. rubric:: Modules | ||
|
||
.. autosummary:: | ||
:toctree: | ||
:recursive: | ||
{% for item in modules %} | ||
{{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.. _api-index: | ||
|
||
******************************** | ||
Diagnostic Calculation Reference | ||
******************************** | ||
|
||
This reference contains technical documentation for various diagnostic calculations in METcalcpy. | ||
|
||
.. currentmodule:: metcalcpy.diagnostics | ||
|
||
.. autosummary:: | ||
:toctree: generated/ | ||
:recursive: | ||
|
||
land_surface | ||
|
||
* :ref:`modindex` | ||
* :ref:`genindex` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Diagnostics relevant to Land/Surface applications""" | ||
|
||
from xarray.core.dataarray import DataArray | ||
from pandas.core.series import Series | ||
|
||
def calc_tci(soil_data,sfc_flux_data,skipna=True): | ||
""" Function for computing the Terrestrial Coupling Index | ||
Args: | ||
soil_data (Xarray DataArray or Pandas Series): The moisture variable to use for computing TCI. | ||
sfc_flux_data (Xarray DataArray or Pandas Series): The latent heat flux variable to use for computing TCI. | ||
skipna (bool): Skip NA values. Passed to Pandas or Xarray. | ||
Returns: | ||
Xarray DataArray or float32: If Xarray DataArray's are passed, then an Xarray DataArray | ||
containing the gridded TCI is returned. If a Pandas Series is passed, then a single TCI | ||
value is returned. | ||
Raises: | ||
TypeError: If an unrecognized object type is passed, or the object types do not match. | ||
Reference: | ||
Dirmeyer, P. A., 2011: The terrestrial segment of soil moisture-climate coupling. *Geophys. Res. Lett.*, **38**, L16702, doi: 10.1029/2011GL048268. | ||
""" | ||
|
||
# For Xarray objects, compute the mean | ||
if isinstance(soil_data,DataArray) and isinstance(sfc_flux_data,DataArray): | ||
soil_mean = soil_data.mean(dim='time',skipna=skipna) | ||
soil_count = soil_data.count(dim='time') | ||
sfc_flux_mean = sfc_flux_data.mean(dim='time',skipna=skipna) | ||
soil_std = soil_data.std(dim='time',skipna=skipna) | ||
numer = ((soil_data-soil_mean) * (sfc_flux_data-sfc_flux_mean)).sum(dim='time',skipna=skipna) | ||
|
||
# For Pandas objects, compute the mean | ||
elif isinstance(soil_data,Series) and isinstance(sfc_flux_data,Series): | ||
soil_mean = soil_data.mean(skipna=skipna) | ||
soil_count = soil_data.count() | ||
sfc_flux_mean = sfc_flux_data.mean(skipna=skipna) | ||
soil_std = soil_data.std(skipna=skipna) | ||
numer = ((soil_data-soil_mean) * (sfc_flux_data-sfc_flux_mean)).sum(skipna=skipna) | ||
|
||
# No other object types are supported | ||
else: | ||
raise TypeError("Only Xarray DataArray or Pandas DataFrame Objects are supported. Input objects must be of the same type. Got "+str(type(soil_data))+" for soil_data and "+str(type(sfc_flux_data))+" for sfc_flux_data") | ||
|
||
# Compute the covariance term | ||
covarTerm = numer / soil_count | ||
|
||
# Return the Terrestrial Coupling Index (TCI) | ||
return covarTerm/soil_std | ||
|
Oops, something went wrong.