source: palm/trunk/SCRIPTS/NCL/timeseries.ncl @ 317

Last change on this file since 317 was 317, checked in by heinze, 15 years ago

Bugfix in timeseries.ncl

File size: 51.6 KB
RevLine 
[194]1load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
[154]2load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
3load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
4load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
5 
[190]6;***************************************************
7; load ncl_preferences.ncl
8;***************************************************
[194]9
10function which_script()
11local script
12begin
13   script="timeseries"
14   return(script)
15end
[154]16   
[190]17if (isfilepresent("~/ncl_preferences.ncl")) then
18   loadscript("~/ncl_preferences.ncl")
19else
20  if (isfilepresent("~/palm/current_version/trunk/SCRIPTS/NCL/ncl_preferences.ncl")) then
21     loadscript( "~/palm/current_version/trunk/SCRIPTS/NCL/ncl_preferences.ncl")
22  else
23      print(" ")
24      print("'ncl_preferences.ncl' does not exist in $home or $home/palm/current_version/trunk/SCRIPTS/NCL/")
25      print(" ")
26      exit
[154]27   end if
[190]28end if
29   
30begin
[154]31
[190]32   ;***************************************************
33   ; set up default parameter values and strings
34   ;***************************************************
[218]35   
[190]36   if (file_1 .EQ. "File in") then
37      print(" ")
[218]38      print("Declare input file 'file_1=' in 'ncl_preferences.ncl' or prompt")
[190]39      print(" ")
40      exit
[175]41   else
42      file_in = file_1   
[154]43   end if
[175]44
[190]45   if (format_out .NE. "x11" .AND. format_out .NE. "pdf" .AND. format_out .NE. "eps" .AND. format_out .NE. "ps" .AND. format_out .NE. "epsi" .AND. format_out .NE. "ncgm")then
46      print(" ")
47      print("'format_out = "+format_out+"' is invalid and set to'x11'")
48      print(" ")
49      format_out="x11"
[154]50   end if 
[175]51
[190]52   if (over .NE. 0 .AND. over .NE. 1) then
53      print(" ")
54      print("'over'= "+over+" is invalid and set to 0")
55      print(" ")
[161]56      over = 0
[218]57   end if 
58   
59   if (norm_t .EQ. 0) then
60      print(" ")
61      print("Normalising with 0 is not allowed, 'norm_t' is set to 1.0")
62      print(" ")
63      norm_t = 1.0
64   end if
[190]65 
[175]66
[190]67   ;***************************************************
[154]68   ; open input file
[190]69   ;***************************************************
[218]70   
71   file_in_1 = False
72   if (isStrSubset(file_in, ".nc"))then
73      start_f = -2
74      end_f = -2
75      file_in_1 = True     
76   end if
[154]77
[218]78   if (start_f .EQ. -1)then
79      print(" ")
80      print("'start_f' must be one of the cyclic numbers (at least 0) of your input file(s)")
81      print(" ") 
82      exit
83   end if
84   if (end_f .EQ. -1)then
85      print(" ")
86      print("'end_f' must be one of the cyclic numbers (at least 0) of your input file(s)")
87      print(" ") 
88      exit
89   end if
[154]90
[218]91   files=new(end_f-start_f+1,string)
92
93   if (file_in_1)then
94      if (isfilepresent(file_in))then
95         files(0)=file_in
96      else
97         print(" ")
98         print("1st input file: '"+file_in+"' does not exist")
99         print(" ")
100         exit
101      end if
102   else   
103      if (start_f .EQ. 0)then
104         if (isfilepresent(file_in+".nc"))then
105            files(0)=file_in+".nc"
106            do i=1,end_f
107               if (isfilepresent(file_in+"."+i+".nc"))then   
108                  files(i)=file_in+"."+i+".nc"
109               else
110                  print(" ")
111                  print("Input file: '"+file_in+"."+i+".nc' does not exist")
112                  print(" ")
113                  exit 
114               end if       
115            end do         
116         else
117            print(" ")
118            print("Input file: '"+file_in+".nc' does not exist")
119            print(" ")
120            exit
121         end if
122      else
123         do i=start_f,end_f
124            if (isfilepresent(file_in+"."+i+".nc"))then   
125               files(i-start_f)=file_in+"."+i+".nc"
126            else
127               print(" ")
128               print("Input file: '"+file_in+"."+i+".nc' does not exist")
129               print(" ")
130               exit 
131            end if
132         end do
133      end if
134   end if
135
136   f=addfiles(files,"r")
137   f_att=addfile(files(0),"r")
138   ListSetType(f,"cat")
139
140   vNam=getfilevarnames(f_att)
[310]141   vNam_static=vNam
[218]142
[154]143   print(" ")
[190]144   print("Variables in input file:")
145   print("- "+ vNam)
[154]146   print(" ")
[161]147   dim = dimsizes(vNam)
148   if (dim .EQ. 0) then
149      print(" ")
[310]150      print("There is no data on file")
[161]151      print(" ")
152   end if
153
[310]154   t_all   = f[:]->time
155   nt      = dimsizes(t_all)
156   delta_t = t_all(nt-1)/nt
[218]157
[190]158   ;****************************************************       
[154]159   ; start of time step and different types of mistakes that could be done
[190]160   ;****************************************************
[154]161
[190]162   if (start_time_step .EQ. -1.) then           
163      start_time_step=t_all(0)/3600     
[154]164   else
[162]165      if (start_time_step .GE. t_all(nt-1)/3600)
[154]166         print(" ")
[162]167         print("'start_time_step' = "+ start_time_step +"h is equal or greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
[154]168         print(" ")
[218]169         print("Select another 'start_time_step'")
[162]170         print(" ")
[154]171         exit
172      end if
[162]173      if (start_time_step .LT. t_all(0)/3600)
[154]174         print(" ")
[162]175         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
[154]176         print(" ")
[218]177         print("Select another 'start_time_step'")
[162]178         print(" ")
[154]179         exit
180      end if
181   end if
[162]182   do i=0,nt-2     
[190]183      if (start_time_step .GE. (t_all(i)-delta_t/2)/3600 .AND. start_time_step .LT. (t_all(i)+delta_t/2)/3600)then
[162]184         st=i
185         break
186      end if
187   end do
188   if (start_time_step .GE. t_all(nt-1)-delta_t/2 .AND. start_time_step .LT. t_all(nt-1)) then
189      st=nt-2   
190   end if
[190]191   if (.not. isvar("st"))then
192      print(" ")
193      print("'start_time_step' = "+ start_time_step +"h is invalid")
194      print(" ")
[218]195      print("Select another 'start_time_step'")
[190]196      print(" ")
197      exit
198   end if
[162]199     
[190]200   ;****************************************************
[154]201   ; end of time step and different types of mistakes that could be done
[190]202   ;****************************************************
[154]203
[190]204   if (end_time_step .EQ. -1.) then             
205      end_time_step = t_all(nt-1)/3600 
[154]206   else
[162]207      if (end_time_step .LE. t_all(0)/3600)
[154]208         print(" ")
[162]209         print("'end_time_step' = "+end_time_step+ "h is lower or equal than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
[154]210         print(" ")
[218]211         print("Select another 'end_time_step'")
[162]212         print(" ")
[154]213         exit
214      end if
[162]215      if (end_time_step .GT. t_all(nt-1)/3600)
[154]216         print(" ")
[162]217         print("'end_time_step' = "+ end_time_step +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
[154]218         print(" ")
[218]219         print("Select another 'end_time_step'") 
[162]220         print(" ")
[154]221         exit
222      end if
[162]223      if (end_time_step .LE. start_time_step/3600)
[161]224         print(" ")
[162]225         print("'end_time_step' = "+ end_time_step +"h is equal or lower than 'start_time_step' = "+start_time_step+"h")
[161]226         print(" ")
[218]227         print("Select another 'start_time_step' or 'end_time_step'")
[162]228         print(" ")
[161]229         exit
[154]230      end if
[162]231   end if
232   do i=0,nt-1     
[190]233      if (end_time_step .GE. (t_all(i)-delta_t/2)/3600 .AND. end_time_step .LT. (t_all(i)+delta_t/2)/3600)then
[162]234         et=i
235         break
236      end if
237   end do
[190]238   
239   if (.not. isvar("et"))then
240      print(" ")
241      print("'end_time_step' = "+ end_time_step +"h is invalid")
242      print(" ")
[218]243      print("Select another 'end_time_step'")
[190]244      print(" ")
245      exit
246   end if
[162]247 
248   delete(start_time_step)
249   start_time_step=round(st,3)
250   delete(end_time_step)
251   end_time_step=round(et,3)
[154]252
[175]253   print(" ")
254   print("Output of time steps from "+t_all(start_time_step)/3600+" h = "+t_all(start_time_step)+" s => index = "+start_time_step)
255   print("                     till "+t_all(end_time_step)/3600+" h = "+t_all(end_time_step)+" s => index = "+end_time_step)
256   print(" ")
257
[218]258   t = t_all(start_time_step:end_time_step)/norm_t
[154]259 
260   ; ***************************************************
261   ; set up recourses
262   ; ***************************************************
263
264   res                         = True
265   res@gsnDraw                 = False
266   res@gsnFrame                = False
267   res@gsnPaperOrientation     = "portrait"
268   res@gsnPaperWidth           = 8.27
269   res@gsnPaperHeight          = 11.69
270   res@gsnPaperMargin          = 0.79
271   res@tmXBMode                = True
272   res@tmYLMode                = True
273   res@txFont                  = "helvetica"
274   res@tiMainFont              = "helvetica"
275   res@tiXAxisFont             = "helvetica"
276   res@tiYAxisFont             = "helvetica"
277   res@tmXBLabelFont           = "helvetica"
[161]278   res@tmYLLabelFont           = "helvetica"
279   res@xyLineColors            = (/237/)
280   
[218]281   res@lgLabelFontHeightF     = 0.02
[161]282
[154]283   resP                        = True
284   resP@txFont                 = "helvetica"
[218]285   resP@txString               = f_att@title+" time series "
[154]286   resP@txFuncCode             = "~"
287   resP@txFontHeightF          = 0.015
288
[218]289   res@tmXBMinorPerMajor = 4
290   res@tmYLMinorPerMajor = 4
291
[154]292   res@vpWidthF=4
293
[161]294   txres = True
[154]295
296   ; ***************************************************
297   ; read data and create plots
298   ; ***************************************************
299   
300   wks_ps = gsn_open_wks(format_out,file_out)           
301   gsn_define_colormap(wks_ps,"rainbow+white")
[161]302   plot_ps=new(dim,graphic)
303                                 
[154]304   n=0
[161]305   minE=1.E27
306   maxE=-1.E27
307   minus=1.E27
308   maxus=-1.E27
309   minu=1.E27
310   maxu=-1.E27
311   minz=1.E27
312   maxz=-1.E27
313   minw=1.E27
314   maxw=-1.E27
315   minp=1.E27
316   maxp=-1.E27
317   mins=1.E27
318   maxs=-1.E27
319
320   data   = new((/dim,(end_time_step-start_time_step)+1/),float)
321   unit   = new(dim,string)
322   data_0 = new((end_time_step-start_time_step)+1,float)
323   data_0 = 0.0
324   mini   = new(dim,float)
325   maxi   = new(dim,float)
326   
327   if (over .EQ. 1) then
328      plot_E       = gsn_csm_xy(wks_ps,t,data_0(:),res)
329      plot_Es      = gsn_csm_xy(wks_ps,t,data_0(:),res)
330      plot_us      = gsn_csm_xy(wks_ps,t,data_0(:),res)
331      plot_ws      = gsn_csm_xy(wks_ps,t,data_0(:),res)
332      plot_umax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
333      plot_vmax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
334      plot_wmax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
335      plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data_0(:),res)
336      plot_z_i_pt  = gsn_csm_xy(wks_ps,t,data_0(:),res)
337      plot_wpptp0  = gsn_csm_xy(wks_ps,t,data_0(:),res)
338      plot_wpptp   = gsn_csm_xy(wks_ps,t,data_0(:),res)
339      plot_wpt     = gsn_csm_xy(wks_ps,t,data_0(:),res)
340      plot_pt_0_   = gsn_csm_xy(wks_ps,t,data_0(:),res)
341      plot_pt_zp_  = gsn_csm_xy(wks_ps,t,data_0(:),res)
342      plot_splptx  = gsn_csm_xy(wks_ps,t,data_0(:),res)
343      plot_splpty  = gsn_csm_xy(wks_ps,t,data_0(:),res)
344      plot_splptz  = gsn_csm_xy(wks_ps,t,data_0(:),res)
345   end if
[162]346
[161]347
[310]348   if (var .NE. "all") then
349      vNam_temp = new((/dim/),string)
350      comma     = 0
351      var_char  = stringtocharacter(var)
352      no_char   = dimsizes(var_char)
353       
354      do j = 0, no_char-1
355         if(var_char(j) .eq. ",")
356            comma = comma + 1
357         end if
358      end do
359
[317]360      if(comma .eq. 0 .or. comma .eq. 1)
361          print(" ")
362          print("The variables 'var="+var+"'" )
363          print("do not exist on your input file;")
364          print("be sure to have one comma before and after each variable")
365          print(" ")
366          exit
367      end if
368
[310]369      indices = new((/comma/), integer)
370      comma   = 0
371       
372      do j = 0, no_char-1
373         if(var_char(j) .eq. ",")
374           indices(comma) = j
375           comma = comma + 1
376         end if
377      end do
378
379      do j = 0, comma -2
380         vNam_temp(j) = charactertostring(var_char(indices(j)+1:indices(j+1)-1))
381      end do
382     
383      delete(vNam)
384      vNam = new((/comma-1/),string)
385      do varn = 0, comma - 2
386         vNam(varn) = vNam_temp(comma - 2 - varn)
387      end do
388     
389      do j = 0, comma-2
390        count_check = 0
391        do varn = 0, dim-1
392           if(vNam(j) .ne. vNam_static(varn))
393             count_check=count_check+1
394           end if
[317]395        end do   
396
[310]397        if(count_check .eq. dim)
398            print(" ")
399            print("The variables 'var="+var+"'" )
400            print("do not exist on your input file;")
401            print("be sure to have one comma before and after each variable")
402            print(" ")
403            exit
404        end if
405      end do
406
407      dim = comma-1
408    end if
409
410
411   do varn = dim-1, 0, 1
412
[161]413      if( isStrSubset (vNam(varn), "time") )
414         check = False
415      else
416         check = True
[310]417      end if
[161]418     
419      if(check) then
[162]420
[218]421         data_all = f[:]->$vNam(varn)$
422         data_att = f_att->$vNam(varn)$
423         unit(varn) = data_att@units
[310]424 
425     
[161]426         data(varn,:)=data_all(start_time_step:end_time_step)
427         
428         if (over .EQ. 1) then
429
430            mini(varn) = min(data(varn,:))
431            maxi(varn) = max(data(varn,:))
432           
433            if (vNam(varn) .EQ. "E" .OR. vNam(varn) .EQ. "Es") then
434               if (mini(varn) .EQ. maxi(varn)) then
435                  if (min(data(varn,:)) .EQ. 0)then
[218]436                     mini(varn)= mini(varn)-0.1
437                     maxi(varn)= maxi(varn)+0.1
[161]438                  end if
439                  if (min(data(varn,:)) .LT. 0)then
440                     mini(varn)= mini(varn)-1.+(mini(varn))/2
441                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
442                  end if
443                  if (min(data(varn,:)) .GT. 0)then
444                     mini(varn)= mini(varn)-1.-(mini(varn))/2
445                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
446                  end if
447               end if
448               minE=min((/minE,mini(varn)/))
449               maxE=max((/maxE,maxi(varn)/))
450            end if
451
452            if (vNam(varn) .EQ. "us" .OR. vNam(varn) .EQ. "ws") then
453               if (mini(varn) .EQ. maxi(varn)) then
454                  if (min(data(varn,:)) .EQ. 0)then
[218]455                     mini(varn)= mini(varn)-0.1
456                     maxi(varn)= maxi(varn)+0.1
[161]457                  end if
458                  if (min(data(varn,:)) .LT. 0)then
459                     mini(varn)= mini(varn)-1.+(mini(varn))/2
460                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
461                  end if
462                  if (min(data(varn,:)) .GT. 0)then
463                     mini(varn)= mini(varn)-1.-(mini(varn))/2
464                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
465                  end if
466               end if
467               minus=min((/minus,mini(varn)/))
468               maxus=max((/maxus,maxi(varn)/))
469            end if
470
471            if (vNam(varn) .EQ. "umax" .OR. vNam(varn) .EQ. "vmax" .OR. vNam(varn) .EQ. "wmax") then
472               if (mini(varn) .EQ. maxi(varn)) then
473                  if (mini(varn) .EQ. 0)then
[218]474                     mini(varn)= mini(varn)-0.1
475                     maxi(varn)= maxi(varn)+0.1
[161]476                  end if
477                  if (mini(varn) .LT. 0)then
478                     mini(varn)= mini(varn)-1.+(mini(varn))/2
479                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
480                  end if
481                  if (mini(varn) .GT. 0)then
482                     mini(varn)= mini(varn)-1.-(mini(varn))/2
483                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
484                  end if
485               end if
486               minu=min((/minu,mini(varn)/))
487               maxu=max((/maxu,maxi(varn)/))
488            end if
489
490            if (vNam(varn) .EQ. "z_i_wpt" .OR. vNam(varn) .EQ. "z_i_pt") then
491               if (mini(varn) .EQ. maxi(varn)) then
492                  if (min(data(varn,:)) .EQ. 0)then
[218]493                     mini(varn)= mini(varn)-0.1
494                     maxi(varn)= maxi(varn)+0.1
[161]495                  end if
496                  if (min(data(varn,:)) .LT. 0)then
497                     mini(varn)= mini(varn)-1.+(mini(varn))/2
498                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
499                  end if
500                  if (min(data(varn,:)) .GT. 0)then
501                     mini(varn)= mini(varn)-1.-(mini(varn))/2
502                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
503                  end if
504               end if
505               minz=min((/minz,mini(varn)/))
506               maxz=max((/maxz,maxi(varn)/))
507            end if
508
509            if (vNam(varn) .EQ. "wpptp0" .OR. vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "wpt") then
510               if (mini(varn) .EQ. maxi(varn)) then
511                  if (min(data(varn,:)) .EQ. 0)then
[218]512                     mini(varn)= mini(varn)-0.1
513                     maxi(varn)= maxi(varn)+0.1
[161]514                  end if
515                  if (min(data(varn,:)) .LT. 0)then
516                     mini(varn)= mini(varn)-1.+(mini(varn))/2
517                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
518                  end if
519                  if (min(data(varn,:)) .GT. 0)then
520                     mini(varn)= mini(varn)-1.-(mini(varn))/2
521                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
522                  end if
523               end if
524               minw=min((/minw,mini(varn)/))
525               maxw=max((/maxw,maxi(varn)/))
526            end if
527
528            if (vNam(varn) .EQ. "pt_0_" .OR. vNam(varn) .EQ. "pt_zp_") then
529               if (mini(varn) .EQ. maxi(varn)) then
530                  if (min(data(varn,:)) .EQ. 0)then
[218]531                     mini(varn)= mini(varn)-0.1
532                     maxi(varn)= maxi(varn)+0.1
[161]533                  end if
534                  if (min(data(varn,:)) .LT. 0)then
535                     mini(varn)= mini(varn)-1.+(mini(varn))/2
536                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
537                  end if
538                  if (min(data(varn,:)) .GT. 0)then
539                     mini(varn)= mini(varn)-1.-(mini(varn))/2
540                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
541                  end if
542               end if
543               minp=min((/minp,mini(varn)/))
544               maxp=max((/maxp,maxi(varn)/))
545            end if
546
547            if (vNam(varn) .EQ. "splptx" .OR. vNam(varn) .EQ. "splpty" .OR. vNam(varn) .EQ. "splptz") then
548               if (mini(varn) .EQ. maxi(varn)) then
549                  if (min(data(varn,:)) .EQ. 0)then
[218]550                     mini(varn)= mini(varn)-0.1
551                     maxi(varn)= maxi(varn)+0.1
[161]552                  end if
553                  if (min(data(varn,:)) .LT. 0)then
554                     mini(varn)= mini(varn)-1.+(mini(varn))/2
555                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
556                  end if
557                  if (min(data(varn,:)) .GT. 0)then
558                     mini(varn)= mini(varn)-1.-(mini(varn))/2
559                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
560                  end if
561               end if
562               mins=min((/mins,mini(varn)/))
563               maxs=max((/maxs,maxi(varn)/))
564            end if
565           
566         end if
567      end if
568   end do
[310]569 
570  if (isStrSubset(data@long_name," SR " ))then
[162]571      print(" ")
[310]572      print("If you have outputs of statistic regions you cannot overlay variables;")
573      print("'over' is set to 0" )
[162]574      print(" ")
[310]575      over = 0
[175]576   end if
[162]577
[310]578   do varn = dim-1, 0, 1
[161]579     
[154]580      if( isStrSubset (vNam(varn), "time") )
581         check = False
[161]582      else
583         check = True
584      end if     
[190]585   
586      if (var .NE. "all") then
[161]587         check = isStrSubset( var,","+vNam(varn)+"," )
588      end if
[154]589 
590      if(check) then
[310]591       
[161]592        if (over .EQ. 1) then
[154]593 
[161]594            res@gsnLeftString       = "overlayed plot"
595            res@gsnRightString      = unit(varn)
[218]596            if (norm_t .NE. 1.)then
597               res@tiXAxisString        = "t ["+unit_t+"]"
598            else
599               res@tiXAxisString        = "t [s]"
600            end if
601            res@tiYAxisString = " "
602            res@tiXAxisFontHeightF   = font_size
603            res@txFontHeightF        = font_size
604            res@tiYAxisFontHeightF   = font_size           
[154]605
[161]606            if (vNam(varn) .EQ. "E")
607               E=0
608               res@xyLineColors     = (/237/)
609               res@xyLineLabelFontHeightF = 0.05
610               res@xyLineLabelFontColor   = 237
[310]611               res@trYMaxF           = maxE
612               res@trYMinF           = minE
[161]613               plot_E = gsn_csm_xy(wks_ps,t,data(varn,:),res)
614            end if
615            if (vNam(varn) .EQ. "Es")
616               Es=0
617               res@xyLineColors            = (/144/)
618               res@xyLineLabelFontHeightF = 0.05
619               res@xyLineLabelFontColor   = 144
620               plot_Es = gsn_csm_xy(wks_ps,t,data(varn,:),res)
621            end if
622             
623            if (vNam(varn) .EQ. "us")
624               us=0
625               res@xyLineColors            = (/237/)
626               res@xyLineLabelFontHeightF = 0.05
627               res@xyLineLabelFontColor   = 237
[310]628               res@trYMaxF           = maxus
629               res@trYMinF           = minus
[161]630               plot_us = gsn_csm_xy(wks_ps,t,data(varn,:),res)
631            end if             
632            if (vNam(varn) .EQ. "ws")
633               ws=0
634               res@xyLineColors            = (/144/)
635               res@xyLineLabelFontHeightF = 0.05
636               res@xyLineLabelFontColor   = 144
637               plot_ws = gsn_csm_xy(wks_ps,t,data(varn,:),res)
638            end if
639             
640            if (vNam(varn) .EQ. "umax")
641               u=0
642               res@xyLineColors            = (/237/)
643               res@xyLineLabelFontHeightF = 0.05
644               res@xyLineLabelFontColor   = 237
[310]645               res@trYMaxF           = maxu
646               res@trYMinF           = minu
[161]647               plot_umax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
648            end if
649            if (vNam(varn) .EQ. "vmax")
650               v=0
651               res@xyLineColors            = (/144/)
652               res@xyLineLabelFontHeightF = 0.05
653               res@xyLineLabelFontColor   = 144
654               plot_vmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
655            end if
656            if (vNam(varn) .EQ. "wmax")
657               w=0
658               res@xyLineColors            = (/80/)
659               res@xyLineLabelFontHeightF = 0.05
660               res@xyLineLabelFontColor   = 80
661               plot_wmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
662            end if
[154]663   
[161]664            if (vNam(varn) .EQ. "z_i_wpt")
665               zw=0
666               res@xyLineColors            = (/237/)
667               res@xyLineLabelFontHeightF = 0.05
668               res@xyLineLabelFontColor   = 237
[310]669               res@trYMaxF           = maxz
670               res@trYMinF           = minz
[161]671               plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
672            end if
673            if (vNam(varn) .EQ. "z_i_pt")
674               z=0
675               res@xyLineColors            = (/144/) 
676               res@xyLineLabelFontHeightF = 0.05
677               res@xyLineLabelFontColor   = 144
678               plot_z_i_pt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
679            end if
680
681            if (vNam(varn) .EQ. "wpptp0")
682               w0=0
683               res@xyLineColors            = (/237/)
684               res@xyLineLabelFontHeightF = 0.05
685               res@xyLineLabelFontColor   = 237
[310]686               res@trYMaxF           = maxw
687               res@trYMinF           = minw
[161]688               plot_wpptp0 = gsn_csm_xy(wks_ps,t,data(varn,:),res)
689            end if
690            if (vNam(varn) .EQ. "wpptp")
691               wp=0
692               res@xyLineColors            = (/144/)
693               res@xyLineLabelFontHeightF = 0.05
694               res@xyLineLabelFontColor   = 144
695               plot_wpptp = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
696            end if
697            if (vNam(varn) .EQ. "wpt")
698               wt=0
699               res@xyLineColors            = (/80/)
700               res@xyLineLabelFontHeightF = 0.05
701               res@xyLineLabelFontColor   = 80
702               plot_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
703            end if
704
705            if (vNam(varn) .EQ. "pt_0_")
706               p=0
707               res@xyLineColors            = (/237/)
708               res@xyLineLabelFontHeightF = 0.05
709               res@xyLineLabelFontColor   = 237
[310]710               res@trYMaxF           = maxp
711               res@trYMinF           = minp
[161]712               plot_pt_0_ = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
713            end if
714            if (vNam(varn) .EQ. "pt_zp_")
715               pz=0
716               res@xyLineColors            = (/144/)
717               res@xyLineLabelFontHeightF = 0.05
718               res@xyLineLabelFontColor   = 144
719               plot_pt_zp_ = gsn_csm_xy(wks_ps,t,data(varn,:),res)
720            end if
721
722            if (vNam(varn) .EQ. "splptx")
723               x=0
724               res@xyLineColors            = (/237/)
725               res@xyLineLabelFontHeightF = 0.05
726               res@xyLineLabelFontColor   = 237
[310]727               res@trYMaxF           = maxs
728               res@trYMinF           = mins
[161]729               plot_splptx = gsn_csm_xy(wks_ps,t,data(varn,:),res)   
730            end if
731            if (vNam(varn) .EQ. "splpty")
732               y=0
733               res@xyLineColors            = (/144/)
734               res@xyLineLabelFontHeightF = 0.05
735               res@xyLineLabelFontColor   = 144
736               plot_splpty = gsn_csm_xy(wks_ps,t,data(varn,:),res)
737            end if
738            if (vNam(varn) .EQ. "splptz")
739               z=0
740               res@xyLineColors            = (/80/)
741               res@xyLineLabelFontHeightF = 0.05
742               res@xyLineLabelFontColor   = 80
743               plot_splptz = gsn_csm_xy(wks_ps,t,data(varn,:),res)         
744            end if
745
746         end if
[154]747      end if
[161]748   end do
[310]749
750
751   do varn = dim-1, 0, 1
[161]752   
753      if( isStrSubset (vNam(varn), "time") )
754         check = False
755      else
756         check = True
757      end if   
[190]758 
759      if (var.NE. "all") then
[161]760         check = isStrSubset( var,","+vNam(varn)+"," )
761      end if
762   
763      if(check) then
764       
765         if (over .EQ. 1) then       
766       
767            if (vNam(varn) .EQ. "E" .AND. Es .NE. 1) then
768               E=1   
769               overlay(plot_E,plot_Es)
770               n=n+1
[162]771               plot_ps(n) = plot_E   
772
773               ; ***************************************************
774               ; legend for combined plot
775               ; ***************************************************
776     
777               lgres                    = True
778               lgMonoDashIndex          = False
779               lgres@lgLabelFont        = "helvetica"   
780               lgres@lgLabelFontHeightF = .1           
781               lgres@vpWidthF           = 0.4           
782               lgres@vpHeightF          = 0.4         
783               lgres@lgDashIndexes      = (/0,0,0/)
784               lgres@lgLineColors       = (/237,144,80/)
785               lbid = gsn_create_legend(wks_ps,2,(/"E","Es"/),lgres)       
786
787               amres = True
788               amres@amParallelPosF   = 0.6                 
789               amres@amOrthogonalPosF = -0.2           
790               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)           
[161]791            end if
792            if (vNam(varn) .EQ. "Es" .AND. E .NE. 1) then
793               Es=1
794               overlay(plot_E,plot_Es)
795               n=n+1
[162]796               plot_ps(n) = plot_E 
797
798               ; ***************************************************
799               ; legend for combined plot
800               ; ***************************************************
801     
802               lgres                    = True
803               lgMonoDashIndex          = False
804               lgres@lgLabelFont        = "helvetica"   
805               lgres@lgLabelFontHeightF = .1           
806               lgres@vpWidthF           = 0.4           
807               lgres@vpHeightF          = 0.4         
808               lgres@lgDashIndexes      = (/0,0,0/)
809               lgres@lgLineColors       = (/237,144,80/)
810               lbid = gsn_create_legend(wks_ps,2,(/"E","Es"/),lgres)       
811
812               amres = True
813               amres@amParallelPosF   = 0.6                 
814               amres@amOrthogonalPosF = -0.2           
815               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)         
[161]816            end if
817
818            if (vNam(varn) .EQ. "us" .AND. ws .NE. 1) then
819               us=1
820               overlay(plot_us,plot_ws)
821               n=n+1
822               plot_ps(n) = plot_us
[162]823
824               ; ***************************************************
825               ; legend for combined plot
826               ; ***************************************************
827     
828               lgres                    = True
829               lgMonoDashIndex          = False
830               lgres@lgLabelFont        = "helvetica"   
831               lgres@lgLabelFontHeightF = .1           
832               lgres@vpWidthF           = 0.4           
833               lgres@vpHeightF          = 0.4         
834               lgres@lgDashIndexes      = (/0,0,0/)
835               lgres@lgLineColors       = (/237,144,80/)
836               lbid = gsn_create_legend(wks_ps,2,(/"us","ws"/),lgres)       
837
838               amres = True
839               amres@amParallelPosF   = 0.6                 
840               amres@amOrthogonalPosF = -0.2           
841               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]842            end if
843            if (vNam(varn) .EQ. "ws" .AND. us .NE. 1) then
844               ws=1
845               overlay(plot_us,plot_ws)
846               n=n+1
847               plot_ps(n) = plot_us
[162]848
849               ; ***************************************************
850               ; legend for combined plot
851               ; ***************************************************
852     
853               lgres                    = True
854               lgMonoDashIndex          = False
855               lgres@lgLabelFont        = "helvetica"   
856               lgres@lgLabelFontHeightF = .1           
857               lgres@vpWidthF           = 0.4           
858               lgres@vpHeightF          = 0.4         
859               lgres@lgDashIndexes      = (/0,0,0/)
860               lgres@lgLineColors       = (/237,144,80/)
861               lbid = gsn_create_legend(wks_ps,2,(/"us","ws"/),lgres)       
862
863               amres = True
864               amres@amParallelPosF   = 0.6                 
865               amres@amOrthogonalPosF = -0.2           
866               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]867            end if
868         
869            if (vNam(varn) .EQ. "umax" .AND. v .NE. 1)
870               if (w .NE. 1) then
871                  u=1         
872                  overlay(plot_umax,plot_vmax)
873                  overlay(plot_umax,plot_wmax)
[310]874               
[161]875                  n=n+1
876                  plot_ps(n) = plot_umax
[162]877
878                  ; ***************************************************
879                  ; legend for combined plot
880                  ; ***************************************************
881     
882                  lgres                    = True
883                  lgMonoDashIndex          = False
884                  lgres@lgLabelFont        = "helvetica"   
885                  lgres@lgLabelFontHeightF = .1           
886                  lgres@vpWidthF           = 0.4           
887                  lgres@vpHeightF          = 0.4         
888                  lgres@lgDashIndexes      = (/0,0,0/)
889                  lgres@lgLineColors       = (/237,144,80/)
890                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
891
892                  amres = True
893                  amres@amParallelPosF   = 0.6             
894                  amres@amOrthogonalPosF = -0.2           
895                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]896               end if
897            end if
898            if (vNam(varn) .EQ. "vmax" .AND. u .NE. 1)
899               if (w .NE. 1) then
900                  v=1 
901                  overlay(plot_umax,plot_vmax)
902                  overlay(plot_umax,plot_wmax)
903                  n=n+1
904                  plot_ps(n) = plot_umax
[162]905
906                  ; ***************************************************
907                  ; legend for combined plot
908                  ; ***************************************************
909     
910                  lgres                    = True
911                  lgMonoDashIndex          = False
912                  lgres@lgLabelFont        = "helvetica"   
913                  lgres@lgLabelFontHeightF = .1         
914                  lgres@vpWidthF           = 0.4           
915                  lgres@vpHeightF          = 0.4         
916                  lgres@lgDashIndexes      = (/0,0,0/)
917                  lgres@lgLineColors       = (/237,144,80/)
918                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
919
920                  amres = True
921                  amres@amParallelPosF   = 0.6             
922                  amres@amOrthogonalPosF = -0.2           
923                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]924               end if
925            end if
926            if (vNam(varn) .EQ. "wmax" .AND. v .NE. 1)
927               if(u .NE. 1) then 
928                  w=1       
929                  overlay(plot_umax,plot_vmax)
930                  overlay(plot_umax,plot_wmax)
931                  n=n+1
932                  plot_ps(n) = plot_umax
[162]933
934                  ; ***************************************************
935                  ; legend for combined plot
936                  ; ***************************************************
937     
938                  lgres                    = True
939                  lgMonoDashIndex          = False
940                  lgres@lgLabelFont        = "helvetica"   
941                  lgres@lgLabelFontHeightF = .1           
942                  lgres@vpWidthF           = 0.4           
943                  lgres@vpHeightF          = 0.4         
944                  lgres@lgDashIndexes      = (/0,0,0/)
945                  lgres@lgLineColors       = (/237,144,80/)
946                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
947
948                  amres = True
949                  amres@amParallelPosF   = 0.6             
950                  amres@amOrthogonalPosF = -0.2           
951                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]952               end if
953            end if
954           
955            if (vNam(varn) .EQ. "z_i_wpt" .AND. z .NE. 1) then
956               zw=1       
957               overlay(plot_z_i_wpt,plot_z_i_pt)
958               n=n+1
[162]959               plot_ps(n) = plot_z_i_wpt
960       
961               ; ***************************************************
962               ; legend for combined plot
963               ; ***************************************************
964     
965               lgres                    = True
966               lgMonoDashIndex          = False
967               lgres@lgLabelFont        = "helvetica"   
968               lgres@lgLabelFontHeightF = .1           
969               lgres@vpWidthF           = 0.4           
970               lgres@vpHeightF          = 0.4         
971               lgres@lgDashIndexes      = (/0,0,0/)
972               lgres@lgLineColors       = (/237,144,80/)
973               lbid = gsn_create_legend(wks_ps,2,(/"z_i_wpt","z_i_pt"/),lgres)       
974
975               amres = True
976               amres@amParallelPosF   = 0.6                 
977               amres@amOrthogonalPosF = -0.2           
978               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)         
[161]979            end if
980            if (vNam(varn) .EQ. "z_i_pt" .AND. zw .NE. 1) then
981               z=1     
982               overlay(plot_z_i_wpt,plot_z_i_pt)
983               n=n+1
[162]984               plot_ps(n) = plot_z_i_wpt
985
986               ; ***************************************************
987               ; legend for combined plot
988               ; ***************************************************
989     
990               lgres                    = True
991               lgMonoDashIndex          = False
992               lgres@lgLabelFont        = "helvetica"   
993               lgres@lgLabelFontHeightF = .1           
994               lgres@vpWidthF           = 0.4           
995               lgres@vpHeightF          = 0.4         
996               lgres@lgDashIndexes      = (/0,0,0/)
997               lgres@lgLineColors       = (/237,144,80/)
998               lbid = gsn_create_legend(wks_ps,2,(/"z_i_wpt","z_i_pt"/),lgres)       
999
1000               amres = True
1001               amres@amParallelPosF   = 0.6                 
1002               amres@amOrthogonalPosF = -0.2           
1003               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)           
[161]1004            end if   
1005         
1006            if (vNam(varn) .EQ. "wpptp0" .AND. wp .NE. 1)
1007               if (wt .NE. 1) then
1008                  w0=1
1009                  overlay(plot_wpptp0,plot_wpptp)
1010                  overlay(plot_wpptp0,plot_wpt)
1011                  n=n+1
1012                  plot_ps(n) = plot_wpptp0
[162]1013
1014                  ; ***************************************************
1015                  ; legend for combined plot
1016                  ; ***************************************************
1017     
1018                  lgres                    = True
1019                  lgMonoDashIndex          = False
1020                  lgres@lgLabelFont        = "helvetica"   
1021                  lgres@lgLabelFontHeightF = .1           
1022                  lgres@vpWidthF           = 0.4           
1023                  lgres@vpHeightF          = 0.4         
1024                  lgres@lgDashIndexes      = (/0,0,0/)
1025                  lgres@lgLineColors       = (/237,144,80/)
1026                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1027
1028                  amres = True
1029                  amres@amParallelPosF   = 0.6             
1030                  amres@amOrthogonalPosF = -0.2           
1031                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1032               end if           
1033            end if
1034            if (vNam(varn) .EQ. "wpptp" .AND. w0 .NE. 1)
1035               if (wt .NE. 1) then
1036                 wp=1
1037                 overlay(plot_wpptp0,plot_wpptp)
1038                 overlay(plot_wpptp0,plot_wpt)
1039                 n=n+1
[162]1040                 plot_ps(n) = plot_wpptp0
1041                 
1042                 ; ***************************************************
1043                  ; legend for combined plot
1044                  ; ***************************************************
1045     
1046                  lgres                    = True
1047                  lgMonoDashIndex          = False
1048                  lgres@lgLabelFont        = "helvetica"   
1049                  lgres@lgLabelFontHeightF = .1           
1050                  lgres@vpWidthF           = 0.4           
1051                  lgres@vpHeightF          = 0.4         
1052                  lgres@lgDashIndexes      = (/0,0,0/)
1053                  lgres@lgLineColors       = (/237,144,80/)
1054                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1055
1056                  amres = True
1057                  amres@amParallelPosF   = 0.6             
1058                  amres@amOrthogonalPosF = -0.2           
1059                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres) 
[161]1060               end if           
1061            end if
1062            if (vNam(varn) .EQ. "wpt" .AND. wp .NE. 1)
1063               if (w0 .NE. 1) then
1064                  wt=1
1065                  overlay(plot_wpptp0,plot_wpptp)
1066                  overlay(plot_wpptp0,plot_wpt)
1067                  n=n+1
[162]1068                  plot_ps(n) = plot_wpptp0
1069
1070                  ; ***************************************************
1071                  ; legend for combined plot
1072                  ; ***************************************************
1073     
1074                  lgres                    = True
1075                  lgMonoDashIndex          = False
1076                  lgres@lgLabelFont        = "helvetica"   
1077                  lgres@lgLabelFontHeightF = .1           
1078                  lgres@vpWidthF           = 0.4           
1079                  lgres@vpHeightF          = 0.4         
1080                  lgres@lgDashIndexes      = (/0,0,0/)
1081                  lgres@lgLineColors       = (/237,144,80/)
1082                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1083
1084                  amres = True
1085                  amres@amParallelPosF   = 0.6             
1086                  amres@amOrthogonalPosF = -0.2           
1087                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1088               end if
1089            end if
1090
1091            if (vNam(varn) .EQ. "pt_0_" .AND. pz .NE. 1) then
1092               p=1     
1093               overlay(plot_pt_0_,plot_pt_zp_)
1094               n=n+1
[162]1095               plot_ps(n) = plot_pt_0_ 
1096     
1097               ; ***************************************************
1098               ; legend for combined plot
1099               ; ***************************************************
1100     
1101               lgres                    = True
1102               lgMonoDashIndex          = False
1103               lgres@lgLabelFont        = "helvetica"   
1104               lgres@lgLabelFontHeightF = .1           
1105               lgres@vpWidthF           = 0.4           
1106               lgres@vpHeightF          = 0.4         
1107               lgres@lgDashIndexes      = (/0,0,0/)
1108               lgres@lgLineColors       = (/237,144,80/)
1109               lbid = gsn_create_legend(wks_ps,2,(/"pt_0_","pt_zp_"/),lgres)       
1110
1111               amres = True
1112               amres@amParallelPosF   = 0.6                 
1113               amres@amOrthogonalPosF = -0.2           
1114               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1115            end if
1116            if (vNam(varn) .EQ. "pt_zp_" .AND. p .NE. 1) then
1117               pz=1       
1118               overlay(plot_pt_0_,plot_pt_zp_)
1119               n=n+1
[162]1120               plot_ps(n) = plot_pt_0_   
1121
1122               ; ***************************************************
1123               ; legend for combined plot
1124               ; ***************************************************
1125     
1126               lgres                    = True
1127               lgMonoDashIndex          = False
1128               lgres@lgLabelFont        = "helvetica"   
1129               lgres@lgLabelFontHeightF = .1           
1130               lgres@vpWidthF           = 0.4           
1131               lgres@vpHeightF          = 0.4         
1132               lgres@lgDashIndexes      = (/0,0,0/)
1133               lgres@lgLineColors       = (/237,144,80/)
1134               lbid = gsn_create_legend(wks_ps,2,(/"pt_0_","pt_zp_"/),lgres)       
1135
1136               amres = True
1137               amres@amParallelPosF   = 0.6                 
1138               amres@amOrthogonalPosF = -0.2           
1139               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1140            end if
1141           
1142            if (vNam(varn) .EQ. "splptx" .AND. y .NE. 1)
1143               if (z .NE.1 ) then
1144                  x=1     
1145                  overlay(plot_splptx,plot_splpty)
1146                  overlay(plot_splptx,plot_splptz)
1147                  n=n+1
[162]1148                  plot_ps(n) = plot_splptx   
1149
1150                  ; ***************************************************
1151                  ; legend for combined plot
1152                  ; ***************************************************
1153     
1154                  lgres                    = True
1155                  lgMonoDashIndex          = False
1156                  lgres@lgLabelFont        = "helvetica"   
1157                  lgres@lgLabelFontHeightF = .1           
1158                  lgres@vpWidthF           = 0.4           
1159                  lgres@vpHeightF          = 0.4         
1160                  lgres@lgDashIndexes      = (/0,0,0/)
1161                  lgres@lgLineColors       = (/237,144,80/)
1162                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1163
1164                  amres = True
1165                  amres@amParallelPosF   = 0.6             
1166                  amres@amOrthogonalPosF = -0.2           
1167                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1168               end if
1169            end if
1170            if (vNam(varn) .EQ. "splpty" .AND. x .NE. 1)
1171               if(z .NE.1 ) then
1172                  y=1         
1173                  overlay(plot_splptx,plot_splpty)
1174                  overlay(plot_splptx,plot_splptz)
1175                  n=n+1
1176                  plot_ps(n) = plot_splptx
[162]1177
1178                  ; ***************************************************
1179                  ; legend for combined plot
1180                  ; ***************************************************
1181     
1182                  lgres                    = True
1183                  lgMonoDashIndex          = False
1184                  lgres@lgLabelFont        = "helvetica"   
1185                  lgres@lgLabelFontHeightF = .1           
1186                  lgres@vpWidthF           = 0.4           
1187                  lgres@vpHeightF          = 0.4         
1188                  lgres@lgDashIndexes      = (/0,0,0/)
1189                  lgres@lgLineColors       = (/237,144,80/)
1190                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1191
1192                  amres = True
1193                  amres@amParallelPosF   = 0.6             
1194                  amres@amOrthogonalPosF = -0.2           
1195                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1196               end if           
1197            end if
1198            if (vNam(varn) .EQ. "splptz" .AND. y .NE. 1)
1199               if(x .NE.1 ) then
1200                  z=1         
1201                  overlay(plot_splptx,plot_splpty)
1202                  overlay(plot_splptx,plot_splptz)
1203                  n=n+1
[162]1204                  plot_ps(n) = plot_splptx 
1205
1206                  ; ***************************************************
1207                  ; legend for combined plot
1208                  ; ***************************************************
1209     
1210                  lgres                    = True
1211                  lgMonoDashIndex          = False
1212                  lgres@lgLabelFont        = "helvetica"   
1213                  lgres@lgLabelFontHeightF = .1           
1214                  lgres@vpWidthF           = 0.4           
1215                  lgres@vpHeightF          = 0.4         
1216                  lgres@lgDashIndexes      = (/0,0,0/)
1217                  lgres@lgLineColors       = (/237,144,80/)
1218                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1219
1220                  amres = True
1221                  amres@amParallelPosF   = 0.6             
1222                  amres@amOrthogonalPosF = -0.2           
1223                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1224               end if       
1225            end if
1226
1227            if(vNam(varn) .NE. "splptz" .AND. vNam(varn) .NE. "splpty" .AND. vNam(varn) .NE. "splptx" .AND. vNam(varn) .NE. "pt_zp_" .AND. vNam(varn) .NE. "pt_0_" .AND. vNam(varn) .NE. "wpt" .AND. vNam(varn) .NE. "wpptp" .AND. vNam(varn) .NE. "wpptp0" .AND. vNam(varn) .NE. "z_i_pt" .AND. vNam(varn) .NE. "z_i_wpt" .AND. vNam(varn) .NE. "wmax" .AND. vNam(varn) .NE. "vmax" .AND. vNam(varn) .NE. "umax" .AND. vNam(varn) .NE. "ws" .AND.  vNam(varn) .NE. "us" .AND. vNam(varn) .NE. "Es" .AND. vNam(varn) .NE. "E") then
1228               n=n+1
1229               res@xyLineColors   = (/237/)
1230               res@xyLabelMode    = False
1231               res@gsnLeftString  = vNam(varn)
1232               res@gsnRightString = unit(varn)
[310]1233               res@trYMaxF        = max(data(varn,:))
1234               res@trYMinF        = min(data(varn,:))
[161]1235               if (min(data(varn,:)) .EQ. max(data(varn,:))) then
1236                  if (min(data(varn,:)) .EQ. 0)then
[310]1237                     res@trYMaxF = max(data(varn,:))-0.1
1238                     res@trYMinF = min(data(varn,:))+0.1
[161]1239                  end if
1240                  if (min(data(varn,:)) .LT. 0)then
[310]1241                     res@trYMaxF = max(data(varn,:))+(min(data(varn,:)))/2
1242                     res@trYMinF = min(data(varn,:))-(max(data(varn,:)))/2
[161]1243                  end if
1244                  if (min(data(varn,:)) .GT. 0)then
[310]1245                     res@trYMaxF = max(data(varn,:))-(min(data(varn,:)))/2
1246                     res@trYMinF = min(data(varn,:))+(max(data(varn,:)))/2
[161]1247                  end if
1248               end if
1249               plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
1250            end if
[310]1251
1252            ; ***************************************************
1253            ; transparent legend as placeholder for single plots
1254            ; ***************************************************
1255            lgresmono                    = True
1256            lgMonoDashIndex              = False
1257            lgresmono@lgMonoLineColor    = True
1258            lgresmono@lgLabelFont        = "helvetica"   
1259            lgresmono@lgLabelFontHeightF = .1           
1260            lgresmono@vpWidthF           = 0.4           
1261            lgresmono@vpHeightF          = 0.4         
1262            lgresmono@lgLineColor        = 0
1263            lgresmono@lgPerimOn          = False
1264            lbid = gsn_create_legend(wks_ps,1,(/""/),lgresmono)       
1265
1266            amres = True
1267            amres@amParallelPosF   = 0.6                   
1268            amres@amOrthogonalPosF = -0.2           
1269            annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1270       
1271         else
1272           
1273            print("plot of " + vNam(varn))
1274           
1275            n=n+1
1276            res@xyLineColors            = (/237/)
1277            res@gsnLeftString       = vNam(varn)
1278            res@gsnRightString      = unit(varn)
[310]1279       
[218]1280            if (norm_t .NE. 1.)then
1281               res@tiXAxisString        = "t ["+unit_t+"]"
1282            else
1283               res@tiXAxisString        = "t [s]"
1284            end if
1285            res@tiYAxisString = " "
1286            res@tiXAxisFontHeightF   = font_size
1287            res@txFontHeightF        = font_size
1288            res@tiYAxisFontHeightF   = font_size
1289            res@tmXBLabelFontHeightF = font_size
1290            res@tmYLLabelFontHeightF = font_size
[310]1291            res@trYMaxF        = max(data(varn,:))
1292            res@trYMinF        = min(data(varn,:))
[161]1293            if (min(data(varn,:)) .EQ. max(data(varn,:))) then
1294               if (min(data(varn,:)) .EQ. 0)then
[310]1295                     res@trYMaxF = max(data(varn,:))-0.1
1296                     res@trYMinF = min(data(varn,:))+0.1
[161]1297                  end if
1298                  if (min(data(varn,:)) .LT. 0)then
[310]1299                     res@trYMaxF = max(data(varn,:))+(min(data(varn,:)))/2
1300                     res@trYMinF = min(data(varn,:))-(max(data(varn,:)))/2
[161]1301                  end if
1302                  if (min(data(varn,:)) .GT. 0)then
[310]1303                     res@trYMaxF = max(data(varn,:))-(min(data(varn,:)))/2
1304                     res@trYMinF = min(data(varn,:))+(max(data(varn,:)))/2
[161]1305                  end if
1306            end if
1307            plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res)
1308           
1309         end if     
1310      end if
[154]1311   end do
[161]1312 
[154]1313   ; ***************************************************
1314   ; merge plots onto one page
1315   ; ***************************************************
[162]1316 
[161]1317   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
1318      gsn_panel(wks_ps,plot_ps(1:n),(/n,1/),resP)
[250]1319      print(" ")
1320      print("Outputs to .eps or .epsi have only one frame")
1321      print(" ")
[161]1322   else
[218]1323      do np = 1,n,no_rows*no_columns   
1324         if ( np + no_rows*no_columns .gt. n) then   
1325            gsn_panel(wks_ps, plot_ps(np:n),(/no_rows,no_columns/),resP)
[161]1326         else
[218]1327            gsn_panel(wks_ps, plot_ps(np:np+no_rows*no_columns-1),(/no_rows,no_columns/),resP)
[161]1328         end if
1329      end do
1330   end if
[154]1331
1332   print(" ")
1333   print("Output to: " + file_out +"."+ format_out)
1334   print(" ")
1335 
1336end
Note: See TracBrowser for help on using the repository browser.