#!/usr/bin/env python import cdms2, cdutil, genutil import vcs if __name__ == '__main__': import sys cdmsfile = cdms2.open('~/build/uvcdat/install/share/uvcdat/sample_data/clt.nc') clt = cdmsfile('clt') clt = clt(latitude=(-90.0, 90.0),squeeze=1,longitude=(-180.0, 175.0),time=('1979-01', '1988-12'),) axesOperations = eval("{'latitude': 'def', 'longitude': 'def', 'time': 'def'}") for axis in list(axesOperations): if axesOperations[axis] == 'sum': clt = cdutil.averager(clt, axis='(%s)'%axis, weight='equal', action='sum') elif axesOperations[axis] == 'avg': clt = cdutil.averager(clt, axis='(%s)'%axis, weight='equal') elif axesOperations[axis] == 'wgt': clt = cdutil.averager(clt, axis='(%s)'%axis) elif axesOperations[axis] == 'gtm': clt = genutil.statistics.geometricmean(clt, axis='(%s)'%axis) elif axesOperations[axis] == 'std': clt = genutil.statistics.std(clt, axis='(%s)'%axis) x = vcs.init() gmIsofill = vcs.getisofill('a_robinson_isofill') args = [] args.append(clt) gmIsofill.datawc_calendar = 135441 gmIsofill.datawc_timeunits = 'days since 2000' gmIsofill.datawc_x1 = 1e+20 gmIsofill.datawc_x2 = 1e+20 gmIsofill.datawc_y1 = 1e+20 gmIsofill.datawc_y2 = 1e+20 gmIsofill.levels = [[1.0000000200408773e+20, 1.0000000200408773e+20]] gmIsofill.ext_1 = False gmIsofill.ext_2 = False gmIsofill.fillareacolors = [1] gmIsofill.fillareaindices = [1] gmIsofill.fillareastyle = 'solid' gmIsofill.legend = None gmIsofill.missing = 241 gmIsofill.projection = 'robinson' gmIsofill.xaxisconvert = 'linear' gmIsofill.xmtics1 = '' gmIsofill.xmtics2 = '' gmIsofill.xticlabels1 = '*' gmIsofill.xticlabels2 = '*' gmIsofill.yaxisconvert = 'linear' gmIsofill.ymtics1 = '' gmIsofill.ymtics2 = '' gmIsofill.yticlabels1 = '*' gmIsofill.yticlabels2 = '*' kwargs = {} kwargs[ 'cdmsfile' ] = cdmsfile.id #kwargs[ 'bg' ] = 1 args.append( gmIsofill ) x.plot( *args, **kwargs) fnm = "bad.png" x.png(fnm)