tind += 1 startInd = tind ARLDI = ARLDataInfo() ARLDI.X = xs.getValues() ARLDI.Y = ys.getValues() for lind in range(len(rightFullLvls)): ARLDI.levels.add(lvDict[lind]) ARLDI.LevelVarList.add(lvVarDict[lvDict[lind]]) ARLDI.createDataFile(fileOut) while tind <= len(mns) and mns[tind-1] == mn: dataHead = ARLDI.getDataHead(proj, 'NRCP', 2) ARLDI.writeIndexRecord(ts[tind], dataHead) for hg in rightFullLvls: for arlV in lvVarDict[hg]: arlV = str(arlV) 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
arlDI.LevelVarList.add(['PRSS','T02M','U10M','V10M']) else: arlDI.LevelVarList.add(['HGTS','TEMP','UWND','VWND','WWND','RELH']) #---- Write ARL data file dataInfo = mydata.getDataInfo() arlDI.createDataFile(outFile) arlDI.X = dataInfo.getXDimension().getValues() arlDI.Y = dataInfo.getYDimension().getValues() variables = dataInfo.getVariables() tNum = dataInfo.getTimeNum() 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)
tind += 1 startInd = tind ARLDI = ARLDataInfo() ARLDI.X = xs.getValues() ARLDI.Y = ys.getValues() for lind in range(len(rightFullLvls)): ARLDI.levels.add(lvDict[lind]) ARLDI.LevelVarList.add(lvVarDict[lvDict[lind]]) ARLDI.createDataFile(fileOut) while tind <= len(mns) and mns[tind - 1] == mn: dataHead = ARLDI.getDataHead(proj, 'NRCP', 2) ARLDI.writeIndexRecord(ts[tind], dataHead) for hg in rightFullLvls: for arlV in lvVarDict[hg]: arlV = str(arlV) 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
else: arlDI.LevelVarList.add( ['HGTS', 'TEMP', 'UWND', 'VWND', 'WWND', 'RELH']) #---- Write ARL data file dataInfo = mydata.getDataInfo() arlDI.createDataFile(outFile) arlDI.X = dataInfo.getXDimension().getValues() arlDI.Y = dataInfo.getYDimension().getValues() variables = dataInfo.getVariables() tNum = dataInfo.getTimeNum() 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':