Skip to main content

Process netcdf data.

Project description

Just imagine that your tons of terrabytes of data can be processed in (parametric) space or time (or combination) with only a few (readable!) lines of code waiting only maybe just one night. For this task, we would obviously fall back to tools like cdo or ncl. However, we are stuck to the data analysis options that these provide. That’s where pynacolada comes into play. We can now apply any arbitrary pre-defined or user-defined function analysis on a huge dataset, and with great performance (from the numpy/matlib library), and very simply.

The power of tools lies in their examples. Typical usage of the package, in particular ncmultifunc, looks like this:

#!/usr/bin/env python
# 2013-11-08: Below, you find  just a code snippet from the first tests.. Examples will be added very soon
# import pynacolada as pcl
# from Scientific.IO import NetCDF
# import os
# import numpy as np
# import pylab as pl


# Example 1: calculate the mean scalar wind speed of the first 10 layers

fnin = 'laf2009010100.nc'
#print fnin
# fobjin = open(fnin,'rb')
fin = NetCDF.NetCDFFile(fnin,'r')
fnout = 'laf2009010100_out.nc'
os.system('rm '+fnout)
#print fnout
# fobjout = open(fnout,'wb+''rlat')
fout = NetCDF.NetCDFFile(fnout,'w')
# input data definitions
datin =  [{'file': fin, \
           'varname': 'U', \
           'dsel': {'level' : range(30,40,1)}, \
           'daliases': { 'srlat':'rlat', 'srlon':'rlon' },\
          },\
          {'file': fin, \
           'varname':'V', \
           'dsel': {'level' : range(30,40,1)},
           'daliases': { 'srlat':'rlat', 'srlon':'rlon' },\
           }\
         ]
# output data definitions
datout = [{'file': fout, \
           'varname': 'u'}]
# function definition:
func = lambda U,V: [np.mean(np.sqrt(U**2+V**2) )]
dnamsel = ['level',]
pcl.pcl(func,dnamsel,datin,datout,appenddim=True)
#print fnout

A Section

Project details


Download files

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

Source Distribution

pynacolada-0.0.1.tar.gz (20.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page