Exemplo n.º 1
0
def ret_pr(prtype,yeart,mont,dayt,hourt):
  #---
  if prtype =="GSMaP": 
    a2pr  = gsmap_func.timeave_gsmap_backward_saone(yeart,mont,dayt,hourt,1)

    #-- test --
    #a2pr  = ones([120,360],float32) 

  if prtype =="GSMaP.dec": 
    a2pr  = gsmap_func.timeave_gsmap_backward_org(yeart,mont,dayt,hourt,1)
  #---
  return ma.masked_equal(a2pr, miss) * calcoef
Exemplo n.º 2
0
sout = "mon,day,hour,spr_w,nw,spr_c,nc,sprin_w,nin_w,sprin_c,nin_c\n"
for day in range(1,eday+1):
  for hour in lhour:
    frontname = "/media/disk2/out/chart/ASAS/front/%04d%02d/front.ASAS.%04d.%02d.%02d.%02d.saone"%(year,mon,year,mon,day,hour)

    a2front   = fromfile(frontname,float32).reshape(180,360)
    a2frontw  = ma.masked_not_equal(a2front, 1).filled(miss)
    a2frontc  = ma.masked_not_equal(a2front, 2).filled(miss)
    #
    a2terrw   = ctrack_fsub.mk_territory_saone((ma.masked_equal(a2front,1.0).filled(miss)).T, dist_mask*1000., miss, lat_first, dlat, dlon).T
    a2terrc   = ctrack_fsub.mk_territory_saone((ma.masked_equal(a2front,2.0).filled(miss)).T, dist_mask*1000., miss, lat_first, dlat, dlon).T
    a2frontinw = ma.masked_where(a2terrw ==miss, a2frontw).filled(miss)
    a2frontinc = ma.masked_where(a2terrc ==miss, a2frontc).filled(miss)

    #-----------------------
    a2gsmap   = gsmap_func.timeave_gsmap_backward_saone(year,mon,day,hour+1,2)
    a2gsmap   = gsmap_func.gsmap2global_one(a2gsmap, miss)
    
    #-----------------------
    a2prw     = ma.masked_where(a2front !=1.0 , a2gsmap)
    a2prc     = ma.masked_where(a2front !=2.0 , a2gsmap)
    #
    a2prinw   = ma.masked_where(a2frontinw ==miss, a2gsmap)    
    a2princ   = ma.masked_where(a2frontinc ==miss, a2gsmap)
    #-----------------------
    prw       = ma.masked_equal( a2prw, miss).filled(0.0).sum()*60*60.
    prc       = ma.masked_equal( a2prc, miss).filled(0.0).sum()*60*60.
    #
    prinw     = ma.masked_equal( a2prinw, miss).filled(0.0).sum()*60*60.
    princ     = ma.masked_equal( a2princ, miss).filled(0.0).sum()*60*60.
    #
             tempname = tempdir + "/gsmap_mvk.1rh.%04d1231.2300.v5.222.1.sa.one"%(year-1)
             if not os.access(tempname, os.F_OK):
               continue
           elif (year==eyear)&(mon==12)&(day==31):
             tempdir  ="/media/disk2/data/GSMaP/sa.one/1hr/ptot/%04d%02d/"%(year+1,1)
             tempname = tempdir + "/gsmap_mvk.1rh.%04d0101.0000.v5.222.1.sa.one"%(year+1)
             if not os.access(tempname, os.F_OK):
               continue
           #-------------------
           print yfirst, year, mon, day, "nhour=",nhour, "percent=",percent
           #-------------------
           for hour in lhour:
             itimes     = itimes + 1
             itimes_seg = itimes_seg + 1
             #-- name ---------------
             a2in   = gsmap_func.timeave_gsmap_backward_saone(year,mon,day,hour, nhour)
 
             #-- count --
             a2count = a2count + ma.masked_where(a2in == miss, a2one).filled(0.0)
 
             #-- init ---------------
             a2in_seg   = a2in[yfirst:ylast, :].copy()
             if itimes == 1:
               a2stck   = a2in_seg
             else:
               a2stck   = r_[a2stck, a2in_seg]
             #-----------------------
             if itimes_seg > (ntop * numrat):
               print "sort!! on ",year,mon,day,hour
               a2stck   = a2stck.reshape(-1,ylast-yfirst,nx_org)
               for iiy in range( (ylast -yfirst)):
Exemplo n.º 4
0
a2prc    = ma.masked_where(a2countc==0.0, fromfile(prc,float32).reshape(180,360))*60*60.
a2prw    = ma.masked_where(a2countw==0.0, fromfile(prw,float32).reshape(180,360))*60*60.


countinc = idir + "/num.maskrad.in.%04dkm.0000km.cold.sa.one"%(rad)
countinw = idir + "/num.maskrad.in.%04dkm.0000km.warm.sa.one"%(rad)
princ    = idir + "/pr.maskrad.in.%04dkm.0000km.cold.sa.one"%(rad)
prinw    = idir + "/pr.maskrad.in.%04dkm.0000km.warm.sa.one"%(rad)

a2countinc = fromfile(countinc,float32).reshape(180,360)
a2countinw = fromfile(countinw,float32).reshape(180,360)
a2princ    = ma.masked_where(a2countinc ==0.0, fromfile(princ,float32).reshape(180,360))*60.*60.
a2prinw    = ma.masked_where(a2countinw ==0.0, fromfile(prinw,float32).reshape(180,360))*60.*60


frontname1 = "/media/disk2/out/chart/ASAS/front/200404/front.ASAS.2004.04.05.00.saone"
frontname2 = "/media/disk2/out/chart/ASAS/front/200404/front.ASAS.2004.04.05.18.saone"
a2front1   = fromfile(frontname1,float32).reshape(180,360)
a2front2   = fromfile(frontname2,float32).reshape(180,360)

#-----------------------
a2gsmap1   = gsmap_func.timeave_gsmap_backward_saone(2004,4,5,0+1,2)*60*60.
a2gsmap2   = gsmap_func.timeave_gsmap_backward_saone(2004,4,5,18+1,2)*60*60.
a2gsmap1   = ma.masked_equal(gsmap_func.gsmap2global_one(a2gsmap1, miss), miss).filled(0.0)
a2gsmap2   = ma.masked_equal(gsmap_func.gsmap2global_one(a2gsmap2, miss), miss).filled(0.0)

#-----------------------
a2prmanw1  = ma.masked_where(a2front1 !=1.0 , a2gsmap1)
a2prmanc1  = ma.masked_where(a2front1 !=2.0 , a2gsmap1)