Ejemplo n.º 1
0
def ret_regionmask(region,year,mon):
  if region == "ASAS":
    xydatadir   = "/media/disk2/out/chart/ASAS/const"
    paradate      = datetime.date(year,mon,1)
    if (paradate < datetime.date(2006,1,1)):
      name_domain_mask = xydatadir + "/domainmask_saone.%s.2000.01.bn"%(region)
    if ( datetime.date(2006,1,1)<=paradate<datetime.date(2006,3,1)):
      name_domain_mask = xydatadir + "/domainmask_saone.%s.2006.01.bn"%(region)
    if ( datetime.date(2006,3,1)<=paradate):
      name_domain_mask = xydatadir + "/domainmask_saone.%s.2006.03.bn"%(region)
    #
    a2regionmask = fromfile(name_domain_mask, float32).reshape(ny,nx)
    a2regionmask = ma.masked_equal(a2regionmask, 0.0).filled(miss)
  else:
    lllon, lllat, urlon, urlat = chart_para.ret_domain_corner_rect_forfig(region)
    a2regionmask = ctrack_func.mk_region_mask(lllat,urlat,lllon,urlon, nx,ny, lat_first, lon_first, dlat, dlon)
    a2regionmask = ma.masked_equal(a2regionmask, 0.0).filled(miss)
  #--
  return a2regionmask
Ejemplo n.º 2
0
odir      = "/media/disk2/out/obj.valid/exc.pgrad"
#------------------
def positive_lon(lon):
  if lon <0.0:
    positive_lon = 360 + lon
  else:
    positive_lon = lon
  #
  return positive_lon
#------------------

for model in lmodel:
  for region in lregion:
    #-- region mask ---
    lllat, lllon, urlat, urlon = ctrack_para.ret_tcregionlatlon(region)
    a2domain  = ctrack_func.mk_region_mask(lllat, urlat, lllon, urlon, nx, ny, lat_first, lon_first, dlat, dlon)

    #-- init ----------
    lvort_rad   = []
    lvort       = []
    ldt         = []
  
    #------------------
    for year_loop in range(iyear, eyear+1):
      bestname  = bestdir + "/Year.%04d.ibtracs_all.v03r04.csv"%(year_loop)
      #-- open -------
      f = open(bestname, "r")
      lines = f.readlines()
      f.close()
      #-- init dictionary --
      ddat  = {}
Ejemplo n.º 3
0
# read num
#-------------
da3num = {}
for crad in lcrad:
  da3num[crad, iclass]  = fromfile(dnumname[crad, iclass], float32).reshape(nwbin, ny, nx)
#----------------------------------------------
#*****************************************************
# start reg loop
#-----------------------------------------------------
for reg in lreg:
  #*****************************************************
  # make region mask
  #*****************************************************
  [lat_min, lat_max, lon_min, lon_max] = dbound[reg]
  #--
  a2regionmask = func.mk_region_mask(lat_min, lat_max, lon_min, lon_max, nx, ny, lat_first, lon_first, dlat, dlon)
  a2regionmask = ma.masked_where(a2orog > thorog, a2regionmask).filled(0.0)
  #
  a3regionmask = zeros(nwbin* ny* nx).reshape(nwbin, ny, nx)
  for iw in liw:
    a3regionmask[iw] = a2regionmask

  #**********************************************
  # extract regional domain
  #----------------------------------------------
  # sp
  #-------------
  da3sp_reg  = {}
  for crad in lcrad:
    da3sp_reg[crad, iclass]  = ma.masked_where(a3regionmask ==0.0, da3sp[crad, iclass])
  
Ejemplo n.º 4
0
lat_first = -89.5
lon_first = 0.5
dlat      = 1.0
dlon      = 1.0
#------------------------
countrad  = 1.0 # [km]
stepday   = 0.25
miss      = -9999.
#--- region -----
#lregion    = ["PNW", "PNE","INN","INS", "PSW","ATN"]
lregion    = ["GLB","SH","NH","NPA","NAT","EUR","SIP","SAT"]
da2regmask = {}
for region in lregion:
  lllat, lllon, urlat, urlon = ctrack_para.ret_excregionlatlon(region) 
  da2regmask[region]  = ctrack_func.mk_region_mask(lllat, urlat, lllon, urlon, nx, ny, lat_first, lon_first, dlat, dlon) 
#----------------
dmfreq_jra  = {}
dmfreq_obj  = {}
#----------------
for mon in lmon:
  #***************************
  # JRA25 
  #---------------------------
  idir_jra   = "/media/disk2/out/JRA25/sa.one.%s/6hr/exc/c%02dh.bsttc/%04d-%04d.%s"%("anl_p",thdura,iyear,eyear,mon)

  iname_jra  = idir_jra + "/freq.exc.rad%04dkm.%stc.%04d-%04d.%s.sa.one"%(countrad, bstflag_tc,iyear,eyear,mon)
  a2freq_jra_mon  = fromfile(iname_jra, float32).reshape(ny,nx) 

  for region in lregion:
    a2freq_jra_temp = ma.masked_where(da2regmask[region] !=1.0, a2freq_jra_mon)
Ejemplo n.º 5
0
thgrids    = 6
#----
nx,ny      = 360,180
lat_first  = -89.5
lon_first  = 0.5
dlat,dlon  = 1.0, 1.0
lbaiumon   = [5,6,7]

##** baiu region **********
lllat    = 25.
lllon    = 125
urlat    = 45.
urlon    = 145.
#--
a2baiu_region  = ctrack_func.mk_region_mask(lllat,urlat,lllon,urlon,nx,ny,lat_first,lon_first,dlat,dlon)


#** region mask **********
lllat    = 25.
lllon    = 125.
urlat    = 50.
urlon    = 155.
#--
a2regionmask  = ctrack_func.mk_region_mask(lllat,urlat,lllon,urlon,nx,ny,lat_first,lon_first,dlat,dlon)
#*************************
sidir_root  = "/media/disk2/out/JRA25/sa.one.%s/6hr/front/valid"%(sresol)

#*************************
for season in lseason:
  lmon  = ctrack_para.ret_lmon(season)