Ncdfextra is a Python module that provides tools to select, edit, convert netcdf data. The aim is to make an addition to 'cdo' (climate data operators) using python power. It depends on sciproc (it acually uses multifunc) and Scientific.IO.NetCDF and provides command-line tools to process netcdf-files directly without having to fiddle with innumerous temporary variables and for-loops. Typical usage of ncmultifunc looks like this:
#!/usr/bin/env python
from Scientific.IO import NetCDF
from numpy import *
from sciproc import *
from ncdfextra import *
ncin = NetCDF.NetCDFFile('../testdata/sample.nc','r')
ncout = NetCDF.NetCDFFile('../testdata/sampleavgcycle.nc','w')
# calculate diurnal cycle for every Netcdf variable in 'sample.nc' and store it in
# sampleavgcycle.nc:
ncmultifunc( ncin, ncout, \
# the dimension along which you want to apply the function. In our case, it is the
# (date)time of course. Ideally, it can also be multiple dimension, for instance to make
# cubic spline interpolations. (However, multiple dimensions isn't tested sofar)
('datetime',),\
# the function definition: in this case 'calculating the diurnal cycle'
lambda data, coords: avgcycle(data,coords,\
# cycle: 1 day (24 hours)
1.0, \
# add a 25th hour to close the cycle
cclose=True) \
)
A Section
Give it a try without any manual ;). Please e-mail your remarks, questions or problems to hendrikwout [ta] gmail [dat] com. Any questions will definitely be used to write the manual. Note that the package is still in experimental stage, so please be critical about its output. Hopefully, this package can be useful to you.
Product's homepage
Requirements:
· Python