Skip to main content

Fast convective parameters for numpy, dask, and xarray

Project description

Python Package Index Conda Version https://zenodo.org/badge/215552269.svg

xlayers: Python implementation of MITgcm’s layer package

xlayers allows you to transform your data from a regular vertical grid (like depth) to a vertical grid defined based on contours of some variable (like density). xlayers uses FORTRAN code from the layers package of the MITgcm, which was written by Ryan Abernathey.

We recommend using this package on xarrays, but it can also be applied to numpy arrays. This example may be helpful in getting started.

Why a new vertical regridding package?

xlayers has many advantages over other similar tools. It conserves the total quantity of the input variable in the water column: this is particularly important when performing volume or heat budgets in density space. xlayers outputs the thickness-weighted variable in density space, which makes thickness-weighted averaging easier. This output is mapped in a smooth and sensible way. xlayers is also very fast and parallelizable.

Installation

xlayers can be installed from PyPI with pip:

python -m pip install xlayers

It is also available from conda-forge for conda installations:

conda install -c conda-forge xlayers

To install xlayers from source repository, the fortran-compiler package is required. The easiest way to install the fortran-compiler is via conda :

conda install -c conda-forge fortran-compiler
unset LDFLAGS

Once the compiler is installed, now we can install xlayers from Github:

git clone https://github.com/cspencerjones/xlayers.git
cd xlayers
python setup.py install

Features

xlayers is property conserving, meaning that the total amount of your variable in the water column will not change when it is transformed into the new coordinate system.

xlayers acheives this using binning: it bins the variable onto a much finer vertical grid, estimates the depth of the new coordinate surfaces, and adds up these bins in the new space.

Inputs

This package expects your initial coordinate system to be on a structured grid. i.e. it will not take density as an initial vertical variable, but depth is ok.

Before running layers_xarray, you must run finegrid to define some of the binning parameters needed. finegrid takes 2 inputs (which should both be numpy arrays): the vertical depth of the gridcells, and the vertical distance between the centers of the grid cells. The second variable should be loneger by 1 than the first, because it includes the distance between the cell center of the top cell and the sea surface, and the distance between the cell center of the bottom cell and the domain bottom.

The first two inputs to layers_xarray should be on the same gridpoints. data_in is the variable to be remapped and theta_in is the variable that defines the location of the new coordinate system.

Outputs

The output of layers_xarray is thickness weighted, i.e. if the input variable is salinity, the output variable is the salinity in each layer multiplied by the depth of the layer. In order to get an output that has the same units as the input, divide by the thickness of the layer (which you can get by inputting an array of ones into layers_xarray instead of you input variable data_in).

Get in touch

  • Report bugs, suggest features or view the source code on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlayers-0.2.2.tar.gz (127.2 kB view details)

Uploaded Source

Built Distributions

xlayers-0.2.2-pp36-pypy36_pp73-manylinux2010_x86_64.whl (940.0 kB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

xlayers-0.2.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded PyPy macOS 10.9+ x86-64

xlayers-0.2.2-pp27-pypy_73-manylinux2010_x86_64.whl (939.4 kB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

xlayers-0.2.2-pp27-pypy_73-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded PyPy macOS 10.9+ x86-64

xlayers-0.2.2-cp38-cp38-manylinux2010_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

xlayers-0.2.2-cp38-cp38-manylinux2010_i686.whl (841.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ i686

xlayers-0.2.2-cp38-cp38-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

xlayers-0.2.2-cp37-cp37m-manylinux2010_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

xlayers-0.2.2-cp37-cp37m-manylinux2010_i686.whl (841.2 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ i686

xlayers-0.2.2-cp37-cp37m-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

xlayers-0.2.2-cp36-cp36m-manylinux2010_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

xlayers-0.2.2-cp36-cp36m-manylinux2010_i686.whl (838.3 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ i686

xlayers-0.2.2-cp36-cp36m-macosx_10_9_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file xlayers-0.2.2.tar.gz.

File metadata

  • Download URL: xlayers-0.2.2.tar.gz
  • Upload date:
  • Size: 127.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2.tar.gz
Algorithm Hash digest
SHA256 93f6954ba589685bc39fcee490ca86810471b072ce06082fe53bd35b2b2478ca
MD5 f1fe880f457200f52b3e4ea4fc9a5e55
BLAKE2b-256 6c24d65026c67e8f3162f92fbafd83c4ffcf2c8a3abf0bc9f630cc22cbe4d278

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-pp36-pypy36_pp73-manylinux2010_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-pp36-pypy36_pp73-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 940.0 kB
  • Tags: PyPy, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 37155243b095d337b6a68b072d209efc4188e617b95dffa47a2a1810bff831f6
MD5 02d093a2c445c25745a590f5856f8a72
BLAKE2b-256 f48604d6f7c4b5567e62e2c9138381ff300b5d9863ccb31248b19897c138c4a3

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: PyPy, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-pp36-pypy36_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fed7e9fec25a12320f5745fa9da98c8cde6f9ef3c4a58539fe6ef881a45ff809
MD5 ea79b04b0c3554d7624989dc6f2f8c19
BLAKE2b-256 ad520b793895e419e77a9706c0aaa39a3d7c315798ac65dc614bbc7bdaec05a3

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-pp27-pypy_73-manylinux2010_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-pp27-pypy_73-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 939.4 kB
  • Tags: PyPy, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-pp27-pypy_73-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cb8d3f90336f8c7c8fe2e4970a0773bffc33f68cffe826ff7b86369ea9bca854
MD5 ac0b80252563c9d605b76bbda63f4f9f
BLAKE2b-256 932188f521d34291ce9a759ba9ae3553015701f69e148653c5528c3d563489af

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-pp27-pypy_73-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-pp27-pypy_73-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: PyPy, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-pp27-pypy_73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 787d8c8178939ce5f2580667a6cbd07c85e08569b9791042a1d93f3aac13321c
MD5 392d0f3a3810e029f357af30a7d479a5
BLAKE2b-256 79921579142ad4a9d657ac1d3fb9e71ec76f56e2e488ffbaba1070337f016227

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 30dd347a2b5c57c3e00192e2e2bb70aca143cb1a6fae76e99daf6bc196bc4723
MD5 5c7db87072ec6ebd470d46053d183606
BLAKE2b-256 f9f3f0c7d7cb0a533b1f165c8da8d7b872b724c20b4d298eb7e9aa710b08a097

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp38-cp38-manylinux2010_i686.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp38-cp38-manylinux2010_i686.whl
  • Upload date:
  • Size: 841.9 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 33f90df71f08aed2035e40d46d4c347f852c982dd132a14236187bd146c67944
MD5 258f985240567f48a248a01447065820
BLAKE2b-256 b73173ee601c8636a52a1d3a602bc3661a172864879a8615604dd3e2bb8af727

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 799b68942d6eef5cc8865a77e8a14fb8818863a95cf8c301e0aa11c39d2faada
MD5 768feeffeef15de73b734bc7e065ee42
BLAKE2b-256 bd049ae72461865e002d23c62df4a6c2538c40e3919fd4e9c3018b66505e6236

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8f445ac1cc03195366ea4e6cebbb3ad95babfff0db6e2f01fcb52a9f405da7a8
MD5 944dad112641a0e3d3cb92b154ea66c1
BLAKE2b-256 d7c9d6d43318acb94a8564a8522c2a47d5c1706fe031aa087e1a033087a8d482

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp37-cp37m-manylinux2010_i686.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp37-cp37m-manylinux2010_i686.whl
  • Upload date:
  • Size: 841.2 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 87d50d4ce51691ece7f847590323bb14122b895019bc3cdf9762781a33641782
MD5 f142a1e0900e0be1c40b2d468ecc21a4
BLAKE2b-256 f3d050f567bbdbc50babf0bc0f863a9b357a6184782c8e00273a9ce8a5da3ec5

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d8adccd112f4467f493edefa3e91e88f94daf40d226e8ad1a3411b5b453044a9
MD5 642a233d66689cc8b8e690b6a3ff64a6
BLAKE2b-256 0cc8b45b526073e8b33573a777d61089e746e15f7f8a9cad0d0b439392de5a92

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.0 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7fbda8deee8dd313091da7e819609831bf64bcd6a93035b739327d5763b9d2e7
MD5 3fa3cd998cd90d7960a96e47714a8e5e
BLAKE2b-256 463b679464ca89d6ece8275cf3d3ecc786f32859b8490e50405658e7d3e3edc2

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp36-cp36m-manylinux2010_i686.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp36-cp36m-manylinux2010_i686.whl
  • Upload date:
  • Size: 838.3 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ i686
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 9aa87d6e4fd5f37ae8dc5b0a7665742580e4dfb2f008dfa76b8309923e0156d9
MD5 6fb9019fc35fb202fd99a2b7636754cc
BLAKE2b-256 118919d9bfcd74943d6609469bc5a6aeeee83de95f76c7e7201a4c71f87617e6

See more details on using hashes here.

File details

Details for the file xlayers-0.2.2-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: xlayers-0.2.2-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for xlayers-0.2.2-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 ee45cdabb330586c3a5f34f8679a763c921bdc1bde4480dcc3ab10681005fbb7
MD5 d93d19486a4e90c67ec2a4d086b2917d
BLAKE2b-256 57ec4487dcf55b93aa407db89f139e1b6eba55d471ea0be0e422c3b21f2dae62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page