Met.openASCIIGridData(indvPath) asData = Met.getGridData() if ncV in unAvgableVars: if ncV is 'zg': shMin = 1 else: shMin = 0 newMiss = asData.getMaxMinValue()[shMin] else: newMiss = asData.average() asData.replaceValue(asData.missingValue, newMiss, True) label = DataLabel(ts[tind]) label.setForecast(0) label.setGrid(99) label.setValue(tind) label.setLevel(hg2lvDict[hg]) label.setVarName(String(arlV)) ARLDI.levelNum = hg2lvDict[hg] ARLDI.writeGridData(label, asData) tind += 1 ARLDI.setTimeDimension(tDim.extract(startInd, tind - 2, 1)) ARLDI.closeDataFile()
for t in range(0, tNum): mydata.setTimeIndex(t) atime = dataInfo.getTimes().get(t) aDH = arlDI.getDataHead(mydata.getProjectionInfo(), 'FNL1', 2) arlDI.writeIndexRecord(atime, aDH) lidx = 0 for l in arlDI.levels: print l for v in arlDI.LevelVarList[lidx]: vName = gvars[avars.index(v)] print vName if lidx == 0: mydata.setLevelIndex(lidx) else: variable = dataInfo.getVariable(vName) nlidx = variable.getZDimension().getDimValue().indexOf(l*100.0) mydata.setLevelIndex(nlidx) gData = mydata.getGridData(vName) if v == 'PRSS' or v == 'WWND': gData = gData.divide(100) aDL = DataLabel(atime) aDL.setLevel(lidx) aDL.setVarName(v) aDL.setGrid(99) aDL.setForecast(0) arlDI.writeGridData(aDL, gData) lidx += 1 arlDI.closeDataFile() print 'Finished!'
ncV = arl2ncDict[arlV] fileName = str(yrWant) + "Time" + zstr(tind, 4) + ".asc" indvPath = os.path.join(dirIn, ncV, str(hg), fileName) Met.openASCIIGridData(indvPath) asData = Met.getGridData() if ncV in unAvgableVars: if ncV is 'zg': shMin = 1 else: shMin = 0 newMiss = asData.getMaxMinValue()[shMin] else: newMiss = asData.average() asData.replaceValue(asData.missingValue, newMiss, True) label = DataLabel(ts[tind]) label.setForecast(0) label.setGrid(99) label.setValue(tind) label.setLevel(hg2lvDict[hg]) label.setVarName(String(arlV)) ARLDI.levelNum = hg2lvDict[hg] ARLDI.writeGridData(label, asData) tind += 1 ARLDI.setTimeDimension(tDim.extract(startInd, tind - 2, 1)) ARLDI.closeDataFile()
mydata.setTimeIndex(t) atime = dataInfo.getTimes().get(t) aDH = arlDI.getDataHead(mydata.getProjectionInfo(), 'FNL1', 2) arlDI.writeIndexRecord(atime, aDH) lidx = 0 for l in arlDI.levels: print l for v in arlDI.LevelVarList[lidx]: vName = gvars[avars.index(v)] print vName if lidx == 0: mydata.setLevelIndex(lidx) else: variable = dataInfo.getVariable(vName) nlidx = variable.getZDimension().getDimValue().indexOf(l * 100.0) mydata.setLevelIndex(nlidx) gData = mydata.getGridData(vName) if v == 'PRSS' or v == 'WWND': gData = gData.divide(100) aDL = DataLabel(atime) aDL.setLevel(lidx) aDL.setVarName(v) aDL.setGrid(99) aDL.setForecast(0) arlDI.writeGridData(aDL, gData) lidx += 1 arlDI.closeDataFile() print 'Finished!'