This package contains the module Cdo, which implements a ruby/python style access to the Climate Data operators CDO. CDO is a command line tool for processing gridded data. Its main focus if climate data, but it can by used for other purposes to. It accepts input formats GRIB1, GRIB2, NetCDF and several Fortran binary formats.
Download and install cdo.rb via rubygems:
gem install cdo
Download and install cdo.py via pypi:
pip install cdo
Cdo.{rb,py} requires a working CDO binary, but has not special requirement to ruby or python. For returning multi-dimensional arrays (numpy for python, narray for ruby) addtional netcdf-io modules are needed. These are scipy for python and ruby-netcdf for ruby.
The Ruby module can be used directly after loading it. For python an instance has to be created first
cdo = Cdo()
-
File information
Cdo.infov(:in => ifile) (ruby version) Cdo.showlevels(:in => ifile) cdo.infov(input=ifile) (python verson) cdo.showlevels(input=ifile)
-
Operators with user defined regular output files
Cdo.timmin(:in => ifile ,:out => ofile) (ruby version) cdo.timmin(input = ifile,output = ofile) (python version)
-
Use temporary output files
tminFile = Cdo.timmin(:in => ifile) (ruby version) tminFile = cdo.timmin(input = ifile) (python version)
-
Operators with options
Cdo.remap([gridfile,weightfile],:in => ifile, :out => ofile) (ruby version) cdo.remap([gridfile,weightfile],input => ifile, output => ofile) (python version)
-
Set global CDO options
Cdo.copy(:in => ifile, :out => ofile,:options => "-f nc4") (ruby version) cdo.copy(input = ifile, output = ofile,options = "-f nc4") (python version)
-
Return multi-dimension arrrays
temperatures = Cdo.fldmin(:in => ifile,:returnArray => true).var('T').get (ruby version) temperatures = cdo.fldmin(input = ifile,:returnArray = True).variables['T'][:] (python version)
More examples can be found in test/cdo-examples.rb and on the homepage: code.zmaw.de/projects/cdo/wiki/Cdo%7Brbpy%7D
Cdo.{rb,py} includes a simple tempfile wrapper, which make live easier, when write your own scripts
Please use the forum or ticket system of CDOs official web page: code.zmaw.de/projects/cdo
Cdo.{rb,py} makes use of the GPLv2D License, see COPYING
- Author
-
Ralf Mueller <[email protected]>
- Requires
-
CDO version 1.5.x
- License
-
Copyright 2011-2012 by Ralf Mueller Released under GPLv2 license. See the COPYING file included in the distribution.