Ignore:
Timestamp:
Jul 16, 2011, 1:06:45 AM (14 years ago)
Author:
aslmd
Message:

MESOSCALE: corrections petits bugs graphiques.

File:
1 edited

Legend:

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

    r225 r232  
    3232    from netCDF4 import Dataset
    3333    from myplot import getcoord2d,define_proj,makeplotpng,simplinterv,vectorfield,ptitle,latinterv,getproj,wrfinterv,dumpbdy,\
    34                        fmtvar,definecolorvec,getwinds,defcolorb,getprefix
     34                       fmtvar,definecolorvec,getwinds,defcolorb,getprefix,putpoints
    3535    from mymath import deg,max,min,mean
    3636    from matplotlib.pyplot import contour,contourf, subplot, figure, rcParams, savefig, colorbar, pcolor
     
    124124            elif dimension == 3:   field = nc.variables[var][:,:,:]
    125125            elif dimension == 4:   field = nc.variables[var][:,nvert,:,:] 
    126         dev = np.std(field)*3.0
    127         if vmin is None:  zevmin = mean(field) - dev
     126        fieldcalc = field[ field < 9e+35 ]
     127        dev = np.std(fieldcalc)*2.0
     128        if vmin is None:  zevmin = mean(fieldcalc) - dev
    128129        else:             zevmin = vmin
    129         if vmax is None:  zevmax = mean(field) + dev
     130        if vmax is None:  zevmax = mean(fieldcalc) + dev
    130131        else:             zevmax = vmax
    131132        if vmin == vmax:   
    132                           zevmin = mean(field) - dev  ### for continuity
    133                           zevmax = mean(field) + dev  ### for continuity           
    134         print "field ", min(field), max(field)
     133                          zevmin = mean(fieldcalc) - dev  ### for continuity
     134                          zevmax = mean(fieldcalc) + dev  ### for continuity           
     135        print "field ", min(fieldcalc), max(fieldcalc)
    135136        print "bounds ", zevmin, zevmax
    136137        ### some already defined colormaps
     
    157158        elif typefile is 'mesoapi': 
    158159            zelevel = int(nc.variables['vert'][nvert])
    159             if 'altitude'       in nc.dimensions:   stralt = "_"+str(zelevel)+"m-AMR"
    160             elif 'altitude_abg' in nc.dimensions:   stralt = "_"+str(zelevel)+"m-ALS"
    161             elif 'bottom_top'   in nc.dimensions:   stralt = "_"+str(zelevel)+"m"
     160            if abs(zelevel) < 10000.:   strheight=str(zelevel)+"m"
     161            else:                       strheight=str(int(zelevel/1000.))+"km"
     162            if 'altitude'       in nc.dimensions:   stralt = "_"+strheight+"-AMR"
     163            elif 'altitude_abg' in nc.dimensions:   stralt = "_"+strheight+"-ALS"
     164            elif 'bottom_top'   in nc.dimensions:   stralt = "_"+strheight
    162165            elif 'pressure'     in nc.dimensions:   stralt = "_"+str(zelevel)+"Pa"
    163166        else:                                       stralt = ""         
     
    179182        elif numplot == 2:
    180183            sub = 121
    181             fig.subplots_adjust(wspace = 0.3)
     184            fig.subplots_adjust(wspace = 0.35)
    182185            rcParams['font.size'] = int( rcParams['font.size'] * 3. / 4. )
    183186        elif numplot == 3:
     
    253256           if not tile:
    254257               zelevels = np.linspace(zevmin,zevmax)
    255                what_I_plot[ what_I_plot < zevmin ] = zevmin*(1. + 1.e-7)
    256                what_I_plot[ what_I_plot > zevmax ] = zevmax*(1. - 1.e-7)
     258               hole = True
     259               if not hole:
     260                   what_I_plot[ what_I_plot < zevmin ] = zevmin*(1. + 1.e-7)
     261                   what_I_plot[ what_I_plot > 9e+35  ] = -9e+35
     262                   what_I_plot[ what_I_plot > zevmax ] = zevmax*(1. - 1.e-7)
    257263               contourf( x, y, what_I_plot, 10, cmap = palette, levels = zelevels )
    258264           else:   
    259265               pcolor( x, y, what_I_plot, cmap = palette, vmin=zevmin, vmax=zevmax )
     266           #putpoints(m,fig)
    260267           if var in ['HGT']: pass
    261268           elif colorb:             
Note: See TracChangeset for help on using the changeset viewer.