Coder Social home page Coder Social logo

nco-bindings's Introduction

nco-bindings

Language bindings for NCO. A fork from Ralf Mueller's cdo-bindings.

nco.py - Use Python to access the power of NCO

This package contains the module NCO, which implements a python style access to the NetCDF Operators NCO. NCO is a command line tool for processing netCDF data. Its main focus if climate data, but it can by used for other purposes too.

Installation

Python Installation

./setup.py install

Coming Soon: Download and install nco.py via pypi:

pip install nco

Requirements

nco.py requires working NCO binaries, but has does not have special python version requirements. For returning multi-dimensional arrays (numpy addtional netcdf-io modules are needed. These are scipy or netCDF-4.

Usage

Run operators

For python an instance has to be created first

nco = Nco()

Now any NCO command (i.e. ncks, ncra, ...) can be called as a method of nco.

  • Required argument

    • input - Input netcdf file name, str
  • Optional arguments

    • output - String or list of strings representing input netCDF filenames. If not provided and operator returns a file (not an array or stdout text), the method will return a temporary file.
    • debug - bool or int, if <0 or True, debug statements will be turned on for NCO and NCOpy (default=False)
    • returnCdf - return a netCDF file handle, bool (default=False)
    • returnArray - return a numpy array of variable name, str (default='')
    • returnMaArray - return a numpy masked array of variable name, str (default='')
    • options - a string of NCO input options, for example options='-7 -L 1' (default='')
    • **kwargs - any kwarg will be passed as a key, value pair to the nco command "--{key}={value}". This allows the user to pass any number of long name commands list in the nco help pages.
  • File information

    ncdump_string = nco.ncdump(input=ifile)

  • Operators with user defined regular output files

    nco.ncra(input=ifile, output=ofile)

  • Use temporary output files

    temp_ofile = nco.ncrcat(input=ifile)

  • Set global NCO options

    nco.ncks(input=ifile, output=ofile, options="--netcdf4")

  • Return multi-dimension arrrays

    temperatures = nco.ncra(input=ifile, returnArray=True).variables['T'][:] temperatures = nco.ncra(input=ifile, returnCdf=True).variables['T'][:] temperatures = nco.ncra(input=ifile, returnArray='T')

Tempfile helpers

nco.py includes a simple tempfile wrapper, which make live easier, when writing your own scripts

Support, Issues, Bugs, ...

Please use the github page for this code: https://github.com/jhamman/nco-bindings

Changelog

  • next:
    • add ncdump --> python dictionary function

License

nco.py makes use of the GPLv2 License, see COPYING


Other stuff

  • Author: Joe Hamman [email protected]
  • Requires: NCO version 4.x.x or newer
  • License: Copyright 2013 by Joe Hamman. Released under GPLv2 license. See the COPYING file included in the distribution.

nco-bindings's People

Watchers

James Cloos avatar Oriana Chegwidden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.