Ignore:
Timestamp:
Aug 2, 2011, 1:45:34 AM (13 years ago)
Author:
aslmd
Message:

MESOSCALE: python graphics: improved polar plots. added a detection for dust devils + stats.

Location:
trunk/MESOSCALE_DEV/PLOT/PYTHON/scripts
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MESOSCALE_DEV/PLOT/PYTHON/scripts/winds.py

    r247 r251  
    4040    from myplot import getcoord2d,define_proj,makeplotres,simplinterv,vectorfield,ptitle,latinterv,getproj,wrfinterv,dumpbdy,\
    4141                       fmtvar,definecolorvec,defcolorb,getprefix,putpoints,calculate_bounds,errormess,definesubplot,\
    42                        zoomset,getcoorddef,getwinddef,whatkindfile,reducefield,bounds,getstralt,getfield,smooth,nolow
     42                       zoomset,getcoorddef,getwinddef,whatkindfile,reducefield,bounds,getstralt,getfield,smooth,nolow,\
     43                       getname,localtime,polarinterv
    4344    from mymath import deg,max,min,mean
    4445    from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor, show
     
    6061        [uchar,vchar,metwind] = getwinddef(nc)             
    6162        if uchar == 'not found': winds = False
     63    if not var and not winds: errormess("please set at least winds or var",printvar=nc.variables)
    6264    [lon2d,lat2d] = getcoorddef(nc)                              ## COORDINATES, could be moved below
    6365    if proj == None:   proj = getproj(nc)                        ## PROJECTION
     
    6567    ##########################
    6668    ### Define plot boundaries
    67     if proj == "npstere":             [wlon,wlat] = latinterv("North_Pole")
    68     elif proj == "spstere":           [wlon,wlat] = latinterv("Far_South_Pole")
     69    ### todo: possible areas in latinterv in argument (ex: "Far_South_Pole")
     70    if proj in ["npstere","spstere"]: [wlon,wlat] = polarinterv(lon2d,lat2d)
    6971    elif proj in ["lcc","laea"]:      [wlon,wlat] = wrfinterv(lon2d,lat2d)
    7072    else:                             [wlon,wlat] = simplinterv(lon2d,lat2d)
     
    7375    #########################################
    7476    ### Name for title and graphics save file
    75     if var and winds:     basename = var + '_UV'
    76     elif var:             basename = var
    77     elif winds:           basename = 'UV'
    78     else:
    79         print nc.variables                 
    80         errormess("please set at least winds or var")
    81     if anomaly:           basename = 'd' + basename
     77    basename = getname(var=var,winds=winds,anomaly=anomaly)
    8278    basename = basename + getstralt(nc,nvert)  ## can be moved elsewhere for a more generic routine
    8379
     
    9894
    9995       ### Which local time ?
    100        #print interv[0], interv[1], itime
    101        ltst = ( interv[0] + 0.5*(wlon[0]+wlon[1])/15.) + itime*interv[1]
    102        ltst = int (ltst * 10) / 10.
    103        ltst = ltst % 24
     96       ltst = localtime ( interv[0]+itime*interv[1], 0.5*(wlon[0]+wlon[1]) )
    10497
    10598       ### General plot settings
     
    109102           if numplot > 1:     
    110103               if typefile not in ['geo']:  subplot(sub+nplot-1)
    111 
    112104           found_lct = True
    113105       ### If only one local time is requested (numplot < 0)
     
    157149                           vmin=zevmin, vmax=zevmax )
    158150               if colorb != 'nobar' and var != 'HGT':             
    159                          colorbar(fraction=0.05,pad=0.1,format=fmtvar(fvar),\
     151                         colorbar(fraction=0.05,pad=0.03,format=fmtvar(fvar),\
    160152                                           ticks=np.linspace(zevmin,zevmax,ndiv+1),\
    161153                                           extend='neither',spacing='proportional')
Note: See TracChangeset for help on using the changeset viewer.