def shiftGrid(infile, outfile, variable, latShift=0, lonShift=-280): if os.path.exists(outfile): os.remove(outfile) thisfile=cdms2.open(infile) thisLon = thisfile[variable].getLongitude() thisLon[:].data[:] = (thisLon[:].data[:] - lonShift)%360 newvar = cdms2.createVariable(MV.array(thisfile[variable][:]), id=variable, fill_value=1.e20) newvar.setAxisList((thisfile[variable].getTime(), thisfile[variable].getLatitude(), thisLon)) if os.path.exists(outfile): os.remove(outfile) outFile = cdms2.open(outfile,'w') outFile.write(newvar) thisfile.close() outFile.close() sys.exit(1)