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

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

Plots of timeseries appear in the order specified in the variable var.

File size: 51.3 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
360      indices = new((/comma/), integer)
361      comma   = 0
362       
363      do j = 0, no_char-1
364         if(var_char(j) .eq. ",")
365           indices(comma) = j
366           comma = comma + 1
367         end if
368      end do
369
370      do j = 0, comma -2
371         vNam_temp(j) = charactertostring(var_char(indices(j)+1:indices(j+1)-1))
372      end do
373     
374      delete(vNam)
375      vNam = new((/comma-1/),string)
376      do varn = 0, comma - 2
377         vNam(varn) = vNam_temp(comma - 2 - varn)
378      end do
379     
380      do j = 0, comma-2
381        count_check = 0
382        do varn = 0, dim-1
383           if(vNam(j) .ne. vNam_static(varn))
384             count_check=count_check+1
385           end if
386        end do 
387   
388        if(count_check .eq. dim)
389            print(" ")
390            print("The variables 'var="+var+"'" )
391            print("do not exist on your input file;")
392            print("be sure to have one comma before and after each variable")
393            print(" ")
394            exit
395        end if
396      end do
397
398      dim = comma-1
399    end if
400
401
402   do varn = dim-1, 0, 1
403
[161]404      if( isStrSubset (vNam(varn), "time") )
405         check = False
406      else
407         check = True
[310]408      end if
[161]409     
410      if(check) then
[162]411
[218]412         data_all = f[:]->$vNam(varn)$
413         data_att = f_att->$vNam(varn)$
414         unit(varn) = data_att@units
[310]415 
416     
[161]417         data(varn,:)=data_all(start_time_step:end_time_step)
418         
419         if (over .EQ. 1) then
420
421            mini(varn) = min(data(varn,:))
422            maxi(varn) = max(data(varn,:))
423           
424            if (vNam(varn) .EQ. "E" .OR. vNam(varn) .EQ. "Es") then
425               if (mini(varn) .EQ. maxi(varn)) then
426                  if (min(data(varn,:)) .EQ. 0)then
[218]427                     mini(varn)= mini(varn)-0.1
428                     maxi(varn)= maxi(varn)+0.1
[161]429                  end if
430                  if (min(data(varn,:)) .LT. 0)then
431                     mini(varn)= mini(varn)-1.+(mini(varn))/2
432                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
433                  end if
434                  if (min(data(varn,:)) .GT. 0)then
435                     mini(varn)= mini(varn)-1.-(mini(varn))/2
436                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
437                  end if
438               end if
439               minE=min((/minE,mini(varn)/))
440               maxE=max((/maxE,maxi(varn)/))
441            end if
442
443            if (vNam(varn) .EQ. "us" .OR. vNam(varn) .EQ. "ws") then
444               if (mini(varn) .EQ. maxi(varn)) then
445                  if (min(data(varn,:)) .EQ. 0)then
[218]446                     mini(varn)= mini(varn)-0.1
447                     maxi(varn)= maxi(varn)+0.1
[161]448                  end if
449                  if (min(data(varn,:)) .LT. 0)then
450                     mini(varn)= mini(varn)-1.+(mini(varn))/2
451                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
452                  end if
453                  if (min(data(varn,:)) .GT. 0)then
454                     mini(varn)= mini(varn)-1.-(mini(varn))/2
455                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
456                  end if
457               end if
458               minus=min((/minus,mini(varn)/))
459               maxus=max((/maxus,maxi(varn)/))
460            end if
461
462            if (vNam(varn) .EQ. "umax" .OR. vNam(varn) .EQ. "vmax" .OR. vNam(varn) .EQ. "wmax") then
463               if (mini(varn) .EQ. maxi(varn)) then
464                  if (mini(varn) .EQ. 0)then
[218]465                     mini(varn)= mini(varn)-0.1
466                     maxi(varn)= maxi(varn)+0.1
[161]467                  end if
468                  if (mini(varn) .LT. 0)then
469                     mini(varn)= mini(varn)-1.+(mini(varn))/2
470                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
471                  end if
472                  if (mini(varn) .GT. 0)then
473                     mini(varn)= mini(varn)-1.-(mini(varn))/2
474                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
475                  end if
476               end if
477               minu=min((/minu,mini(varn)/))
478               maxu=max((/maxu,maxi(varn)/))
479            end if
480
481            if (vNam(varn) .EQ. "z_i_wpt" .OR. vNam(varn) .EQ. "z_i_pt") then
482               if (mini(varn) .EQ. maxi(varn)) then
483                  if (min(data(varn,:)) .EQ. 0)then
[218]484                     mini(varn)= mini(varn)-0.1
485                     maxi(varn)= maxi(varn)+0.1
[161]486                  end if
487                  if (min(data(varn,:)) .LT. 0)then
488                     mini(varn)= mini(varn)-1.+(mini(varn))/2
489                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
490                  end if
491                  if (min(data(varn,:)) .GT. 0)then
492                     mini(varn)= mini(varn)-1.-(mini(varn))/2
493                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
494                  end if
495               end if
496               minz=min((/minz,mini(varn)/))
497               maxz=max((/maxz,maxi(varn)/))
498            end if
499
500            if (vNam(varn) .EQ. "wpptp0" .OR. vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "wpt") then
501               if (mini(varn) .EQ. maxi(varn)) then
502                  if (min(data(varn,:)) .EQ. 0)then
[218]503                     mini(varn)= mini(varn)-0.1
504                     maxi(varn)= maxi(varn)+0.1
[161]505                  end if
506                  if (min(data(varn,:)) .LT. 0)then
507                     mini(varn)= mini(varn)-1.+(mini(varn))/2
508                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
509                  end if
510                  if (min(data(varn,:)) .GT. 0)then
511                     mini(varn)= mini(varn)-1.-(mini(varn))/2
512                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
513                  end if
514               end if
515               minw=min((/minw,mini(varn)/))
516               maxw=max((/maxw,maxi(varn)/))
517            end if
518
519            if (vNam(varn) .EQ. "pt_0_" .OR. vNam(varn) .EQ. "pt_zp_") then
520               if (mini(varn) .EQ. maxi(varn)) then
521                  if (min(data(varn,:)) .EQ. 0)then
[218]522                     mini(varn)= mini(varn)-0.1
523                     maxi(varn)= maxi(varn)+0.1
[161]524                  end if
525                  if (min(data(varn,:)) .LT. 0)then
526                     mini(varn)= mini(varn)-1.+(mini(varn))/2
527                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
528                  end if
529                  if (min(data(varn,:)) .GT. 0)then
530                     mini(varn)= mini(varn)-1.-(mini(varn))/2
531                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
532                  end if
533               end if
534               minp=min((/minp,mini(varn)/))
535               maxp=max((/maxp,maxi(varn)/))
536            end if
537
538            if (vNam(varn) .EQ. "splptx" .OR. vNam(varn) .EQ. "splpty" .OR. vNam(varn) .EQ. "splptz") then
539               if (mini(varn) .EQ. maxi(varn)) then
540                  if (min(data(varn,:)) .EQ. 0)then
[218]541                     mini(varn)= mini(varn)-0.1
542                     maxi(varn)= maxi(varn)+0.1
[161]543                  end if
544                  if (min(data(varn,:)) .LT. 0)then
545                     mini(varn)= mini(varn)-1.+(mini(varn))/2
546                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
547                  end if
548                  if (min(data(varn,:)) .GT. 0)then
549                     mini(varn)= mini(varn)-1.-(mini(varn))/2
550                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
551                  end if
552               end if
553               mins=min((/mins,mini(varn)/))
554               maxs=max((/maxs,maxi(varn)/))
555            end if
556           
557         end if
558      end if
559   end do
[310]560 
561  if (isStrSubset(data@long_name," SR " ))then
[162]562      print(" ")
[310]563      print("If you have outputs of statistic regions you cannot overlay variables;")
564      print("'over' is set to 0" )
[162]565      print(" ")
[310]566      over = 0
[175]567   end if
[162]568
[310]569   do varn = dim-1, 0, 1
[161]570     
[154]571      if( isStrSubset (vNam(varn), "time") )
572         check = False
[161]573      else
574         check = True
575      end if     
[190]576   
577      if (var .NE. "all") then
[161]578         check = isStrSubset( var,","+vNam(varn)+"," )
579      end if
[154]580 
581      if(check) then
[310]582       
[161]583        if (over .EQ. 1) then
[154]584 
[161]585            res@gsnLeftString       = "overlayed plot"
586            res@gsnRightString      = unit(varn)
[218]587            if (norm_t .NE. 1.)then
588               res@tiXAxisString        = "t ["+unit_t+"]"
589            else
590               res@tiXAxisString        = "t [s]"
591            end if
592            res@tiYAxisString = " "
593            res@tiXAxisFontHeightF   = font_size
594            res@txFontHeightF        = font_size
595            res@tiYAxisFontHeightF   = font_size           
[154]596
[161]597            if (vNam(varn) .EQ. "E")
598               E=0
599               res@xyLineColors     = (/237/)
600               res@xyLineLabelFontHeightF = 0.05
601               res@xyLineLabelFontColor   = 237
[310]602               res@trYMaxF           = maxE
603               res@trYMinF           = minE
[161]604               plot_E = gsn_csm_xy(wks_ps,t,data(varn,:),res)
605            end if
606            if (vNam(varn) .EQ. "Es")
607               Es=0
608               res@xyLineColors            = (/144/)
609               res@xyLineLabelFontHeightF = 0.05
610               res@xyLineLabelFontColor   = 144
611               plot_Es = gsn_csm_xy(wks_ps,t,data(varn,:),res)
612            end if
613             
614            if (vNam(varn) .EQ. "us")
615               us=0
616               res@xyLineColors            = (/237/)
617               res@xyLineLabelFontHeightF = 0.05
618               res@xyLineLabelFontColor   = 237
[310]619               res@trYMaxF           = maxus
620               res@trYMinF           = minus
[161]621               plot_us = gsn_csm_xy(wks_ps,t,data(varn,:),res)
622            end if             
623            if (vNam(varn) .EQ. "ws")
624               ws=0
625               res@xyLineColors            = (/144/)
626               res@xyLineLabelFontHeightF = 0.05
627               res@xyLineLabelFontColor   = 144
628               plot_ws = gsn_csm_xy(wks_ps,t,data(varn,:),res)
629            end if
630             
631            if (vNam(varn) .EQ. "umax")
632               u=0
633               res@xyLineColors            = (/237/)
634               res@xyLineLabelFontHeightF = 0.05
635               res@xyLineLabelFontColor   = 237
[310]636               res@trYMaxF           = maxu
637               res@trYMinF           = minu
[161]638               plot_umax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
639            end if
640            if (vNam(varn) .EQ. "vmax")
641               v=0
642               res@xyLineColors            = (/144/)
643               res@xyLineLabelFontHeightF = 0.05
644               res@xyLineLabelFontColor   = 144
645               plot_vmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
646            end if
647            if (vNam(varn) .EQ. "wmax")
648               w=0
649               res@xyLineColors            = (/80/)
650               res@xyLineLabelFontHeightF = 0.05
651               res@xyLineLabelFontColor   = 80
652               plot_wmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
653            end if
[154]654   
[161]655            if (vNam(varn) .EQ. "z_i_wpt")
656               zw=0
657               res@xyLineColors            = (/237/)
658               res@xyLineLabelFontHeightF = 0.05
659               res@xyLineLabelFontColor   = 237
[310]660               res@trYMaxF           = maxz
661               res@trYMinF           = minz
[161]662               plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
663            end if
664            if (vNam(varn) .EQ. "z_i_pt")
665               z=0
666               res@xyLineColors            = (/144/) 
667               res@xyLineLabelFontHeightF = 0.05
668               res@xyLineLabelFontColor   = 144
669               plot_z_i_pt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
670            end if
671
672            if (vNam(varn) .EQ. "wpptp0")
673               w0=0
674               res@xyLineColors            = (/237/)
675               res@xyLineLabelFontHeightF = 0.05
676               res@xyLineLabelFontColor   = 237
[310]677               res@trYMaxF           = maxw
678               res@trYMinF           = minw
[161]679               plot_wpptp0 = gsn_csm_xy(wks_ps,t,data(varn,:),res)
680            end if
681            if (vNam(varn) .EQ. "wpptp")
682               wp=0
683               res@xyLineColors            = (/144/)
684               res@xyLineLabelFontHeightF = 0.05
685               res@xyLineLabelFontColor   = 144
686               plot_wpptp = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
687            end if
688            if (vNam(varn) .EQ. "wpt")
689               wt=0
690               res@xyLineColors            = (/80/)
691               res@xyLineLabelFontHeightF = 0.05
692               res@xyLineLabelFontColor   = 80
693               plot_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
694            end if
695
696            if (vNam(varn) .EQ. "pt_0_")
697               p=0
698               res@xyLineColors            = (/237/)
699               res@xyLineLabelFontHeightF = 0.05
700               res@xyLineLabelFontColor   = 237
[310]701               res@trYMaxF           = maxp
702               res@trYMinF           = minp
[161]703               plot_pt_0_ = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
704            end if
705            if (vNam(varn) .EQ. "pt_zp_")
706               pz=0
707               res@xyLineColors            = (/144/)
708               res@xyLineLabelFontHeightF = 0.05
709               res@xyLineLabelFontColor   = 144
710               plot_pt_zp_ = gsn_csm_xy(wks_ps,t,data(varn,:),res)
711            end if
712
713            if (vNam(varn) .EQ. "splptx")
714               x=0
715               res@xyLineColors            = (/237/)
716               res@xyLineLabelFontHeightF = 0.05
717               res@xyLineLabelFontColor   = 237
[310]718               res@trYMaxF           = maxs
719               res@trYMinF           = mins
[161]720               plot_splptx = gsn_csm_xy(wks_ps,t,data(varn,:),res)   
721            end if
722            if (vNam(varn) .EQ. "splpty")
723               y=0
724               res@xyLineColors            = (/144/)
725               res@xyLineLabelFontHeightF = 0.05
726               res@xyLineLabelFontColor   = 144
727               plot_splpty = gsn_csm_xy(wks_ps,t,data(varn,:),res)
728            end if
729            if (vNam(varn) .EQ. "splptz")
730               z=0
731               res@xyLineColors            = (/80/)
732               res@xyLineLabelFontHeightF = 0.05
733               res@xyLineLabelFontColor   = 80
734               plot_splptz = gsn_csm_xy(wks_ps,t,data(varn,:),res)         
735            end if
736
737         end if
[154]738      end if
[161]739   end do
[310]740
741
742   do varn = dim-1, 0, 1
[161]743   
744      if( isStrSubset (vNam(varn), "time") )
745         check = False
746      else
747         check = True
748      end if   
[190]749 
750      if (var.NE. "all") then
[161]751         check = isStrSubset( var,","+vNam(varn)+"," )
752      end if
753   
754      if(check) then
755       
756         if (over .EQ. 1) then       
757       
758            if (vNam(varn) .EQ. "E" .AND. Es .NE. 1) then
759               E=1   
760               overlay(plot_E,plot_Es)
761               n=n+1
[162]762               plot_ps(n) = plot_E   
763
764               ; ***************************************************
765               ; legend for combined plot
766               ; ***************************************************
767     
768               lgres                    = True
769               lgMonoDashIndex          = False
770               lgres@lgLabelFont        = "helvetica"   
771               lgres@lgLabelFontHeightF = .1           
772               lgres@vpWidthF           = 0.4           
773               lgres@vpHeightF          = 0.4         
774               lgres@lgDashIndexes      = (/0,0,0/)
775               lgres@lgLineColors       = (/237,144,80/)
776               lbid = gsn_create_legend(wks_ps,2,(/"E","Es"/),lgres)       
777
778               amres = True
779               amres@amParallelPosF   = 0.6                 
780               amres@amOrthogonalPosF = -0.2           
781               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)           
[161]782            end if
783            if (vNam(varn) .EQ. "Es" .AND. E .NE. 1) then
784               Es=1
785               overlay(plot_E,plot_Es)
786               n=n+1
[162]787               plot_ps(n) = plot_E 
788
789               ; ***************************************************
790               ; legend for combined plot
791               ; ***************************************************
792     
793               lgres                    = True
794               lgMonoDashIndex          = False
795               lgres@lgLabelFont        = "helvetica"   
796               lgres@lgLabelFontHeightF = .1           
797               lgres@vpWidthF           = 0.4           
798               lgres@vpHeightF          = 0.4         
799               lgres@lgDashIndexes      = (/0,0,0/)
800               lgres@lgLineColors       = (/237,144,80/)
801               lbid = gsn_create_legend(wks_ps,2,(/"E","Es"/),lgres)       
802
803               amres = True
804               amres@amParallelPosF   = 0.6                 
805               amres@amOrthogonalPosF = -0.2           
806               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)         
[161]807            end if
808
809            if (vNam(varn) .EQ. "us" .AND. ws .NE. 1) then
810               us=1
811               overlay(plot_us,plot_ws)
812               n=n+1
813               plot_ps(n) = plot_us
[162]814
815               ; ***************************************************
816               ; legend for combined plot
817               ; ***************************************************
818     
819               lgres                    = True
820               lgMonoDashIndex          = False
821               lgres@lgLabelFont        = "helvetica"   
822               lgres@lgLabelFontHeightF = .1           
823               lgres@vpWidthF           = 0.4           
824               lgres@vpHeightF          = 0.4         
825               lgres@lgDashIndexes      = (/0,0,0/)
826               lgres@lgLineColors       = (/237,144,80/)
827               lbid = gsn_create_legend(wks_ps,2,(/"us","ws"/),lgres)       
828
829               amres = True
830               amres@amParallelPosF   = 0.6                 
831               amres@amOrthogonalPosF = -0.2           
832               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]833            end if
834            if (vNam(varn) .EQ. "ws" .AND. us .NE. 1) then
835               ws=1
836               overlay(plot_us,plot_ws)
837               n=n+1
838               plot_ps(n) = plot_us
[162]839
840               ; ***************************************************
841               ; legend for combined plot
842               ; ***************************************************
843     
844               lgres                    = True
845               lgMonoDashIndex          = False
846               lgres@lgLabelFont        = "helvetica"   
847               lgres@lgLabelFontHeightF = .1           
848               lgres@vpWidthF           = 0.4           
849               lgres@vpHeightF          = 0.4         
850               lgres@lgDashIndexes      = (/0,0,0/)
851               lgres@lgLineColors       = (/237,144,80/)
852               lbid = gsn_create_legend(wks_ps,2,(/"us","ws"/),lgres)       
853
854               amres = True
855               amres@amParallelPosF   = 0.6                 
856               amres@amOrthogonalPosF = -0.2           
857               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]858            end if
859         
860            if (vNam(varn) .EQ. "umax" .AND. v .NE. 1)
861               if (w .NE. 1) then
862                  u=1         
863                  overlay(plot_umax,plot_vmax)
864                  overlay(plot_umax,plot_wmax)
[310]865               
[161]866                  n=n+1
867                  plot_ps(n) = plot_umax
[162]868
869                  ; ***************************************************
870                  ; legend for combined plot
871                  ; ***************************************************
872     
873                  lgres                    = True
874                  lgMonoDashIndex          = False
875                  lgres@lgLabelFont        = "helvetica"   
876                  lgres@lgLabelFontHeightF = .1           
877                  lgres@vpWidthF           = 0.4           
878                  lgres@vpHeightF          = 0.4         
879                  lgres@lgDashIndexes      = (/0,0,0/)
880                  lgres@lgLineColors       = (/237,144,80/)
881                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
882
883                  amres = True
884                  amres@amParallelPosF   = 0.6             
885                  amres@amOrthogonalPosF = -0.2           
886                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]887               end if
888            end if
889            if (vNam(varn) .EQ. "vmax" .AND. u .NE. 1)
890               if (w .NE. 1) then
891                  v=1 
892                  overlay(plot_umax,plot_vmax)
893                  overlay(plot_umax,plot_wmax)
894                  n=n+1
895                  plot_ps(n) = plot_umax
[162]896
897                  ; ***************************************************
898                  ; legend for combined plot
899                  ; ***************************************************
900     
901                  lgres                    = True
902                  lgMonoDashIndex          = False
903                  lgres@lgLabelFont        = "helvetica"   
904                  lgres@lgLabelFontHeightF = .1         
905                  lgres@vpWidthF           = 0.4           
906                  lgres@vpHeightF          = 0.4         
907                  lgres@lgDashIndexes      = (/0,0,0/)
908                  lgres@lgLineColors       = (/237,144,80/)
909                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
910
911                  amres = True
912                  amres@amParallelPosF   = 0.6             
913                  amres@amOrthogonalPosF = -0.2           
914                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]915               end if
916            end if
917            if (vNam(varn) .EQ. "wmax" .AND. v .NE. 1)
918               if(u .NE. 1) then 
919                  w=1       
920                  overlay(plot_umax,plot_vmax)
921                  overlay(plot_umax,plot_wmax)
922                  n=n+1
923                  plot_ps(n) = plot_umax
[162]924
925                  ; ***************************************************
926                  ; legend for combined plot
927                  ; ***************************************************
928     
929                  lgres                    = True
930                  lgMonoDashIndex          = False
931                  lgres@lgLabelFont        = "helvetica"   
932                  lgres@lgLabelFontHeightF = .1           
933                  lgres@vpWidthF           = 0.4           
934                  lgres@vpHeightF          = 0.4         
935                  lgres@lgDashIndexes      = (/0,0,0/)
936                  lgres@lgLineColors       = (/237,144,80/)
937                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
938
939                  amres = True
940                  amres@amParallelPosF   = 0.6             
941                  amres@amOrthogonalPosF = -0.2           
942                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]943               end if
944            end if
945           
946            if (vNam(varn) .EQ. "z_i_wpt" .AND. z .NE. 1) then
947               zw=1       
948               overlay(plot_z_i_wpt,plot_z_i_pt)
949               n=n+1
[162]950               plot_ps(n) = plot_z_i_wpt
951       
952               ; ***************************************************
953               ; legend for combined plot
954               ; ***************************************************
955     
956               lgres                    = True
957               lgMonoDashIndex          = False
958               lgres@lgLabelFont        = "helvetica"   
959               lgres@lgLabelFontHeightF = .1           
960               lgres@vpWidthF           = 0.4           
961               lgres@vpHeightF          = 0.4         
962               lgres@lgDashIndexes      = (/0,0,0/)
963               lgres@lgLineColors       = (/237,144,80/)
964               lbid = gsn_create_legend(wks_ps,2,(/"z_i_wpt","z_i_pt"/),lgres)       
965
966               amres = True
967               amres@amParallelPosF   = 0.6                 
968               amres@amOrthogonalPosF = -0.2           
969               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)         
[161]970            end if
971            if (vNam(varn) .EQ. "z_i_pt" .AND. zw .NE. 1) then
972               z=1     
973               overlay(plot_z_i_wpt,plot_z_i_pt)
974               n=n+1
[162]975               plot_ps(n) = plot_z_i_wpt
976
977               ; ***************************************************
978               ; legend for combined plot
979               ; ***************************************************
980     
981               lgres                    = True
982               lgMonoDashIndex          = False
983               lgres@lgLabelFont        = "helvetica"   
984               lgres@lgLabelFontHeightF = .1           
985               lgres@vpWidthF           = 0.4           
986               lgres@vpHeightF          = 0.4         
987               lgres@lgDashIndexes      = (/0,0,0/)
988               lgres@lgLineColors       = (/237,144,80/)
989               lbid = gsn_create_legend(wks_ps,2,(/"z_i_wpt","z_i_pt"/),lgres)       
990
991               amres = True
992               amres@amParallelPosF   = 0.6                 
993               amres@amOrthogonalPosF = -0.2           
994               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)           
[161]995            end if   
996         
997            if (vNam(varn) .EQ. "wpptp0" .AND. wp .NE. 1)
998               if (wt .NE. 1) then
999                  w0=1
1000                  overlay(plot_wpptp0,plot_wpptp)
1001                  overlay(plot_wpptp0,plot_wpt)
1002                  n=n+1
1003                  plot_ps(n) = plot_wpptp0
[162]1004
1005                  ; ***************************************************
1006                  ; legend for combined plot
1007                  ; ***************************************************
1008     
1009                  lgres                    = True
1010                  lgMonoDashIndex          = False
1011                  lgres@lgLabelFont        = "helvetica"   
1012                  lgres@lgLabelFontHeightF = .1           
1013                  lgres@vpWidthF           = 0.4           
1014                  lgres@vpHeightF          = 0.4         
1015                  lgres@lgDashIndexes      = (/0,0,0/)
1016                  lgres@lgLineColors       = (/237,144,80/)
1017                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1018
1019                  amres = True
1020                  amres@amParallelPosF   = 0.6             
1021                  amres@amOrthogonalPosF = -0.2           
1022                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1023               end if           
1024            end if
1025            if (vNam(varn) .EQ. "wpptp" .AND. w0 .NE. 1)
1026               if (wt .NE. 1) then
1027                 wp=1
1028                 overlay(plot_wpptp0,plot_wpptp)
1029                 overlay(plot_wpptp0,plot_wpt)
1030                 n=n+1
[162]1031                 plot_ps(n) = plot_wpptp0
1032                 
1033                 ; ***************************************************
1034                  ; legend for combined plot
1035                  ; ***************************************************
1036     
1037                  lgres                    = True
1038                  lgMonoDashIndex          = False
1039                  lgres@lgLabelFont        = "helvetica"   
1040                  lgres@lgLabelFontHeightF = .1           
1041                  lgres@vpWidthF           = 0.4           
1042                  lgres@vpHeightF          = 0.4         
1043                  lgres@lgDashIndexes      = (/0,0,0/)
1044                  lgres@lgLineColors       = (/237,144,80/)
1045                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1046
1047                  amres = True
1048                  amres@amParallelPosF   = 0.6             
1049                  amres@amOrthogonalPosF = -0.2           
1050                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres) 
[161]1051               end if           
1052            end if
1053            if (vNam(varn) .EQ. "wpt" .AND. wp .NE. 1)
1054               if (w0 .NE. 1) then
1055                  wt=1
1056                  overlay(plot_wpptp0,plot_wpptp)
1057                  overlay(plot_wpptp0,plot_wpt)
1058                  n=n+1
[162]1059                  plot_ps(n) = plot_wpptp0
1060
1061                  ; ***************************************************
1062                  ; legend for combined plot
1063                  ; ***************************************************
1064     
1065                  lgres                    = True
1066                  lgMonoDashIndex          = False
1067                  lgres@lgLabelFont        = "helvetica"   
1068                  lgres@lgLabelFontHeightF = .1           
1069                  lgres@vpWidthF           = 0.4           
1070                  lgres@vpHeightF          = 0.4         
1071                  lgres@lgDashIndexes      = (/0,0,0/)
1072                  lgres@lgLineColors       = (/237,144,80/)
1073                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1074
1075                  amres = True
1076                  amres@amParallelPosF   = 0.6             
1077                  amres@amOrthogonalPosF = -0.2           
1078                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1079               end if
1080            end if
1081
1082            if (vNam(varn) .EQ. "pt_0_" .AND. pz .NE. 1) then
1083               p=1     
1084               overlay(plot_pt_0_,plot_pt_zp_)
1085               n=n+1
[162]1086               plot_ps(n) = plot_pt_0_ 
1087     
1088               ; ***************************************************
1089               ; legend for combined plot
1090               ; ***************************************************
1091     
1092               lgres                    = True
1093               lgMonoDashIndex          = False
1094               lgres@lgLabelFont        = "helvetica"   
1095               lgres@lgLabelFontHeightF = .1           
1096               lgres@vpWidthF           = 0.4           
1097               lgres@vpHeightF          = 0.4         
1098               lgres@lgDashIndexes      = (/0,0,0/)
1099               lgres@lgLineColors       = (/237,144,80/)
1100               lbid = gsn_create_legend(wks_ps,2,(/"pt_0_","pt_zp_"/),lgres)       
1101
1102               amres = True
1103               amres@amParallelPosF   = 0.6                 
1104               amres@amOrthogonalPosF = -0.2           
1105               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1106            end if
1107            if (vNam(varn) .EQ. "pt_zp_" .AND. p .NE. 1) then
1108               pz=1       
1109               overlay(plot_pt_0_,plot_pt_zp_)
1110               n=n+1
[162]1111               plot_ps(n) = plot_pt_0_   
1112
1113               ; ***************************************************
1114               ; legend for combined plot
1115               ; ***************************************************
1116     
1117               lgres                    = True
1118               lgMonoDashIndex          = False
1119               lgres@lgLabelFont        = "helvetica"   
1120               lgres@lgLabelFontHeightF = .1           
1121               lgres@vpWidthF           = 0.4           
1122               lgres@vpHeightF          = 0.4         
1123               lgres@lgDashIndexes      = (/0,0,0/)
1124               lgres@lgLineColors       = (/237,144,80/)
1125               lbid = gsn_create_legend(wks_ps,2,(/"pt_0_","pt_zp_"/),lgres)       
1126
1127               amres = True
1128               amres@amParallelPosF   = 0.6                 
1129               amres@amOrthogonalPosF = -0.2           
1130               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1131            end if
1132           
1133            if (vNam(varn) .EQ. "splptx" .AND. y .NE. 1)
1134               if (z .NE.1 ) then
1135                  x=1     
1136                  overlay(plot_splptx,plot_splpty)
1137                  overlay(plot_splptx,plot_splptz)
1138                  n=n+1
[162]1139                  plot_ps(n) = plot_splptx   
1140
1141                  ; ***************************************************
1142                  ; legend for combined plot
1143                  ; ***************************************************
1144     
1145                  lgres                    = True
1146                  lgMonoDashIndex          = False
1147                  lgres@lgLabelFont        = "helvetica"   
1148                  lgres@lgLabelFontHeightF = .1           
1149                  lgres@vpWidthF           = 0.4           
1150                  lgres@vpHeightF          = 0.4         
1151                  lgres@lgDashIndexes      = (/0,0,0/)
1152                  lgres@lgLineColors       = (/237,144,80/)
1153                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1154
1155                  amres = True
1156                  amres@amParallelPosF   = 0.6             
1157                  amres@amOrthogonalPosF = -0.2           
1158                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1159               end if
1160            end if
1161            if (vNam(varn) .EQ. "splpty" .AND. x .NE. 1)
1162               if(z .NE.1 ) then
1163                  y=1         
1164                  overlay(plot_splptx,plot_splpty)
1165                  overlay(plot_splptx,plot_splptz)
1166                  n=n+1
1167                  plot_ps(n) = plot_splptx
[162]1168
1169                  ; ***************************************************
1170                  ; legend for combined plot
1171                  ; ***************************************************
1172     
1173                  lgres                    = True
1174                  lgMonoDashIndex          = False
1175                  lgres@lgLabelFont        = "helvetica"   
1176                  lgres@lgLabelFontHeightF = .1           
1177                  lgres@vpWidthF           = 0.4           
1178                  lgres@vpHeightF          = 0.4         
1179                  lgres@lgDashIndexes      = (/0,0,0/)
1180                  lgres@lgLineColors       = (/237,144,80/)
1181                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1182
1183                  amres = True
1184                  amres@amParallelPosF   = 0.6             
1185                  amres@amOrthogonalPosF = -0.2           
1186                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1187               end if           
1188            end if
1189            if (vNam(varn) .EQ. "splptz" .AND. y .NE. 1)
1190               if(x .NE.1 ) then
1191                  z=1         
1192                  overlay(plot_splptx,plot_splpty)
1193                  overlay(plot_splptx,plot_splptz)
1194                  n=n+1
[162]1195                  plot_ps(n) = plot_splptx 
1196
1197                  ; ***************************************************
1198                  ; legend for combined plot
1199                  ; ***************************************************
1200     
1201                  lgres                    = True
1202                  lgMonoDashIndex          = False
1203                  lgres@lgLabelFont        = "helvetica"   
1204                  lgres@lgLabelFontHeightF = .1           
1205                  lgres@vpWidthF           = 0.4           
1206                  lgres@vpHeightF          = 0.4         
1207                  lgres@lgDashIndexes      = (/0,0,0/)
1208                  lgres@lgLineColors       = (/237,144,80/)
1209                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1210
1211                  amres = True
1212                  amres@amParallelPosF   = 0.6             
1213                  amres@amOrthogonalPosF = -0.2           
1214                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1215               end if       
1216            end if
1217
1218            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
1219               n=n+1
1220               res@xyLineColors   = (/237/)
1221               res@xyLabelMode    = False
1222               res@gsnLeftString  = vNam(varn)
1223               res@gsnRightString = unit(varn)
[310]1224               res@trYMaxF        = max(data(varn,:))
1225               res@trYMinF        = min(data(varn,:))
[161]1226               if (min(data(varn,:)) .EQ. max(data(varn,:))) then
1227                  if (min(data(varn,:)) .EQ. 0)then
[310]1228                     res@trYMaxF = max(data(varn,:))-0.1
1229                     res@trYMinF = min(data(varn,:))+0.1
[161]1230                  end if
1231                  if (min(data(varn,:)) .LT. 0)then
[310]1232                     res@trYMaxF = max(data(varn,:))+(min(data(varn,:)))/2
1233                     res@trYMinF = min(data(varn,:))-(max(data(varn,:)))/2
[161]1234                  end if
1235                  if (min(data(varn,:)) .GT. 0)then
[310]1236                     res@trYMaxF = max(data(varn,:))-(min(data(varn,:)))/2
1237                     res@trYMinF = min(data(varn,:))+(max(data(varn,:)))/2
[161]1238                  end if
1239               end if
1240               plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
1241            end if
[310]1242
1243            ; ***************************************************
1244            ; transparent legend as placeholder for single plots
1245            ; ***************************************************
1246            lgresmono                    = True
1247            lgMonoDashIndex              = False
1248            lgresmono@lgMonoLineColor    = True
1249            lgresmono@lgLabelFont        = "helvetica"   
1250            lgresmono@lgLabelFontHeightF = .1           
1251            lgresmono@vpWidthF           = 0.4           
1252            lgresmono@vpHeightF          = 0.4         
1253            lgresmono@lgLineColor        = 0
1254            lgresmono@lgPerimOn          = False
1255            lbid = gsn_create_legend(wks_ps,1,(/""/),lgresmono)       
1256
1257            amres = True
1258            amres@amParallelPosF   = 0.6                   
1259            amres@amOrthogonalPosF = -0.2           
1260            annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
[161]1261       
1262         else
1263           
1264            print("plot of " + vNam(varn))
1265           
1266            n=n+1
1267            res@xyLineColors            = (/237/)
1268            res@gsnLeftString       = vNam(varn)
1269            res@gsnRightString      = unit(varn)
[310]1270       
[218]1271            if (norm_t .NE. 1.)then
1272               res@tiXAxisString        = "t ["+unit_t+"]"
1273            else
1274               res@tiXAxisString        = "t [s]"
1275            end if
1276            res@tiYAxisString = " "
1277            res@tiXAxisFontHeightF   = font_size
1278            res@txFontHeightF        = font_size
1279            res@tiYAxisFontHeightF   = font_size
1280            res@tmXBLabelFontHeightF = font_size
1281            res@tmYLLabelFontHeightF = font_size
[310]1282            res@trYMaxF        = max(data(varn,:))
1283            res@trYMinF        = min(data(varn,:))
[161]1284            if (min(data(varn,:)) .EQ. max(data(varn,:))) then
1285               if (min(data(varn,:)) .EQ. 0)then
[310]1286                     res@trYMaxF = max(data(varn,:))-0.1
1287                     res@trYMinF = min(data(varn,:))+0.1
[161]1288                  end if
1289                  if (min(data(varn,:)) .LT. 0)then
[310]1290                     res@trYMaxF = max(data(varn,:))+(min(data(varn,:)))/2
1291                     res@trYMinF = min(data(varn,:))-(max(data(varn,:)))/2
[161]1292                  end if
1293                  if (min(data(varn,:)) .GT. 0)then
[310]1294                     res@trYMaxF = max(data(varn,:))-(min(data(varn,:)))/2
1295                     res@trYMinF = min(data(varn,:))+(max(data(varn,:)))/2
[161]1296                  end if
1297            end if
1298            plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res)
1299           
1300         end if     
1301      end if
[154]1302   end do
[161]1303 
[154]1304   ; ***************************************************
1305   ; merge plots onto one page
1306   ; ***************************************************
[162]1307 
[161]1308   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
1309      gsn_panel(wks_ps,plot_ps(1:n),(/n,1/),resP)
[250]1310      print(" ")
1311      print("Outputs to .eps or .epsi have only one frame")
1312      print(" ")
[161]1313   else
[218]1314      do np = 1,n,no_rows*no_columns   
1315         if ( np + no_rows*no_columns .gt. n) then   
1316            gsn_panel(wks_ps, plot_ps(np:n),(/no_rows,no_columns/),resP)
[161]1317         else
[218]1318            gsn_panel(wks_ps, plot_ps(np:np+no_rows*no_columns-1),(/no_rows,no_columns/),resP)
[161]1319         end if
1320      end do
1321   end if
[154]1322
1323   print(" ")
1324   print("Output to: " + file_out +"."+ format_out)
1325   print(" ")
1326 
1327end
Note: See TracBrowser for help on using the repository browser.