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

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

Adjustment of the NCL scripts and palmplot to allow for the use of special characters in NetCDF variable names

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