xcontour
is a python package built on xarray
(starts with an x
), targeting at performing diagnostic analyses and calculations in contour-based coordinates. The new coordinates are built based on iso-surfaces of any quasi-conservative tracers (passive or active), mostly through a conservative rearrangement (or adiabatic sorting in a particular direction). Such rearrangement allows one to isolate the adiabatic advective process of a fluid and focus on non-conservative processes. Therefore, it simplifies the relavent dynamical view and interpretation of many phenomena.
The most well-known contour-based coordinates are 1) isentropic coordinate used in the atmosphere and 2) isopycnal coordinate used in the ocean, both of which are based on quasi-conservative variables of potential temperature and potential density. However, traditional coordinate transform requires a one-to-one relation between z-coordinate and isentropic/isopycnal surfaces. This can not be ensured in nonhydrostatic regions (heavier fluid is laid over lighter fluid). The adiabatic sorting process used here eliminates such constraint. For example, after the sorting in the vertical plane, the fluid will be completely stably stratified.
Basically, this package is usually used to accomplish the following tasks:
scikit-image
;The calculations mostly take advantages of xarray
's functionalities rather than writing explicit loops or algorithms, including contour-coordinate expansion, conditional accumulation or integration, coordinate transform and interpolation... One would see that xarray
1) supports multi-dimensional calculations, 2) simplifies a great deal of work in programming the very details, and 3) applies to different cases in a unified fashion.
Requirements
xcontour
is developed under the environment with numpy
(=version 1.15.4), xarray
(=version 0.15.1), xgcm
(=version 0.5.2), and xhistogram
(=version 0.3.0). Older versions of these packages are not well tested.
Install from github
git clone https://github.com/miniufo/xcontour.git
Here is a complete notebook example on Nakamura's effective diffusivity.
Here is a complete notebook example on local wave activity.
Here is a complete notebook example on local APE.
Here is a complete notebook example on contour length.