from numpy import * from datetime import datetime import Cyclone dtime = datetime(2004,3,5,0) c= Cyclone.cyclone(model="JRA55",res="bn") path = c.path_a2dat("pgrad",dtime) print path.srcDir a2dat = c.load_a2dat("pgrad",dtime) print a2dat a1clist = c.load_clist("idate",2004,5) print a1clist
iYear,iMon, eYear, eMon = map(int,largv[1+7:1+7+4]) iYear_data, iMon_data = map(int,largv[1+7+4:1+7+4+2]) #------------------------- #cfg = config.cfg #cfg['prj'] = prj # for ConstCyclone #cfg['model'] = model # for ConstCyclone #cfg['outbaseDir'] = cfg['baseDir'] + '/%s'%(run) #iom = IO_Master.IO_Master(cfg, prj, model, run, res) iom = IO_Master.IO_Master(prj, model, run, res, dbbaseDir) const = ConstCyclone.Const(prj=prj, model=model) const['Lat'] = iom.Lat const['Lon'] = iom.Lon wsDir = wsbaseDir + '/%s'%(run) cy = Cyclone.Cyclone(baseDir=wsDir, const=const) lYM = util.ret_lYM([iYear,iMon],[eYear,eMon]) #********************************************** def ret_a1initState(var, year,mon,dinitState_pre): #---------- dinitState = {} dinitState[-9999,-9999] = -9999.0 #---------- a1idate = cy.load_clist("idate",year,mon) a1ipos = cy.load_clist("ipos" ,year,mon) a1time = cy.load_clist("time" ,year,mon) a1state = cy.load_clist(var ,year,mon) a1land = cy.load_clist("land" ,year,mon) #------------------------
res = "320x640" noleap = False iDTime = datetime(2010, 1, 1, 0) eDTime = datetime(2010, 1, 5, 0) cfg = config.cfg cfg['prj'] = prj # for ConstCyclone cfg['model'] = model # for ConstCyclone cfg['outbaseDir'] = cfg['baseDir'] + '/%s' % (run) iom = IO_Master.IO_Master(cfg, prj, model, run, res) const = ConstCyclone.Const(cfg) const['Lat'] = iom.Lat const['Lon'] = iom.Lon cy = Cyclone.Cyclone(cfg, const) #---------------------------------- a1lat = iom.Lat a1lon = iom.Lon ny = len(a1lat) nx = len(a1lon) lonlatfontsize = 10.0 #lonrotation = 90 lonrotation = 0 miss_int = -9999 [[lllat, lllon], [urlat, urlon]] = [[0, 100], [45, 180]] #------------------------ iYM = [iDTime.year, iDTime.month]
ret_lDTime = {False: util.ret_lDTime, True: util.ret_lDTime_noleap}[noleap] lDTime = ret_lDTime(iDTime, eDTime, dDTime) tstp = "6hr" cfg = config.cfg cfg['prj'] = prj # for ConstCyclone cfg['model'] = model # for ConstCyclone cfg['outbaseDir'] = cfg['baseDir'] + '/%s' % (run) iom = IO_Master.IO_Master(cfg, prj, model, run, res) const = ConstCyclone.Const(cfg) const['Lat'] = iom.Lat const['Lon'] = iom.Lon cy = Cyclone.Cyclone(cfg, const) a1lat = iom.Lat a1lon = iom.Lon ny = iom.ny nx = iom.nx miss = -9999.0 ##################################################### def var_psl(model): # variable name for mean sea level pressure if model in ["JRA25", "JRA55"]: return "PRMSL"
def read_txtlist(iname): f = open(iname, "r") lines = f.readlines() f.close() lines = map(float, lines) aout = array(lines, float32) return aout #**************************************************** for model in lmodel: ra = Reanalysis.Reanalysis(model=model, res=res) #-- copy lat and lon file -- prdType = ra.path_6hr(var_psl(model), datetime(2014,1,1,0)).prdType iNameLat = os.path.join(ra.baseDir, "%s.%s"%(res,prdType), "lat.txt") iNameLon = os.path.join(ra.baseDir, "%s.%s"%(res,prdType), "lon.txt") mk_dir( Cyclone.ret_baseDir(model,res)) shutil.copy(iNameLat, Cyclone.ret_baseDir(model,res)) shutil.copy(iNameLon, Cyclone.ret_baseDir(model,res)) #--------------------------- cy = Cyclone.Cyclone(model=model, res=res) #----- varPSL = var_psl(model) varTOPO = var_psl(model) a1lat = ra.Lat a1lon = ra.Lon ny = ra.ny nx = ra.nx