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

Last change on this file since 424 was 418, checked in by heinze, 14 years ago

ncl_preferences is renamed .ncl.config.default

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