ncdftools

Process netcdf data
Download

ncdftools Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Other/Proprietary Li...
  • Price:
  • FREE
  • Publisher Name:
  • H. Wouters
  • Publisher web site:
  • http://www.nowebsite.com

ncdftools Tags


ncdftools Description

ncdfextra is a Python module designed as follows: firstly, one specifies the input netcdf-file(s) and/or variables. Secondly, one specifies or defines an arbitrary (python or R)-function. And lastly, one specifies the dimension(s) along which you want to apply the function. E.g. this would be the time-dimension if one wants to make a diurnal average, or the x and y dimensions for some kind of interpolation in a plane. The result is a new automatically created netcdf-file in which you find the outcome of one or more processed variables.By making ncdftools, it is intended to make some kind of extension to cdo (Climate Data Operators), so that a more general analysis can be done without struggling with messy code containing innumerable for-loops and temperorary variables. Be aware that for tasks that can be done with cdo also, the speed of the tools are much slower than cdo. This is because cdo is heavily optimized for its specific operations. So it's always better to try any operation on netcdf files with cdo first.The package depends on the following commonly-used python packages: numpy, Scientific.IO and inspect. The tool can be easily installed on Ubuntu (as a .deb package). It should be working fine on Windows as well once python is installed, but I haven't tried it.Typical usesage of the package, in particular ncmultifunc looks like this:#!/usr/bin/env pythonfrom Scientific.IO import NetCDFfrom numpy import *from sciproc import *from ncdfextra import *lncin = NetCDF.NetCDFFile('slice_base.nc','r')lncoutAll = NetCDF.NetCDFFile('slice_base_diucycle.nc','w')lncoutPT = NetCDF.NetCDFFile('slice_base_diucyclePT.nc','w')# only process the potential temperature ('PT')# "data" refers to the# "datetim" refers to the coordinate of 'datetime'ncmultifunc(\ # pass a function as an argument (as a 'lambda'-function) lambda data, datetim: avgcycle(data,datetim,1.0,cclose=True),\ # dimension(s) along which we want to apply the function. The function will be repeated for the other # dimensions ('time',),\ # list of variables that have to be processed (here, it is only the potential temperature) nclist = ((lncin,'PT'),),\ ncout=lncoutPT)# In this case, all the variables in the netcdf file are now processed independently# so "data" subsequently refers to either potential temperature, moisture, pressure etc.ncmultifunc(\ lambda data, datetim: avgcycle(data,datetim,1.0,cclose=True),\ ('datetime',),\ ncin = lncin,ncout=lncoutAll)Product's homepage


ncdftools Related Software