Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

Easy chaining of cdo methods.

Project Description

This module helps create chains of cdo commands for easy manipulation of climate data.

Features

  • Method execution is lazy and gets processed only on function call Chain.execute().
  • Input supports Unix style pathname pattern search.
  • The Input will be first run with glob and checked if several files match. :exclamation: If that is the case a temporary file will be created.
  • Output can be a file on disc, an netCDF4.Dataset or (not) masked numpy.ndarray.

Installation

python3.5 -m pip install cdochain --pre

— or —

git clone https://github.com/OnionNinja/cdochain.git
cd cdochain
python3.5 setup.py install

TL;DR

from cdochain import chaining as cch

input = './tests/testdata/sresa1b_ncar_ccsm3-example.nc'
output = './enso34-mm.nc'
data = cch.Chain(input=input, output=output)
enso34 = data.sellonlatbox(190,240,-5,5).monmean()
out = enso34.execute()

Usage

This module implements method chaining for the Climate Data Operators (CDO) tool from the Max Planck Institute for Meteorology. Let us start:

from cdochain import chaining as cch

For initialisation one has to define input, output, and may define several options.

Input

Now we have to define the files we want to work on:

  • To use one file
input = './tests/testdata/sresa1b_ncar_ccsm3-example.nc'
  • To use several files you can give a Unix style pattern
input = './tests/testdata/*.nc'

Output

For defining the output we have several options.

  • To output a file on disc:
data = cch.Chain(input=input, output='/path/to/output.nc')
  • To output an netcdf4.Dataset object:
data = cch.Chain(input=input, output='netCDF4')
  • To output an numpy.ndarray object:
data = cch.Chain(input=input, output='array:<var>')  # numpy.ndarray
# or
data = cch.Chain(input=input, output='maarray:<var>')  # masked numpy.ndarray

<var> defines the variable to be extracted and saved to numpy.ndarray.

Options

As for options one can use the same as described on the CDO website. The default is options='-O -f nc'.

Operations

The operations defined in CDO can now be used on the data element.

python   analysis = data.sellonlatbox(190,240,-5,5).sellevidx(1).mermean()   fn = analysis.execute() Have fun :neckbeard:

Release History

Release History

This version
History Node

0.2a7141

History Node

0.2a722

History Node

0.2a714

History Node

0.2a713

History Node

0.2a711

History Node

0.2a635

History Node

0.2a634

History Node

0.2a633

History Node

0.2a632

History Node

0.2a631

History Node

0.2a72

History Node

0.2a71

History Node

0.2a63

History Node

0.2a62

History Node

0.2a61

History Node

0.2a7

History Node

0.2a6

History Node

0.2a5

History Node

0.2a4

History Node

0.2a3

History Node

0.2a2

History Node

0.2a1

History Node

0.1a7

History Node

0.1a6

History Node

0.1a5

History Node

0.1a4

History Node

0.1a3

History Node

0.1a2

History Node

0.1a1

History Node

0.1.0a1

History Node

0.1a

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
cdochain-0.2a7141.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Jun 7, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting