Exemplo n.º 1
0
def mk_dexcloc(year,mon):
  clistdir  = "/media/disk2/out/JRA55/bn/6hr/clist/%04d/%02d"%(year,mon)
  da1       = {}
  #lstype  = ["rvort","dtlow","dtmid","dtup","wmeanlow","wmeanup","wmaxlow","dura","pgrad","sst","lat","lon","ipos","nowpos","time","initsst"]
  #lstype  = ["dura","pgrad","lat","lon","nowpos","time","iedist"]
  lstype  = ["dura","pgrad","lat","lon","nowpos","time","iedist"]
  for stype in lstype:
    siname        = clistdir  + "/%s.%04d.%02d.bn"%(stype,year,mon)
    if stype in ["dura","ipos","idate","nowpos","time"]:
      da1[stype]  = fromfile(siname,   int32)
    else:
      da1[stype]  = fromfile(siname, float32)

    print siname
  #**** make dictionary ***
  stepflag = 0
  dtcloc   = {}
  nlist    = len(da1["dura"])
  for i in range(nlist):
    dura        = da1["dura"     ][i]
    pgrad       = da1["pgrad"    ][i]
    nowpos      = da1["nowpos"   ][i]
    time        = da1["time"     ][i]
    iedist      = da1["iedist"   ][i]
    #---- check time ----
    ### This section should be prior to the condition filtering

    if (i == nlist-1):
      stepflag = 1
    else:
      timenext    = da1["time"][i+1]
      if (timenext != time):
        stepflag = 1

    #---- dura -------
    if dura < thdura:
      continue
    #---- thpgrad ----
    if pgrad < thpgrad:
      continue
    #---- iedist -----
    if iedist < dura*unitdist:
      continue

    #---- time ------
    yeart,mont,dayt,hourt = ctrack_func.solve_time(time)

    #---- location --
    ix, iy            = ctrack_func.fortpos2pyxy( nowpos, nx, -9999)



    #---- dictionary --
    if dtcloc.has_key((dayt,hourt)):
      dtcloc[dayt,hourt].append([ix,iy,pgrad])
    else:
      dtcloc[dayt,hourt] = [[ix,iy, pgrad]]
  #------------------
  return dtcloc
Exemplo n.º 2
0
          #---------------
          for ix in range(0, nx):
            #-------------
            lon     = a1lon[ix]
            if ((lon < lllon) or (urlon < lon)):
              continue
            #-------------
            ##-- check duration -----
            #life  = a2life[iy, ix]
            #dura  = ctrack_func.solvelife_point_py(life, miss_int)[1]
            #if  (dura < thdura):
            #  continue
        
            #-----------------------
            nextpos   = a2nextpos[iy, ix]
            x_next, y_next = ctrack_func.fortpos2pyxy(nextpos, nx, miss_int)
            if ( (x_next == miss_int) & (y_next == miss_int) ):
              continue
            #------
            lat_next  = a1lat[y_next]
            lon_next  = a1lon[x_next]
            #
            ltrack.append([[year, mon, day, hour],[lat, lon, lat_next, lon_next]])
            print lat_next, lon_next        
#************************
# for mapping
nnx        = int( (urlon - lllon)/dlon)
nny        = int( (urlat - lllat)/dlat)
a1lon_loc  = linspace(lllon, urlon, nnx)
a1lat_loc  = linspace(lllat, urlat, nny)
LONS, LATS = meshgrid( a1lon_loc, a1lat_loc)
Exemplo n.º 3
0
 if counter == 1:
     a2lifenext = array(ones(ny * nx).reshape(ny, nx) * miss_int, int32)
 # --------------------------
 # initialize a2life1 and a2life2_new
 # *****************
 a2life1 = array(ones(ny * nx).reshape(ny, nx) * miss_int, int32)
 a2lifenext_new = array(ones(ny * nx).reshape(ny, nx) * miss_int, int32)
 a2nextpos0 = array(ones(ny * nx).reshape(ny, nx) * miss_int, int32)
 # *****************
 for iy1 in range(0, ny):
     for ix1 in range(0, nx):
         if a2time1[iy1, ix1] != miss_int:  # find cyclone
             pmin1 = a2pmin1[iy1, ix1]
             time1 = a2time1[iy1, ix1]
             lifenext = a2lifenext[iy1, ix1]
             (ix0, iy0) = fortpos2pyxy(a2lastpos1[iy1, ix1], nx, miss_int)
             # ----
             if lifenext == miss_int:
                 life1 = 10000 * int(pmin1) + time1
                 # print "date=",stimeh1
                 # print "time1=",time1
                 # print "pmin1=",pmin1
             else:
                 life1 = lifenext
             # ----
             a2life1[iy1, ix1] = life1
             # -----------------------
             # fill a2life2_new
             # ***************
             if ix0 != miss_int:
                 a2lifenext_new[iy0, ix0] = life1
Exemplo n.º 4
0
          stepflag = 1
        else:
          timenext    = da1["time"][i+1]
          if (timenext != time):
            stepflag = 1

        #---- dura -------
        if dura < thdura:
          continue
        #print "dura"
        #---- rvort -------
        if abs(rvort) < thrvort:
          continue
        #print "rvort"
        #---- ipos: land or sea  -------
        iposx, iposy = ctrack_func.fortpos2pyxy( ipos, nx, -9999)
        if a2landsea[iposy, iposx] == 1.0:
          continue

        #print "landsea"
        #---- ipos: SST -----
        if initsst < thsst:
          continue

        #print "SST"
        #---- wmaxlow -----
        if wmaxlow < thwind:
          continue

        #print "max wind"
        #---- wmeanlow & wmeanup --
Exemplo n.º 5
0
            a2life1      = fromfile(lifename1,   int32).reshape(ny, nx)
            a2ipos1      = fromfile(iposname1,    int32).reshape(ny, nx)
            a2idate1     = fromfile(idatename1,   int32).reshape(ny, nx)
            a2nextpos1   = fromfile(nextposname1, int32).reshape(ny, nx)
            #---------------------------------------
            ipos_t  = 610
            idate_t = 1990010100

            #if (foundflag == 0):
            for iy in range(0, ny):
              for ix in range(0, nx):
                psl1     = a2psl1[iy, ix]
                life1    = a2life1[iy, ix]
                (pmin1, dura1) = solvelife(life1)
                life1    = a2life1[iy, ix]
                ipos1    = a2ipos1[iy, ix]
                idate1   = a2idate1[iy, ix]
                nextpos1 = a2nextpos1[iy, ix]
                (ixnext, iynext) = fortpos2pyxy(nextpos1, nx, miss_int)
                foundflag = foundflag +1
                if ( (ipos1 == 610) and (idate1 == 1990010100) ):
                  print year, mon, day, hour,"yx", iy, ix, "yxnext",iynext, ixnext, "dura", dura1, "pmin", pmin1, "psl", psl1
                  a2trace[iy,ix] = psl1