Ignore:
Timestamp:
Dec 1, 2011, 11:10:25 AM (13 years ago)
Author:
acolaitis
Message:

PYTHON. Contour plots now working in movies. I had to modify the call_contour (get out the reducefield part, introduce a new variable what_I_plot_contour dedicated to var2) in order to conserve the speed of movie rendering. (otherwise there were calls to reducefield for each frame in call_contour)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/PYTHON/myplot.py

    r437 r440  
    10341034
    10351035    return nlon, nlat, nvert, ntime, mapmode, nslices
     1036
     1037# Author: AC
     1038# Reduce complexity of main script by moving the contour part here. Also allow to call it from elsewhere
     1039# which can be usefull
     1040
     1041def call_contour(what_I_plot,error,lon,lat,vert,time,vertmode,ze_var2,indextime,indexlon,indexlat,indexvert,yintegral,mapmode,typefile,var2,ticks):
     1042      from matplotlib.pyplot import contour, plot
     1043      import numpy as np
     1044      #what_I_plot = what_I_plot*mult
     1045      if not error:
     1046         if mapmode == 1:
     1047             if typefile in ['mesoapi','meso']:    what_I_plot = dumpbdy(what_I_plot,6)
     1048         zevmin, zevmax = calculate_bounds(what_I_plot)
     1049         zelevels = np.linspace(zevmin,zevmax,ticks) #20)
     1050         if var2 == 'HGT':  zelevels = np.arange(-10000.,30000.,2000.)
     1051         if mapmode == 0:
     1052             #if typefile in ['mesoideal']:    what_I_plot = dumpbdy(what_I_plot,0,stag='W')
     1053             itime=indextime
     1054             if len(what_I_plot.shape) is 3: itime=[0]
     1055             what_I_plot, x, y = define_axis(lon,lat,vert,time,indexlon,indexlat,indexvert,\
     1056                   itime,what_I_plot, len(ze_var2.shape),vertmode)
     1057         ### If we plot a 2-D field
     1058         if len(what_I_plot.shape) is 2:
     1059             #zelevels=[0.2,0.4,0.6,0.8,1.]
     1060             cs = contour(x,y,what_I_plot, zelevels, colors='k', linewidths = 1 ) #0.33 colors='w' )# , alpha=0.5)
     1061             #clabel(cs,zelevels,inline=3,fmt='%1.1f',fontsize=7)
     1062         ### If we plot a 1-D field
     1063         elif len(what_I_plot.shape) is 1:
     1064             plot(what_I_plot,x)
     1065      else:
     1066         errormess("There is an error in reducing field !")
     1067      return error
     1068
Note: See TracChangeset for help on using the changeset viewer.