source: palm/trunk/SCRIPTS/NCL/profiles.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: 161.4 KB
Line 
1load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
2load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
3load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
4
5;***************************************************
6; load .ncl.config or .ncl.config.default
7;***************************************************
8
9function which_script()
10local script
11begin
12   script="profiles"
13   return(script)
14end
15   
16if (isfilepresent("$PALM_BIN/../../.ncl.config")) then
17   loadscript("$PALM_BIN/../../.ncl.config")
18else
19  if (isfilepresent("$PALM_BIN/NCL/.ncl.config.default")) then
20     loadscript( "$PALM_BIN/NCL/.ncl.config.default")
21  else
22      palm_bin_path = getenv("PALM_BIN")
23      print(" ")
24      print("Neither the personal configuration file '.ncl.config' exists in")
25      print("~/palm/current_version")
26      print("nor the default configuration file '.ncl.config.default' exists in")
27      print(palm_bin_path + "/NCL")
28      print(" ")
29      exit
30   end if
31end if   
32
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 (no_files .LT. 1 .OR. no_files .GT. 6) then
47      print(" ")
48      print("Assign 'no_files' between 1 and 6") 
49      print(" ")
50      exit
51   end if
52   
53   file_in   = new(no_files,string)
54   file_in_1 = new(no_files,logical)
55   start_f   = new(no_files,integer)
56   end_f     = new(no_files,integer)
57   
58   if (file_1 .EQ. "File in") then
59      print(" ")
60      print("Declare 1st input file 'file_1=' in '.ncl.config' or prompt")
61      print(" ")
62      exit
63   else
64      file_in(0) = file_1   
65   end if     
66   file_in_1(0) = False
67   if (isStrSubset(file_in(0), ".nc"))then
68      start_f_1 = -2
69      end_f_1 = -2
70      file_in_1(0) = True     
71   end if 
72   if (start_f_1 .EQ. -1)then
73      print(" ")
74      print("'start_f_1' must be one of the cyclic numbers (at least 0) of your input file(s)")
75      print(" ") 
76      exit
77   end if
78   if (end_f_1 .EQ. -1)then
79      print(" ")
80      print("'end_f_1' must be one of the cyclic numbers (at least 0) of your input file(s)")
81      print(" ") 
82      exit
83   end if           
84   start_f(0) = start_f_1
85   end_f(0) = end_f_1   
86 
87   if (no_files .GT. 1) then
88      if (file_2 .EQ. "File in") then
89         print(" ")
90         print("Declare 2nd input file 'file_2=' in '.ncl.config' or prompt")
91         print(" ")
92         exit
93      else
94         file_in(1) = file_2   
95      end if     
96      file_in_1(1) = False
97      if (isStrSubset(file_in(1), ".nc"))then
98         start_f_2 = -2
99         end_f_2 = -2
100         file_in_1(1) = True     
101      end if
102      if (start_f_2 .EQ. -1)then
103         print(" ")
104         print("'start_f_2' must be one of the cyclic numbers (at least 0) of your input file(s)")
105         print(" ") 
106         exit
107      end if
108      if (end_f_2 .EQ. -1)then
109         print(" ")
110         print("'end_f_2' must be one of the cyclic numbers (at least 0) of your input file(s)")
111         print(" ") 
112         exit
113      end if     
114      start_f(1) = start_f_2
115      end_f(1) = end_f_2   
116   end if   
117   
118   if (no_files .GT. 2) then
119      if (file_3 .EQ. "File in") then
120         print(" ")
121         print("Declare 3rd input file 'file_3=' in '.ncl.config' or prompt")
122         print(" ")
123         exit
124      else
125         file_in(2) = file_3   
126      end if     
127      file_in_1(2) = False
128      if (isStrSubset(file_in(2), ".nc"))then
129         start_f_3 = -2
130         end_f_3 = -2
131         file_in_1(2) = True     
132      end if
133      if (start_f_3 .EQ. -1)then
134         print(" ")
135         print("'start_f_3' must be one of the cyclic numbers (at least 0) of your input file(s)")
136         print(" ") 
137         exit
138      end if
139      if (end_f_3 .EQ. -1)then
140         print(" ")
141         print("'end_f_3' must be one of the cyclic numbers (at least 0) of your input file(s)")
142         print(" ") 
143         exit
144      end if     
145      start_f(2) = start_f_3
146      end_f(2) = end_f_3 
147   end if
148   
149   if (no_files .GT. 3) then
150      if (file_4 .EQ. "File in") then
151         print(" ")
152         print("Declare 4th input file 'file_4=' in '.ncl.config' or prompt")
153         print(" ")
154         exit
155      else
156         file_in(3) = file_4   
157      end if     
158      file_in_1(3) = False
159      if (isStrSubset(file_in(3), ".nc"))then
160         start_f_4 = -2
161         end_f_4 = -2
162         file_in_1(3) = True     
163      end if
164      if (start_f_4 .EQ. -1)then
165         print(" ")
166         print("'start_f_4' must be one of the cyclic numbers (at least 0) of your input file(s)")
167         print(" ") 
168         exit
169      end if
170      if (end_f_4 .EQ. -1)then
171         print(" ")
172         print("'end_f_4' must be one of the cyclic numbers (at least 0) of your input file(s)")
173         print(" ") 
174         exit
175      end if     
176      start_f(3) = start_f_4
177      end_f(3) = end_f_4
178   end if
179   
180   if (no_files .GT. 4) then
181      if (file_5 .EQ. "File in") then
182         print(" ")
183         print("Declare 5th input file 'file_5=' in '.ncl.config' or prompt")
184         print(" ")
185         exit
186      else
187         file_in(4) = file_5   
188      end if     
189      file_in_1(4) = False
190      if (isStrSubset(file_in(4), ".nc"))then
191         start_f_5 = -2
192         end_f_5 = -2
193         file_in_1(4) = True     
194      end if
195      if (start_f_5 .EQ. -1)then
196         print(" ")
197         print("'start_f_5' must be one of the cyclic numbers (at least 0) of your input file(s)")
198         print(" ") 
199         exit
200      end if
201      if (end_f_5 .EQ. -1)then
202         print(" ")
203         print("'end_f_5' must be one of the cyclic numbers (at least 0) of your input file(s)")
204         print(" ") 
205         exit
206      end if     
207      start_f(4) = start_f_5
208      end_f(4) = end_f_5   
209   end if
210   
211   if (no_files .GT. 5) then
212      if (file_6 .EQ. "File in") then
213         print(" ")
214         print("Declare 6th input file 'file_6=' in '.ncl.config' or prompt")
215         print(" ")
216         exit
217      else
218         file_in(5) = file_6   
219      end if     
220      file_in_1(5) = False
221      if (isStrSubset(file_in(5), ".nc"))then
222         start_f_6 = -2
223         end_f_6 = -2
224         file_in_1(5) = True     
225      end if
226      if (start_f_6 .EQ. -1)then
227         print(" ")
228         print("'start_f_6' must be one of the cyclic numbers (at least 0) of your input file(s)")
229         print(" ") 
230         exit
231      end if
232      if (end_f_6 .EQ. -1)then
233         print(" ")
234         print("'end_f_6' must be one of the cyclic numbers (at least 0) of your input file(s)")
235         print(" ") 
236         exit
237      end if     
238      start_f(5) = start_f_6
239      end_f(5) = end_f_6   
240   end if
241
242   
243   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
244      print(" ")
245      print("'format_out = "+format_out+"' is invalid and set to'x11'")
246      print(" ")
247      format_out="x11"
248   end if 
249
250   if (over .NE. 0 .AND. over .NE. 1) then
251      print(" ")
252      print("'over'= "+over+" is invalid and set to 0")
253      print(" ")
254      over = 0
255   end if
256   if (no_files .GT. 1) then
257      over = 0
258      print(" ")
259      print("If you have more than one input file - you cannot overlay variables: over is set to 0")
260      print(" ")
261   end if
262   
263   if (combine .NE. 0 .AND. combine .NE. 1)then
264      print(" ")
265      print("Your 'combine'= "+combine+" is invalid and set to 0")
266      print(" ")
267      combine = 0
268   end if
269   if (no_files .GT. 1) then
270      combine = 0
271      print(" ")
272      print("If you have more than one input file you cannot combine variables: combine is set to 0")
273      print(" ")
274   end if   
275   if (combine .EQ. 1 .AND. number_comb .EQ. -1) then
276      print(" ")
277      print("Set 'number_comb' to 2 or 3 or combine to 0")
278      print(" ")
279      exit
280   end if
281   if (combine .EQ. 1)then
282      if (number_comb .EQ. -1) then
283         print(" ")
284         print("Set 'number_comb' to 2 or 3 or combine to 0")
285         print(" ")
286         exit
287      end if
288      if (number_comb .NE. 2 .AND. number_comb .NE. 3) then
289         print(" ")
290         print("Set 'number_comb' to 2 or 3 or combine to 0")
291         print(" ")
292         exit
293      end if
294   end if 
295   if (combine .EQ. 1 .AND. c_var .EQ. "c_variables") then
296      print(" ")
297      print("Select variables for overlaying ('c_var') or set combine to 0")
298      print(" ")
299      exit
300   end if
301
302   if (log_z .NE. 0 .AND. log_z .NE. 1)then
303      print(" ")
304      print("'log_z'= "+log_z+" is invalid and set to 0")
305      print(" ")
306      log_z = 0
307   end if   
308 
309   if (norm_z .EQ. 0) then
310      print(" ")
311      print("Normalising with 0 is not allowed, 'norm_z' is set to 1.0")
312      print(" ")
313      norm_z = 1.0
314   end if
315
316   ;***************************************************
317   ; open input file
318   ;***************************************************
319
320   do nof=0,no_files-1
321
322   files=new(end_f(nof)-start_f(nof)+1,string)
323   if (file_in_1(nof))then
324      if (isfilepresent(file_in(nof)))then
325         files(0)=file_in(nof)
326      else
327         print(" ")
328         print("1st input file: '"+file_in(nof)+"' does not exist")
329         print(" ")
330         exit
331      end if
332   else
333      if (start_f(nof) .EQ. 0)then
334         if (isfilepresent(file_in(nof)+".nc"))then
335            files(0)=file_in(nof)+".nc"
336            do i=1,end_f(nof)
337               if (isfilepresent(file_in(nof)+"."+i+".nc"))then   
338                  files(i)=file_in(nof)+"."+i+".nc"
339               else
340                  print(" ")
341                  print("Input file: '"+file_in(nof)+"."+i+".nc' does not exist")
342                  print(" ")
343                  exit 
344               end if       
345            end do         
346         else
347            print(" ")
348            print("Input file: '"+file_in(nof)+".nc' does not exist")
349            print(" ")
350            exit
351         end if
352      else
353         do i=start_f(nof),end_f(nof)
354            if (isfilepresent(file_in(nof)+"."+i+".nc"))then   
355               files(i-start_f(nof))=file_in(nof)+"."+i+".nc"
356            else
357               print(" ")
358               print("Input file: '"+file_in(nof)+"."+i+".nc' does not exist")
359               print(" ")
360               exit 
361            end if
362         end do
363      end if
364   end if
365
366   f=addfiles(files,"r")
367   f_att=addfile(files(0),"r")
368   ListSetType(f,"cat")
369   
370   vNam = getfilevarnames(f_att)   
371   
372   if (nof .EQ. 0)then
373      vNam0=vNam
374   end if
375   if (nof .NE. 0)then
376      if (dim0 .NE. dim)then
377         print(" ")
378         print("There are 'no_files'="+no_files+" input files but they do not contain the same variables")
379         print(" ")
380         exit
381      else
382         do i=0,dim0-1
383            if (vNam0(i) .NE. vNam(i))then
384               print(" ")
385               print("There are 'no_files'="+no_files+" input files but they do not contain the same variables")
386               print(" ")
387               exit
388            end if
389         end do
390      end if
391   end if
392   nof=nof+1
393   print(" ")
394   print("Variables in input file "+nof+":")
395   print("- "+ vNam)
396   print(" ")
397   nof=nof-1
398   dim = dimsizes(vNam)
399   dim0=dim
400 
401   if (dim .EQ. 0) then
402      print(" ")
403      print("There is no data on file")
404      print(" ")
405   end if
406   
407   prof3d = 0
408   do varn = dim-1,0,1
409      if ( isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
410         prof3d = 1
411         break
412      end if
413   end do
414 
415   if (var .NE. "all") then
416      ;rearrange the order of the variables in vNam so that the variables
417      ;specified by "var" are in the top of vNam
418
419      vNam_static = new((/dim/),string)
420      vNam_temp   = new((/dim/),string)
421
422      var_char    = stringtocharacter(var)
423      no_char     = dimsizes(var_char)
424      comma       = 0
425       
426      do j=0,no_char-1
427         if(var_char(j) .eq. ",")
428            comma = comma + 1
429         end if
430      end do
431
432      if(comma .le. 1)
433          print(" ")
434          print("The variables 'var="+var+"'" )
435          print("do not exist on your input file;")
436          print("be sure to have one comma before and after each variable")
437          print(" ")
438          exit
439      end if
440
441      if(comma .gt. dim)
442          print(" ")
443          print("The variables 'var="+var+"'" )
444          print("do not exist on your input file;")
445          print("be sure to have one comma before and after each variable")
446          print(" ")
447          exit
448      end if
449
450      indices = new((/comma/),integer)
451      comma   = 0
452       
453      do j=0,no_char-1
454         if(var_char(j) .eq. ",")
455           indices(comma) = j
456           comma          = comma + 1
457         end if
458      end do
459
460      do j=0,comma-2
461         vNam_temp(j) = charactertostring(var_char(indices(j)+1:indices(j+1)-1))
462      end do
463
464      do j=0,comma-2
465        count_check = 0
466        do varn=0,dim-1
467           if(vNam_temp(j) .ne. vNam(varn))
468             count_check=count_check+1
469           end if
470        end do   
471
472        if(count_check .eq. dim)
473            print(" ")
474            print("The variables 'var="+var+"'" )
475            print("do not exist on your input file;")
476            print("be sure to have one comma before and after each variable")
477            print(" ")
478            exit
479        end if
480
481        vNam_static(j) = vNam_temp(comma - 2 - j)
482      end do
483
484      vNam_temp   = vNam_static
485      vNam_static = ""
486
487      if (prof3d .EQ. 0) then
488         i = 0
489         do j=0,dim-1,2
490            vNam_static(j)   = vNam_temp(i)
491            vNam_static(j+1) = "z" + vNam_static(j)
492            i = i+1
493            if(i .eq. comma-1)
494                break
495            end if
496         end do
497
498         delete(vNam_temp)
499         count_variable = 2*(comma-1)
500      else
501         i = 0
502          do j=0,dim-1,1
503             vNam_static(j) = vNam_temp(i)
504             i = i+1
505             if(i .eq. comma-1)
506                 break
507             end if
508          end do
509
510          delete(vNam_temp)
511          count_variable = comma-1
512      end if
513
514      counter  = 0
515      counter2 = 0
516      do j=0,dim-1
517         counter = 0
518         do i = 0, count_variable - 1       
519            if(vNam_static(i) .ne. vNam(j))
520               counter = counter + 1
521            end if
522         end do
523     
524         if (counter .eq. count_variable)
525            vNam_static(count_variable + counter2) = vNam(j)
526            counter2 = counter2 + 1
527         end if
528      end do
529     
530      vNam = vNam_static
531      delete(vNam_static)
532    end if
533
534   ;-----------------------------------------------------below steps only for first file -> nof=0
535   if (nof .EQ. 0) then
536
537      plot = new(dim,graphic)
538      plot_ = new(dim,graphic)
539      if (no_files .GT. 1) then
540         multi_plot = new((/no_files,dim/),graphic)
541         max_nof = new((/no_files,dim/),float)
542         min_nof = new((/no_files,dim/),float)
543         name    = new((/no_files,dim/),string)
544         unit_   = new((/no_files,dim/),string)
545      end if
546
547   if (prof3d .EQ. 0) then
548 
549   do varn=0,dim-1
550      if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
551         continue
552      end if
553      if (vNam(varn) .EQ. "u" .OR. isStrSubset(vNam(varn), "u_"))then
554         z_u = f_att->$vNam(varn+1)$
555         break
556      else
557         if (vNam(varn) .EQ. "v" .OR. isStrSubset(vNam(varn), "v_"))then 
558            z_u = f_att->$vNam(varn+1)$
559            break
560         else
561            if(vNam(varn) .EQ. "pt" .OR. isStrSubset(vNam(varn), "pt_"))then
562               z_u = f_att->$vNam(varn+1)$
563               break
564            else
565               if(vNam(varn) .EQ. "vpt" .OR. isStrSubset(vNam(varn), "vpt_"))then
566                  z_u = f_att->$vNam(varn+1)$
567                  break
568               else
569                  if(vNam(varn) .EQ. "lpt" .OR. isStrSubset(vNam(varn), "lpt_"))then
570                     z_u = f_att->$vNam(varn+1)$
571                     break
572                  else   
573                     if(vNam(varn) .EQ. "q" .OR. isStrSubset(vNam(varn), "q_") )then
574                        z_u = f_att->$vNam(varn+1)$
575                        break
576                     else
577                        if(vNam(varn) .EQ. "qv" .OR. isStrSubset(vNam(varn), "qv_"))then
578                           z_u = f_att->$vNam(varn+1)$
579                           break
580                        else
581                           if(vNam(varn) .EQ. "ql" .OR. isStrSubset(vNam(varn), "ql_"))then
582                              z_u = f_att->$vNam(varn+1)$
583                              break
584                           else
585                              if(vNam(varn) .EQ. "rho" .OR. isStrSubset(vNam(varn), "rho_"))then
586                                 z_u = f_att->$vNam(varn+1)$
587                                 break
588                              else
589                                 if(vNam(varn) .EQ. "s" .OR. isStrSubset(vNam(varn), "s_") )then
590                                    z_u = f_att->$vNam(varn+1)$
591                                    break
592                                 else
593                                    if(vNam(varn) .EQ. "sa" .OR. isStrSubset(vNam(varn), "sa_"))then
594                                       z_u = f_att->$vNam(varn+1)$
595                                       break
596                                    else
597                                       if(vNam(varn) .EQ. "e" .OR. isStrSubset(vNam(varn), "e_"))then
598                                         
599                                          z_u = f_att->$vNam(varn+1)$
600                                          break
601                                       else
602                                          if(vNam(varn) .EQ. "es" .OR. isStrSubset(vNam(varn), "es_")\
603                                             .OR. vNam(varn) .EQ. "e*" .OR. isStrSubset(vNam(varn), "e*_"))then
604                                             z_u = f_att->$vNam(varn+1)$
605                                             break
606                                          else
607                                             if(vNam(varn) .EQ. "km" .OR. isStrSubset(vNam(varn), "km_"))then
608                                                z_u = f_att->$vNam(varn+1)$
609                                                break
610                                             else
611                                                if(vNam(varn) .EQ. "kh" .OR. isStrSubset(vNam(varn), "kh_"))then
612                                                   z_u = f_att->$vNam(varn+1)$
613                                                   break
614                                                else
615                                                   if(vNam(varn) .EQ. "l" .OR. isStrSubset(vNam(varn), "l_"))then
616                                                      z_u = f_att->$vNam(varn+1)$
617                                                      break
618                                                   else
619                                                      if(vNam(varn) .EQ. "us2" .OR. isStrSubset(vNam(varn), "us2_")\
620                                                         .OR. vNam(varn) .EQ. "u*2" .OR. isStrSubset(vNam(varn), "u*2_"))then
621                                                         z_u = f_att->$vNam(varn+1)$
622                                                         break
623                                                      else
624                                                         if(vNam(varn) .EQ. "vs2" .OR. isStrSubset(vNam(varn), "vs2_")\
625                                                            .OR. vNam(varn) .EQ. "v*2" .OR. isStrSubset(vNam(varn), "v*2_"))then
626                                                            z_u = f_att->$vNam(varn+1)$
627                                                            break
628                                                         else
629                                                            if(vNam(varn) .EQ. "pts2" .OR. isStrSubset(vNam(varn), "pts2_")\
630                                                               .OR. vNam(varn) .EQ. "pt*2" .OR. isStrSubset(vNam(varn), "pt*2_"))then
631                                                               z_u = f_att->$vNam(varn+1)$
632                                                               break
633                                                            else
634                                                               if(vNam(varn) .EQ. "wsususodz" .OR. isStrSubset(vNam(varn), "wsususodz_")\
635                                                                  .OR. vNam(varn) .EQ. "w*u*u*:dz" .OR. isStrSubset(vNam(varn), "w*u*u*:dz_"))then
636                                                                  z_u = f_att->$vNam(varn+1)$
637                                                                  break
638                                                               else
639                                                                  if(vNam(varn) .EQ. "wspsodz" .OR. isStrSubset(vNam(varn), "wspsodz_")\
640                                                                     .OR. vNam(varn) .EQ. "w*p*:dz" .OR. isStrSubset(vNam(varn), "w*p*:dz_"))then
641                                                                     z_u = f_att->$vNam(varn+1)$
642                                                                     break
643                                                                  else
644                                                                     if(vNam(varn) .EQ. "wpeodz" .OR. isStrSubset(vNam(varn), "wpeodz_")\
645                                                                        .OR. vNam(varn) .EQ. "w"+dq+"e:dz" .OR. isStrSubset(vNam(varn), "w"+dq+"e:dz_"))then
646                                                                        z_u = f_att->$vNam(varn+1)$
647                                                                        break                                                                       
648                                                                     end if
649                                                                  end if
650                                                               end if
651                                                            end if
652                                                         end if
653                                                      end if
654                                                   end if
655                                                end if
656                                             end if
657                                          end if
658                                       end if
659                                    end if
660                                 end if
661                              end if
662                           end if
663                        end if
664                     end if
665                  end if
666               end if
667            end if
668         end if
669      end if
670   end do
671
672   do varn=0,dim-1
673      if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
674         continue
675      end if
676      if (vNam(varn) .EQ. "w" .OR. isStrSubset(vNam(varn), "w_"))then
677         z_w = f_att->$vNam(varn+1)$
678         break
679      else
680         if (vNam(varn) .EQ. "wpup" .OR. isStrSubset(vNam(varn), "wpup_")\
681            .OR. vNam(varn) .EQ. "w"+dq+"u"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"u"+dq+"_"))then
682            z_w = f_att->$vNam(varn+1)$
683            break
684         else
685            if(vNam(varn) .EQ. "wsus" .OR. isStrSubset(vNam(varn), "wsus_")\
686               .OR. vNam(varn) .EQ. "w*u*" .OR. isStrSubset(vNam(varn), "w*u*_"))then
687               z_w = f_att->$vNam(varn+1)$
688               break
689            else
690               if(vNam(varn) .EQ. "wu" .OR. isStrSubset(vNam(varn), "wu_"))then
691                  z_w = f_att->$vNam(varn+1)$
692                  break
693               else
694                  if(vNam(varn) .EQ. "wpvp" .OR. isStrSubset(vNam(varn), "wpvp_")\
695                     .OR. vNam(varn) .EQ. "w"+dq+"v"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"v"+dq+"_"))then
696                     z_w = f_att->$vNam(varn+1)$
697                     break
698                  else   
699                     if(vNam(varn) .EQ. "wsvs" .OR. isStrSubset(vNam(varn), "wsvs_")\
700                        .OR. vNam(varn) .EQ. "w*v*" .OR. isStrSubset(vNam(varn), "w*v*_"))then
701                        z_w = f_att->$vNam(varn+1)$
702                        break
703                     else
704                        if(vNam(varn) .EQ. "wv" .OR. isStrSubset(vNam(varn), "wv_"))then
705                           z_w = f_att->$vNam(varn+1)$
706                           break
707                        else
708                           if(vNam(varn) .EQ. "wptpp" .OR. isStrSubset(vNam(varn), "wptpp_")\
709                              .OR. vNam(varn) .EQ. "w"+dq+"pt"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"pt"+dq+"_"))then
710                              z_w = f_att->$vNam(varn+1)$
711                              break
712                           else
713                              if(vNam(varn) .EQ. "wspts" .OR. isStrSubset(vNam(varn), "wspts_")\
714                                 .OR. vNam(varn) .EQ. "w*pt*" .OR. isStrSubset(vNam(varn), "w*pt*_"))then
715                                 z_w = f_att->$vNam(varn+1)$
716                                 break
717                              else
718                                 if(vNam(varn) .EQ. "wpt" .OR. isStrSubset(vNam(varn), "wpt_"))then
719                                    z_w = f_att->$vNam(varn+1)$
720                                    break
721                                 else
722                                    if(vNam(varn) .EQ. "wsptsBC" .OR. isStrSubset(vNam(varn), "wsptsBC_")\
723                                       .OR. vNam(varn) .EQ. "w*pt*BC" .OR. isStrSubset(vNam(varn), "w*pt*BC_"))then
724                                       z_w = f_att->$vNam(varn+1)$
725                                       break
726                                    else
727                                       if(vNam(varn) .EQ. "wptBC" .OR. isStrSubset(vNam(varn), "wptBC_"))then
728                                          z_w = f_att->$vNam(varn+1)$
729                                          break
730                                       else
731                                          if(vNam(varn) .EQ. "wpvptp" .OR. isStrSubset(vNam(varn), "wpvptp_")\
732                                              .OR. vNam(varn) .EQ. "w"+dq+"vpt"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"vpt"+dq+"_"))then
733                                             z_w = f_att->$vNam(varn+1)$
734                                             break
735                                          else
736                                             if(vNam(varn) .EQ. "wsvpts" .OR. isStrSubset(vNam(varn), "wsvpts_")\
737                                               .OR. vNam(varn) .EQ. "w*vpt*" .OR. isStrSubset(vNam(varn), "w*vpt*_"))then
738                                                z_w = f_att->$vNam(varn+1)$
739                                                break
740                                             else
741                                                if(vNam(varn) .EQ. "wvpt" .OR. isStrSubset(vNam(varn), "wvpt_"))then
742                                                   z_w = f_att->$vNam(varn+1)$
743                                                   break
744                                                else
745                                                   if(vNam(varn) .EQ. "wpqp" .OR. isStrSubset(vNam(varn), "wpqp_")\
746                                                      .OR. vNam(varn) .EQ. "w"+dq+"q"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"q"+dq+"_"))then
747                                                      z_w = f_att->$vNam(varn+1)$
748                                                      break
749                                                   else
750                                                      if(vNam(varn) .EQ. "wsqs" .OR. isStrSubset(vNam(varn), "wsqs_")\
751                                                         .OR. vNam(varn) .EQ. "w*q*" .OR. isStrSubset(vNam(varn), "w*q*_"))then
752                                                         z_w = f_att->$vNam(varn+1)$
753                                                         break
754                                                      else
755                                                         if(vNam(varn) .EQ. "wq" .OR. isStrSubset(vNam(varn), "wq_"))then
756                                                            z_w = f_att->$vNam(varn+1)$
757                                                            break
758                                                         else
759                                                            if(vNam(varn) .EQ. "wpqvp" .OR. isStrSubset(vNam(varn), "wpqvp_")\
760                                                               .OR. vNam(varn) .EQ. "w"+dq+"qv"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"qv"+dq+"_"))then
761                                                               z_w = f_att->$vNam(varn+1)$
762                                                               break
763                                                            else
764                                                               if(vNam(varn) .EQ. "wsqvs" .OR. isStrSubset(vNam(varn), "wsqvs_")\
765                                                                  .OR. vNam(varn) .EQ. "w*qv*" .OR. isStrSubset(vNam(varn), "w*qv*_"))then
766                                                                  z_w = f_att->$vNam(varn+1)$
767                                                                  break
768                                                               else
769                                                                  if(vNam(varn) .EQ. "wqv" .OR. isStrSubset(vNam(varn), "wqv_"))then
770                                                                     z_w = f_att->$vNam(varn+1)$
771                                                                     break
772                                                                  else
773                                                                     if(vNam(varn) .EQ. "wpsp" .OR. isStrSubset(vNam(varn), "wpsp_")\
774                                                                        .OR. vNam(varn) .EQ. "w"+dq+"s"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"s"+dq+"_"))then
775                                                                        z_w = f_att->$vNam(varn+1)$
776                                                                        break
777                                                                     else
778                                                                        if(vNam(varn) .EQ. "wsss" .OR. isStrSubset(vNam(varn), "wsss_")\
779                                                                            .OR. vNam(varn) .EQ. "w*s*" .OR. isStrSubset(vNam(varn), "w*s*_"))then
780                                                                           z_w = f_att->$vNam(varn+1)$
781                                                                           break
782                                                                        else
783                                                                           if(vNam(varn) .EQ. "ws" .OR. isStrSubset(vNam(varn), "ws_"))then
784                                                                              z_w = f_att->$vNam(varn+1)$
785                                                                              break
786                                                                           else
787                                                                              if(vNam(varn) .EQ. "wpsap" .OR. isStrSubset(vNam(varn), "wpsap_")\
788                                                                                  .OR. vNam(varn) .EQ. "w"+dq+"sa"+dq .OR. isStrSubset(vNam(varn), "w"+dq+"sa"+dq+"_"))then
789                                                                                 z_w = f_att->$vNam(varn+1)$
790                                                                                 break
791                                                                              else
792                                                                                 if(vNam(varn) .EQ. "wssas" .OR. isStrSubset(vNam(varn), "wssas_")\
793                                                                                     .OR. vNam(varn) .EQ. "w*sa*" .OR. isStrSubset(vNam(varn), "w*sa*_"))then
794                                                                                    z_w = f_att->$vNam(varn+1)$
795                                                                                    break
796                                                                                 else
797                                                                                    if(vNam(varn) .EQ. "wsa" .OR. isStrSubset(vNam(varn), "wsa_"))then
798                                                                                       z_w = f_att->$vNam(varn+1)$
799                                                                                       break
800                                                                                    else
801                                                                                       if(vNam(varn) .EQ. "wses" .OR. isStrSubset(vNam(varn), "wses_")\
802                                                                                          .OR. vNam(varn) .EQ. "w*e*" .OR. isStrSubset(vNam(varn), "w*e*_"))then
803                                                                                          z_w = f_att->$vNam(varn+1)$
804                                                                                          break
805                                                                                       else
806                                                                                          if(vNam(varn) .EQ. "ws2" .OR. isStrSubset(vNam(varn), "ws2_")\
807                                                                                             .OR. vNam(varn) .EQ. "w*2" .OR. isStrSubset(vNam(varn), "w*2_"))then
808                                                                                             z_w = f_att->$vNam(varn+1)$
809                                                                                             break
810                                                                                          else
811                                                                                             if(vNam(varn) .EQ. "ws3" .OR. isStrSubset(vNam(varn), "ws3_")\
812                                                                                                .OR. vNam(varn) .EQ. "w*3" .OR. isStrSubset(vNam(varn), "w*3_"))then
813                                                                                                z_w = f_att->$vNam(varn+1)$
814                                                                                                break
815                                                                                             else
816                                                                                                if(vNam(varn) .EQ. "Sw" .OR. isStrSubset(vNam(varn), "Sw_"))then
817                                                                                                   z_w = f_att->$vNam(varn+1)$
818                                                                                                   break
819                                                                                                else
820                                                                                                   if(vNam(varn) .EQ. "ws2pts".OR. isStrSubset(vNam(varn), "ws2pts_")\
821                                                                                                      .OR. vNam(varn) .EQ. "w*2pt*" .OR. isStrSubset(vNam(varn), "w*2pt*_"))then
822                                                                                                      z_w = f_att->$vNam(varn+1)$
823                                                                                                      break
824                                                                                                   else
825                                                                                                      if(vNam(varn) .EQ. "wspts2" .OR. isStrSubset(vNam(varn), "wspts2_")\
826                                                                                                         .OR. vNam(varn) .EQ. "w*pt*2" .OR. isStrSubset(vNam(varn), "w*pt*2_"))then
827                                                                                                         z_w = f_att->$vNam(varn+1)$
828                                                                                                         break                                           
829                                                                                                      end if
830                                                                                                   end if
831                                                                                                end if
832                                                                                             end if
833                                                                                          end if
834                                                                                       end if
835                                                                                    end if
836                                                                                 end if
837                                                                              end if
838                                                                           end if
839                                                                        end if   
840                                                                     end if
841                                                                  end if
842                                                               end if
843                                                            end if
844                                                         end if
845                                                      end if
846                                                   end if
847                                                end if
848                                             end if
849                                          end if
850                                       end if
851                                    end if
852                                 end if
853                              end if
854                           end if
855                        end if
856                     end if
857                  end if
858               end if
859            end if
860         end if
861      end if
862   end do
863   
864   if (.not. isvar("z_u") .AND. .not. isvar ("z_w")) then
865      co=0
866      do varn=0,dim-1     
867         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
868            check = False
869         else
870            check = True
871            if (var .NE. "all") then
872               check = isStrSubset( var,","+vNam(varn)+"," )
873            end if         
874         end if
875         if (check)then
876            co=co+1
877            z = f_att->$vNam(varn+1)$
878            if (getvardims(z) .EQ. "zu")then
879               z_u = z
880            else
881               if (getvardims(z) .EQ. "zw")then
882                  z_w = z
883               end if
884            end if
885            dimz = dimsizes(z)
886            break
887         end if   
888      end do
889      if (co .EQ. 0) then
890         print(" ")
891         print("The variables 'var="+var+"'" )
892         print("do not exist on your input file;")
893         print("be sure to have one comma before and after each variable")
894         print(" ")
895         exit           
896      end if
897   end if
898
899   if (isvar("z_u") ) then
900      dimz  = dimsizes(z_u)
901   else
902      if (isvar("z_w"))then
903         dimz  = dimsizes(z_w)
904      end if
905   end if
906
907   else
908
909      do varn = dim-1,0,1
910         if (vNam(varn) .EQ. "zu_3d")then
911            z_u = f_att->zu_3d 
912            dimz  = dimsizes(z_u)         
913         else
914            if (vNam(varn) .EQ. "zw_3d")then
915               z_w = f_att->zw_3d
916               dimz  = dimsizes(z_w)
917            end if
918         end if
919         if (vNam(varn) .EQ. "x")then
920            x = f_att->x
921            dimx=dimsizes(x)
922         else
923            if (vNam(varn) .EQ. "xu")then
924               x = f_att->xu
925               dimx=dimsizes(x)
926            end if
927         end if
928         if (vNam(varn) .EQ. "y")then
929            y = f_att->y
930            dimy=dimsizes(y)
931         else
932            if (vNam(varn) .EQ. "yv")then
933               y = f_att->yv
934               dimy=dimsizes(y)
935            end if
936         end if
937      end do
938
939   end if
940   
941   if(.not. isvar("z_u") .AND. .not. isvar("z_w"))then
942      print(" ")
943      print("Program aborts - there are no z-variables available")
944      print("Be sure if 'plot_3d' is set correctly")
945      print(" ")
946      exit
947   end if
948 
949
950   t_all = f[:]->time
951   nt    = dimsizes(t_all)
952
953   
954   if (nt .EQ. 1)then
955      delta_t=t_all(nt-1)/nt
956   else
957      delta_t=(t_all(nt-1)-t_all(0))/(nt-1)
958   end if
959
960   ; ****************************************************       
961   ; start of time step and different types of mistakes that could be done
962   ; ****************************************************
963   
964   if (start_time_step .EQ. -1.) then           
965      start_time_step=t_all(0)/3600     
966   else
967      if (start_time_step .GT. t_all(nt-1)/3600)then
968         print(" ")
969         print("'start_time_step' = "+ start_time_step +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
970         print(" ")
971         print("Select another 'start_time_step'")
972         print(" ")
973         exit
974      end if
975      if (start_time_step .LT. t_all(0)/3600)then
976         print(" ")
977         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
978         print(" ")
979         exit
980      end if
981   end if
982
983   do i=0,nt-1   
984      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
985         st=i
986         break
987      end if
988   end do
989   if (.not. isvar("st"))then
990      print(" ")
991      print("'start_time_step' = "+ start_time_step +"h is invalid")
992      print(" ")
993      print("Select another 'start_time_step'")
994      print(" ")
995      exit
996   end if
997   
998   ; ****************************************************
999   ; end of time step and different types of mistakes that could be done
1000   ; ****************************************************
1001
1002   if (end_time_step .EQ. -1.) then             
1003      end_time_step = t_all(nt-1)/3600 
1004   else
1005      if (end_time_step .GT. t_all(nt-1)/3600)then
1006         print(" ")
1007         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")
1008         print(" ")
1009         print("Select another 'end_time_step'") 
1010         print(" ")
1011         exit
1012      end if
1013      if (end_time_step .LT. start_time_step/3600)then
1014         print(" ")
1015         print("'end_time_step' = "+ end_time_step +"h is lower than 'start_time_step' = "+start_time_step+"h")
1016         print(" ")
1017         print("Select another 'start_time_step' or 'end_time_step'")
1018         print(" ")
1019         exit
1020      end if
1021   end if
1022
1023   do i=0,nt-1     
1024      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
1025         et=i
1026         break
1027      end if
1028   end do
1029   if (.not. isvar("et"))then
1030      print(" ")
1031      print("'end_time_step' = "+ end_time_step +"h is invalid")
1032      print(" ")
1033      print("Select another 'end_time_step'")
1034      print(" ")
1035      exit
1036   end if   
1037
1038   delete(start_time_step)
1039   start_time_step=round(st,3)
1040   delete(end_time_step)
1041   end_time_step=round(et,3)
1042
1043   no_time = end_time_step-start_time_step+1
1044   
1045   ; ****************************************************
1046   ; time_stride and different types of mistakes that could be done
1047   ; ****************************************************
1048 
1049   if (time_stride .LT. 1) then
1050      print(" ")
1051      print("'time_stride' has to be positive and is set to 1")
1052      print(" ")
1053      time_stride = 1
1054   end if
1055
1056   if (time_stride .GE. no_time) then
1057      print(" ")
1058      print("'time_stride' is greater equal than number of available time steps,")
1059      print("=> 'time_stride' is set to 1")
1060      time_stride = 1
1061   end if
1062
1063   ti_in = ispan(start_time_step,end_time_step,time_stride) ;ti_in contents the time indices to plot
1064   np    = dimsizes(ti_in) 
1065
1066   print(" ")
1067   print("Output of time steps from "+t_all(start_time_step)/3600+" h = "+t_all(start_time_step)+" s => index = "+start_time_step)
1068   print("                     till "+t_all(ti_in(np-1))/3600+" h = "+t_all(ti_in(np-1))+" s => index = "+end_time_step)
1069   print("                     with temporal stride = "+time_stride)
1070   print(" ")
1071
1072
1073   ; ****************************************************
1074   ; set up legend and colors
1075   ; ****************************************************
1076   
1077   legend_label=new(np,double)
1078   do p=0, np-1
1079      legend_label(p)=decimalPlaces(t_all(ti_in(p))/3600,3,True)         
1080   end do
1081   
1082
1083   ; ***************************************************
1084   ; set up recourses
1085   ; ***************************************************
1086
1087   res                         = True
1088   res@gsnDraw                 = False
1089   res@gsnFrame                = False
1090   res@gsnPaperOrientation     = "portrait"
1091   res@gsnPaperWidth           = 8.27
1092   res@gsnPaperHeight          = 11.69
1093   res@gsnPaperMargin          = 0.79
1094   res@txFont                  = "helvetica"
1095   res@tiMainFont              = "helvetica"
1096   res@tiXAxisFont             = "helvetica"
1097   res@tiYAxisFont             = "helvetica"
1098   res@tmXBLabelFont           = "helvetica"
1099   res@tmYLLabelFont           = "helvetica"
1100   res@lgLabelFont             = "helvetica"
1101   res@tmLabelAutoStride       = True
1102   if (legend .EQ. 1)then
1103      res@pmLegendDisplayMode     = "Always"
1104   end if
1105   res@pmLegendSide            = "Top"
1106   res@xyExplicitLegendLabels  = legend_label
1107   res@pmLegendParallelPosF    = 1.15
1108   res@pmLegendOrthogonalPosF  = -1.0
1109   res@pmLegendWidthF          = 0.12
1110   res@pmLegendHeightF         = 0.05*np
1111   res@lgLabelFontHeightF     = font_size
1112   res@lgTitleString      = "Time [h]"
1113   res@lgTitleFontHeightF = font_size   
1114   res@txFontHeightF      = font_size
1115   res@tiXAxisFontHeightF = font_size
1116   res@tiYAxisFontHeightF = font_size
1117   res@tmXBLabelFontHeightF = font_size
1118   res@tmYLLabelFontHeightF = font_size
1119   res@tiXAxisString      = " "
1120   if ( black .eq. 0 ) then 
1121      res@xyLineColors = -(ispan(-237,-2,235/np))
1122   end if
1123   if (norm_z .EQ. 1)then
1124      res@tiYAxisString      = "Height [m]"
1125   else   
1126      res@tiYAxisString      = "Height / "+norm_z+" [m]"
1127   end if
1128   
1129   if (log_z .EQ. 1) then
1130      res@trYLog = True
1131   end if
1132
1133   if (dash .EQ. 0 ) then
1134      res@xyMonoDashPattern       = True
1135   else
1136      res@xyMonoDashPattern       = False
1137      if (no_files .GT. 1)
1138         res@xyMonoDashPattern       = True 
1139         print(" ")
1140         print("If you use more than one file, patterns for different timesteps cannot be used")
1141         print(" ")
1142      end if       
1143   end if
1144
1145   res@tmXBMinorPerMajor = 4
1146   res@tmYLMinorPerMajor = 4
1147
1148   resP                        = True
1149   resP@txFont                 = "helvetica"
1150   resP@txString               = f_att@title
1151   resP@txFuncCode             = "~"
1152   resP@txFontHeightF          = 0.015
1153
1154   ; ***************************************************
1155   ; set up graphics for plot
1156   ; ***************************************************
1157
1158   if (combine .EQ. 1) then
1159      plot_o = new(number_comb,graphic)   
1160      label=new(number_comb,string)
1161      color_o=new(number_comb,integer)
1162      mini=new(number_comb,float)
1163      maxi=new(number_comb,float)
1164   end if
1165 
1166   wks=gsn_open_wks(format_out,file_out)
1167   gsn_define_colormap(wks,"rainbow+white")
1168
1169   ; ***************************************************
1170   ; set up minimum and maximum height
1171   ; ***************************************************
1172
1173   if (log_z .EQ. 1)then
1174      if (min_z .EQ. -1)then
1175         if (isvar("z_u"))then
1176            min_z=z_u(1)
1177         else
1178            min_z=z_w(1)
1179         end if       
1180      else
1181         if (isvar("z_w"))then
1182            if (min_z .GE. max(z_w) ) then
1183               print(" ")
1184               print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_w)+")")
1185               print(" ")
1186               exit
1187            end if         
1188         else
1189            if (min_z .GE. max(z_u) ) then
1190               print(" ")
1191               print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_u)+")")
1192               print(" ")
1193               exit
1194            end if
1195         end if
1196         if (isvar("z_u"))then   
1197            if (min_z .LT. z_u(1) ) then
1198               print(" ")
1199               print("Begin height 'min_z' at least at level k=1 (="+z_u(1)+"m) due to the logarithmic scale of the y-axis")
1200               print(" ")
1201               exit
1202            end if
1203         else
1204            if (min_z .LT. z_w(1) ) then
1205               print(" ")
1206               print("Begin height 'min_z' at least at level k=1 (="+z_w(1)+"m) due to the logarithmic scale of the y-axis")
1207               print(" ")
1208               exit
1209            end if   
1210         end if
1211      end if
1212   else
1213      if (isvar("z_u"))then
1214         if (min_z .EQ. -1)then
1215            min_z=z_u(0)
1216         end if
1217      else
1218         if (min_z .EQ. -1)then
1219            min_z=z_w(0)
1220         end if   
1221      end if
1222   
1223      if (isvar("z_w"))then
1224         if (min_z .GE. max(z_w) ) then
1225            print(" ")
1226            print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_w)+")")
1227            print(" ")
1228            exit
1229         end if
1230      else
1231         if (min_z .EQ. -1)then
1232            min_z=z_u(0)
1233         end if
1234         if (min_z .GE. max(z_u) ) then
1235            print(" ")
1236            print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_u)+")")
1237            print(" ")
1238            exit
1239         end if
1240      end if
1241   end if
1242   
1243   if (isvar("z_w"))then
1244      if (max_z .EQ. -1)then
1245         max_z=max(z_w)
1246      end if
1247   else
1248      if (max_z .EQ. -1)then
1249         max_z=max(z_u)
1250      end if   
1251   end if
1252   
1253   if (isvar("z_w"))then
1254      if (max_z .GT. max(z_w) ) then
1255         print(" ")
1256         print("Maximum of height ('max_z'="+max_z+") is greater than available heights (="+max(z_w)+")")
1257         print(" ")
1258         exit
1259      end if
1260   end if
1261
1262   min_z=min_z/norm_z
1263   max_z=max_z/norm_z
1264
1265   ; ***************************************************
1266   ; read data and create plots
1267   ; ***************************************************
1268     
1269   do ti =0,np-1
1270      if( t_all(ti_in(ti)) .lt. 10^36) then
1271         start_time_step = ti
1272         break
1273      end if
1274   end do 
1275   
1276   if (log_z .EQ. 1) then
1277      data   = new((/dim,np,dimz-1/),float)
1278      data@_FillValue=9.96921e+36
1279      data_0 = new((/np,dimz-1/),float)
1280      data_0 = 0.1
1281      t      = new((/np,dimz-1/),float)
1282      t      = 0.0
1283      unit   = new(dim,string)
1284      if (isvar("z_u"))then
1285         if (typeof(z_u) .EQ. "double")then
1286            z_v    = new((/dim,dimz/),double)
1287            z_     = new((/dim,dimz-1/),double)
1288         else
1289            if (typeof(z_u) .EQ. "float")then
1290               z_v    = new((/dim,dimz/),float)
1291               z_     = new((/dim,dimz-1/),float)
1292            end if
1293         end if
1294      else
1295         if (isvar("z_w"))then
1296            if (typeof(z_w) .EQ. "double")then
1297               z_v    = new((/dim,dimz/),double)
1298               z_     = new((/dim,dimz-1/),double)
1299            else
1300               if (typeof(z_w) .EQ. "float")then
1301                  z_v    = new((/dim,dimz/),float)
1302                  z_     = new((/dim,dimz-1/),float)
1303               end if
1304            end if
1305         end if
1306      end if
1307   else
1308      data   = new((/dim,np,dimz/),float)
1309      data@_FillValue=9.96921e+36
1310      data_0 = new((/np,dimz/),float)
1311      data_0 = 0.0
1312      t      = new((/np,dimz/),float)
1313      t      = 0.0
1314      unit   = new(dim,string)
1315      if (isvar("z_u"))then
1316         if (typeof(z_u) .EQ. "double")then
1317            z_v    = new((/dim,dimz/),double)
1318            z_     = new((/dim,dimz/),double)
1319         else
1320            if (typeof(z_u) .EQ. "float")then
1321               z_v    = new((/dim,dimz/),float)
1322               z_     = new((/dim,dimz/),float)
1323            end if
1324         end if
1325      else
1326         if (isvar("z_w"))then
1327            if (typeof(z_w) .EQ. "double")then
1328               z_v    = new((/dim,dimz/),double)
1329               z_     = new((/dim,dimz/),double)
1330            else
1331               if (typeof(z_w) .EQ. "float")then
1332                  z_v    = new((/dim,dimz/),float)
1333                  z_     = new((/dim,dimz/),float)
1334               end if
1335            end if
1336         end if
1337      end if
1338   end if
1339
1340   end if
1341   ;------------------------------------------------------ above steps only for first file
1342
1343   ; ***************************************************
1344   ; indicate plot number
1345   ; ***************************************************
1346   
1347   if (combine .EQ. 1) then
1348      n = 1
1349   else
1350      n = 0
1351   end if
1352
1353   if (over .EQ. 1) then
1354      plot_u         = gsn_csm_xy(wks,t,data_0(:,:),res)
1355      miniu = 1.E27
1356      maxiu =-1.E27
1357      plot_v         = gsn_csm_xy(wks,t,data_0(:,:),res)
1358      miniv = 1.E27
1359      maxiv =-1.E27
1360      plot_w         = gsn_csm_xy(wks,t,data_0(:,:),res)
1361      miniw = 1.E27
1362      maxiw =-1.E27
1363      plot_pt        = gsn_csm_xy(wks,t,data_0(:,:),res)
1364      minipt = 1.E27
1365      maxipt =-1.E27
1366      plot_vpt       = gsn_csm_xy(wks,t,data_0(:,:),res)
1367      minivpt = 1.E27
1368      maxivpt =-1.E27
1369      plot_lpt       = gsn_csm_xy(wks,t,data_0(:,:),res)
1370      minilpt = 1.E27
1371      maxilpt =-1.E27
1372      plot_q         = gsn_csm_xy(wks,t,data_0(:,:),res)
1373      miniq = 1.E27
1374      maxiq =-1.E27
1375      plot_qv        = gsn_csm_xy(wks,t,data_0(:,:),res)
1376      miniqv = 1.E27
1377      maxiqv =-1.E27
1378      plot_ql        = gsn_csm_xy(wks,t,data_0(:,:),res)
1379      miniql = 1.E27
1380      maxiql =-1.E27
1381      plot_rho       = gsn_csm_xy(wks,t,data_0(:,:),res)
1382      plot_s         = gsn_csm_xy(wks,t,data_0(:,:),res)
1383      plot_sa        = gsn_csm_xy(wks,t,data_0(:,:),res)
1384      plot_e         = gsn_csm_xy(wks,t,data_0(:,:),res)
1385      minie = 1.E27
1386      maxie =-1.E27
1387      plot_es        = gsn_csm_xy(wks,t,data_0(:,:),res)
1388      minie = 1.E27
1389      maxie =-1.E27
1390      plot_km        = gsn_csm_xy(wks,t,data_0(:,:),res)
1391      minie = 1.E27
1392      maxie =-1.E27
1393      plot_kh        = gsn_csm_xy(wks,t,data_0(:,:),res)
1394      minie = 1.E27
1395      maxie =-1.E27
1396      plot_l         = gsn_csm_xy(wks,t,data_0(:,:),res)     
1397      plot_wpup      = gsn_csm_xy(wks,t,data_0(:,:),res)
1398      miniwpup = 1.E27
1399      maxiwpup =-1.E27
1400      plot_wsus      = gsn_csm_xy(wks,t,data_0(:,:),res)
1401      miniwsus = 1.E27
1402      maxiwsus =-1.E27
1403      plot_wu        = gsn_csm_xy(wks,t,data_0(:,:),res)
1404      miniwu = 1.E27
1405      maxiwu =-1.E27
1406      plot_wpvp      = gsn_csm_xy(wks,t,data_0(:,:),res)
1407      miniwpvp = 1.E27
1408      maxiwpvp =-1.E27
1409      plot_wsvs      = gsn_csm_xy(wks,t,data_0(:,:),res)
1410      miniwsvs = 1.E27
1411      maxiwsvs =-1.E27
1412      plot_wv        = gsn_csm_xy(wks,t,data_0(:,:),res)
1413      miniwv = 1.E27
1414      maxiwv =-1.E27
1415      plot_wpptp     = gsn_csm_xy(wks,t,data_0(:,:),res)
1416      miniwpptp = 1.E27
1417      maxiwpptp =-1.E27
1418      plot_wspts     = gsn_csm_xy(wks,t,data_0(:,:),res)
1419      miniwspts = 1.E27
1420      maxiwspts =-1.E27
1421      plot_wpt       = gsn_csm_xy(wks,t,data_0(:,:),res)
1422      miniwpt = 1.E27
1423      maxiwpt =-1.E27
1424      plot_wsptsBC   = gsn_csm_xy(wks,t,data_0(:,:),res)
1425      miniwsptsBC = 1.E27
1426      maxiwsptsBC =-1.E27
1427      plot_wptBC     = gsn_csm_xy(wks,t,data_0(:,:),res)
1428      miniwptBC = 1.E27
1429      maxiwptBC =-1.E27
1430      plot_wpvptp    = gsn_csm_xy(wks,t,data_0(:,:),res)
1431      miniwpvptp = 1.E27
1432      maxiwpvptp =-1.E27
1433      plot_wsvpts    = gsn_csm_xy(wks,t,data_0(:,:),res)
1434      miniwsvpts = 1.E27
1435      maxiewsvpts=-1.E27
1436      plot_wvpt      = gsn_csm_xy(wks,t,data_0(:,:),res)
1437      miniwvpt = 1.E27
1438      maxiwvpt =-1.E27
1439      plot_wpqp      = gsn_csm_xy(wks,t,data_0(:,:),res)
1440      miniwpqp = 1.E27
1441      maxiwpqp =-1.E27
1442      plot_wsqs      = gsn_csm_xy(wks,t,data_0(:,:),res)
1443      miniwsqs = 1.E27
1444      maxiwsqs =-1.E27
1445      plot_wq        = gsn_csm_xy(wks,t,data_0(:,:),res)
1446      miniwq = 1.E27
1447      maxiwq =-1.E27
1448      plot_wpqvp     = gsn_csm_xy(wks,t,data_0(:,:),res)
1449      miniwpqvp = 1.E27
1450      maxiwpqvp =-1.E27
1451      plot_wsqvs     = gsn_csm_xy(wks,t,data_0(:,:),res)
1452      miniwsqvs = 1.E27
1453      maxiwsqvs =-1.E27
1454      plot_wqv       = gsn_csm_xy(wks,t,data_0(:,:),res)
1455      miniwqv = 1.E27
1456      maxiwqv =-1.E27
1457      plot_wpsp      = gsn_csm_xy(wks,t,data_0(:,:),res)
1458      miniwpsp = 1.E27
1459      maxiwpsp =-1.E27
1460      plot_wsss      = gsn_csm_xy(wks,t,data_0(:,:),res)
1461      miniwsss = 1.E27
1462      maxiwsss =-1.E27
1463      plot_ws        = gsn_csm_xy(wks,t,data_0(:,:),res)
1464      miniws = 1.E27
1465      maxiws =-1.E27
1466      plot_wpsap     = gsn_csm_xy(wks,t,data_0(:,:),res)
1467      miniwpsap = 1.E27
1468      maxiwpsap =-1.E27
1469      plot_wssas     = gsn_csm_xy(wks,t,data_0(:,:),res)
1470      miniwssas = 1.E27
1471      maxiwssas =-1.E27
1472      plot_wsa       = gsn_csm_xy(wks,t,data_0(:,:),res)
1473      miniwsa = 1.E27
1474      maxiwsa =-1.E27
1475      plot_wses      = gsn_csm_xy(wks,t,data_0(:,:),res)
1476      plot_us2       = gsn_csm_xy(wks,t,data_0(:,:),res)
1477      minius2 = 1.E27
1478      maxius2 =-1.E27
1479      plot_vs2       = gsn_csm_xy(wks,t,data_0(:,:),res)
1480      minivs2 = 1.E27
1481      maxivs2 =-1.E27
1482      plot_ws2       = gsn_csm_xy(wks,t,data_0(:,:),res)
1483      miniws2 = 1.E27
1484      maxiws2 =-1.E27
1485      plot_pts2      = gsn_csm_xy(wks,t,data_0(:,:),res)
1486      plot_ws3       = gsn_csm_xy(wks,t,data_0(:,:),res)
1487      plot_Sw        = gsn_csm_xy(wks,t,data_0(:,:),res)
1488      plot_ws2pts    = gsn_csm_xy(wks,t,data_0(:,:),res)
1489      plot_wspts2    = gsn_csm_xy(wks,t,data_0(:,:),res)
1490      plot_wsususodz = gsn_csm_xy(wks,t,data_0(:,:),res)
1491      miniwsususodz = 1.E27
1492      maxiwsususodz =-1.E27
1493      plot_wspsodz   = gsn_csm_xy(wks,t,data_0(:,:),res)
1494      miniwspsodz = 1.E27
1495      maxiwspsodz =-1.E27
1496      plot_wpeodz    = gsn_csm_xy(wks,t,data_0(:,:),res)
1497      miniwpeodz = 1.E27
1498      maxiwpeodz =-1.E27
1499   end if
1500
1501   if (prof3d .EQ. 1)then
1502
1503   if (end_x .EQ. -1) then
1504      end_x=dimx-2
1505   end if
1506   if (end_y .EQ. -1)then
1507      end_y=dimy-2
1508   end if
1509   if (start_x .LT. 0)then
1510      print(" ")
1511      print("'start_x' is lower than 0 and set to 0")
1512      print(" ")
1513      start_x=0
1514   end if
1515   if (start_x .GT. dimx-1)then
1516      print(" ")
1517      print("'start_x' is greater than available x-range and set to maximum of x-range (excluding ghostpoint)")
1518      print(" ")
1519      start_x=dimx-2
1520   end if
1521   if (end_x .EQ. dimx-1)then
1522      print(" ")
1523      print("'end_x' = "+end_x+" and includes the ghostpoint")
1524      print(" ")
1525   end if
1526   if (end_x .GT. dimx-1)then
1527      print(" ")
1528      print("'end_x' = "+end_x+" is greater than available x-range and set to maximum of x-range (excluding ghostpoint)")
1529      print(" ")
1530      end_x=dimx-2
1531   end if
1532   if (end_x .LT. start_x)then
1533      print(" ")
1534      print("'end_x' = "+end_x+" is lower than 'start_x' = "+start_x+" and set to maximum of x-range (excluding ghostpoint)")
1535      print(" ")
1536      end_x=dimx-2
1537   end if
1538   if (start_y .LT. 0)then
1539      print(" ")
1540      print("'start_y' is lower than 0 and set to 0")
1541      print(" ")
1542      start_y=0
1543   end if
1544   if (start_y .GT. dimy-1)then
1545      print(" ")
1546      print("'start_y' is greater than available y-range and set to maximum of y-range (excluding ghostpoint)")
1547      print(" ")
1548      start_x=dimy-2
1549   end if
1550   if (end_y .EQ. dimy-1)then
1551      print(" ")
1552      print("'end_y' = "+end_y+" and includes the ghostpoint")
1553      print(" ")
1554   end if
1555   if (end_y .GT. dimy-1)then
1556      print(" ")
1557      print("'end_y' = "+end_y+" is greater than available y-range and set to maximum of y-range (excluding ghostpoint)")
1558      print(" ")
1559      end_x=dimy-2
1560   end if
1561   if (end_y .LT. start_y)then
1562      print(" ")
1563      print("'end_y' = "+end_y+" is lower than 'start_y' = "+start_y+" and set to maximum of y-range (excluding ghostpoint)")
1564      print(" ")
1565      end_y=dimy-2
1566   end if
1567   
1568   end if
1569 
1570   n_o=0
1571   count_var=0
1572
1573   res@xyDashPattern = 1*nof
1574
1575   over_remind = False
1576   if ( over .eq. 1)then
1577     over_remind = True
1578   end if
1579   
1580   do varn = 0,dim-1
1581
1582      check = True
1583     
1584      if (prof3d .EQ. 0) then
1585         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
1586            check = False
1587         end if
1588      else
1589         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "zusi") .OR. isStrSubset( vNam(varn), "zwwi") .OR. isStrSubset( vNam(varn), "x") .OR. isStrSubset( vNam(varn), "xu") .OR. isStrSubset( vNam(varn), "y") .OR. isStrSubset( vNam(varn), "yv") .OR. isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
1590            check = False
1591         end if
1592      end if
1593
1594      if (var .NE. "all") then
1595         check = isStrSubset( var,","+vNam(varn)+"," )
1596      end if
1597
1598      if (combine .EQ. 1) then         
1599         com=isStrSubset(c_var,","+vNam(varn)+"," )     
1600         if (com) then     
1601            if (prof3d .EQ. 0) then                 
1602               temp     = f[:]->$vNam(varn)$         
1603               temp_att = f_att->$vNam(varn)$
1604               if (log_z .EQ. 1) then
1605                  do j=0,np-1
1606                     data(varn,j,:) = temp(ti_in(j),1:dimz-1)
1607                  end do
1608               else
1609                  do j=0,np-1
1610                     data(varn,j,:) = temp(ti_in(j),0:dimz-1)
1611                  end do
1612               end if
1613            else
1614               if (log_z .EQ. 1) then
1615                  do i=1,dimz-1
1616                     do j=0,np-1
1617                        temp = f[:]->$vNam(varn)$
1618                        temp_att = f_att->$vNam(varn)$
1619                        data_temp = temp(ti_in(j),i,start_y:end_y,start_x:end_x)
1620                        data(varn,j,i-1) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1621                     end do
1622                  end do
1623               else
1624                  do i=0,dimz-1
1625                     do j=0,np-1
1626                        temp = f[:]->$vNam(varn)$
1627                        temp_att = f_att->$vNam(varn)$
1628                        data_temp = temp(ti_in(j),i,start_y:end_y,start_x:end_x)
1629                        data(varn,j,i) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1630                     end do
1631                  end do
1632               end if
1633               print(" ")
1634               print("Variable for combine '"+vNam(varn)+"' is read")
1635               print(" ")
1636            end if                 
1637            unit(varn) = temp_att@units
1638            if (n_o .GT. number_comb-1) then
1639               print(" ")
1640               print("Set 'number_comb' to the number of overlaying variables ('c_var' = "+c_var+")")
1641               print(" ")
1642               exit
1643            end if
1644            if (abs(min(data(varn,:,:))) .GT. 10)then
1645               min_value = abs(0.01*min(data(varn,:,:)))
1646               max_value = abs(0.01*max(data(varn,:,:)))
1647            else
1648               if (abs(min(data(varn,:,:))) .LT. 0.01 .AND. abs(max(data(varn,:,:))) .GT. 0.01)then
1649                  min_value = abs(0.1*max(data(varn,:,:)))
1650                  max_value = abs(0.1*max(data(varn,:,:)))
1651               else
1652                  if (abs(max(data(varn,:,:))) .LT. 0.01 .AND. abs(min(data(varn,:,:))) .GT. 0.01)then
1653                     min_value = abs(0.1*min(data(varn,:,:)))
1654                     max_value = abs(0.1*min(data(varn,:,:)))
1655                  else
1656                     min_value = abs(0.1*min(data(varn,:,:)))
1657                     max_value = abs(0.1*max(data(varn,:,:)))
1658                  end if
1659               end if
1660            end if
1661            if (min(data(varn,:,:)) .EQ. 0 .AND. max(data(varn,:,:)) .EQ. 0)then
1662               min_value = 0.1
1663               max_value = 0.1
1664            end if
1665            mini(n_o)=min(data(varn,:,:))
1666            maxi(n_o)=max(data(varn,:,:))
1667            n_o=n_o+1
1668         end if
1669      end if
1670
1671      if(check) then
1672         
1673         count_var=count_var+1
1674
1675         if (prof3d .EQ. 0) then         
1676            temp = f[:]->$vNam(varn)$
1677            temp_att = f_att->$vNam(varn)$
1678         else
1679             if (log_z .EQ. 1) then
1680               do i=1,dimz-1
1681                  do j=0,np-1
1682                     temp= f[:]->$vNam(varn)$
1683                     temp_att = f_att->$vNam(varn)$
1684                     data_temp = temp(ti_in(j),i,start_y:end_y,start_x:end_x)
1685                     data(varn,j,i-1) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1686                     delete(data_temp)
1687                  end do
1688               end do
1689            else
1690               do i=0,dimz-1
1691                  do j=0,np-1
1692                     temp= f[:]->$vNam(varn)$
1693                     temp_att = f_att->$vNam(varn)$
1694                     data_temp = temp(ti_in(j),i,start_y:end_y,start_x:end_x)
1695                     data_temp!0 = "t"
1696                     data_temp!1 = "z"
1697                     data(varn,j,i) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1698                     delete(data_temp)
1699                  end do
1700               end do
1701            end if
1702            print(" ")
1703            print("Variable '"+vNam(varn)+"' is read")
1704            print(" ")
1705            unit(varn) = temp_att@units
1706            a=getvardims(temp_att)
1707            b=dimsizes(a)
1708         end if
1709
1710         if (prof3d .EQ. 0) then
1711            if (log_z .EQ. 1) then
1712               z = f_att->$vNam(varn+1)$(1:dimz-1)
1713               unit(varn) = temp_att@units
1714               do j=0,np-1
1715                  data(varn,j,:) = temp(ti_in(j),1:dimz-1)
1716               end do
1717            else
1718               z = f_att->$vNam(varn+1)$
1719               unit(varn) = temp_att@units
1720               do j=0,np-1
1721                  data(varn,j,:) = temp(ti_in(j),:)
1722               end do
1723            end if
1724         else
1725            do i=0,b-1           
1726               if (isStrSubset( a(i),"zu_3d" ))then
1727                  z_v(varn,:) = z_u
1728                  if (log_z .EQ. 1) then
1729                     z = z_v(varn,1:dimz-1)
1730                  else
1731                     z = z_v(varn,:)
1732                  end if
1733               else
1734                  if (isStrSubset( a(i),"zw_3d" ))then
1735                     z_v(varn,:) = z_w
1736                     if (log_z .EQ. 1) then
1737                        z = z_v(varn,1:dimz-1)
1738                     else
1739                        z = z_v(varn,:)
1740                     end if
1741                  end if                   
1742               end if
1743            end do           
1744         end if
1745
1746         if (isStrSubset(data@long_name," SR " ) ) then
1747           over = 0
1748         end if
1749         
1750         if (nof .EQ. 0) then
1751            z_(n,:)=z/norm_z
1752            z    = z_(n,:)
1753         else
1754            z=z/norm_z
1755         end if
1756
1757         delta_z = z(1) - z(0)
1758
1759         max_z_int=doubletoint(max_z/delta_z)
1760         min_z_int=doubletoint(min_z/delta_z)
1761
1762         if(max_z_int .eq. min_z_int)
1763             print(" ")
1764             print("Please increase 'max_z' or decrease 'min_z' so that there are")
1765             print("at least two layers for the z-axis to plot")
1766             print(" ")
1767             exit
1768         end if
1769
1770         if(min_z_int .gt. max_z_int)
1771            print(" ")
1772            print("'min_z' is greater than 'max_z',")
1773            print("please change this")
1774            print(" ")
1775            exit
1776         end if
1777
1778         if (max_z_int .gt. dimz-1)
1779            max_z_int = dimz-1
1780            if (log_z .EQ. 1) then
1781             max_z_int = max_z_int - 1
1782            end if
1783         end if
1784
1785         if (min_z_int .lt. 0)
1786            min_z_int = 0
1787            if (log_z .EQ. 1) then
1788              min_z_int = min_z_int + 1
1789            end if
1790         end if         
1791
1792         if (abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 10)then
1793            min_value = abs(0.001*min(data(varn,:,min_z_int:max_z_int)))
1794            max_value = abs(0.001*max(data(varn,:,min_z_int:max_z_int)))
1795         else
1796            if (abs(min(data(varn,:,min_z_int:max_z_int))) .LT. 0.01 .AND. \
1797                abs(max(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
1798               min_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
1799               max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
1800            else
1801               if (abs(max(data(varn,:,min_z_int:max_z_int))) .LT. 0.01 .AND.\
1802                   abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
1803                  min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
1804                  max_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
1805               else
1806                  min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
1807                  max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
1808               end if
1809            end if
1810         end if
1811       
1812         if (min(data(varn,:,min_z_int:max_z_int)) .EQ. 0 .AND. \
1813             max(data(varn,:,min_z_int:max_z_int)) .EQ. 0)then
1814            min_value = 0.1
1815            max_value = 0.1
1816         end if       
1817
1818         if (over .EQ. 0) then 
1819            res@gsnLeftString      = vNam(varn)
1820            res@tiXAxisString      = "["+unit(varn)+"]"
1821            res@gsnRightString     = " "
1822            res@trYMinF            = min_z
1823            res@trYMaxF            = max_z
1824            if (xs .EQ. -1) then
1825               res@trXMinF            = min(data(varn,:,min_z_int:max_z_int))-min_value
1826            else
1827               res@trXMinF            = xs     
1828            end if
1829            if (xe .EQ. -1) then
1830               res@trXMaxF            = max(data(varn,:,min_z_int:max_z_int))+max_value
1831            else
1832               res@trXMaxF            = xe 
1833            end if         
1834            plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
1835         end if
1836 
1837     
1838         if (vNam(varn) .EQ. "u" ) then
1839               miniu=min(data(varn,:,min_z_int:max_z_int))-min_value
1840               maxiu=max(data(varn,:,min_z_int:max_z_int))+max_value
1841               if (over .EQ. 1) then
1842                  res@xyDashPattern  = 0
1843                  plot_u = gsn_csm_xy(wks,data(varn,:,:),z,res)
1844               else
1845                  res@gsnLeftString      = vNam(varn)
1846                  res@tiXAxisString      = "["+unit(varn)+"]"
1847                  res@gsnRightString     = " "                 
1848                  if (xs .EQ. -1) then 
1849                     res@trXMinF            = miniu
1850                  else
1851                     res@trXMinF            = xs
1852                  end if
1853                  if (xe .EQ. -1) then       
1854                     res@trXMaxF            = maxiu
1855                  else
1856                     res@trXMaxF            = xe 
1857                  end if               
1858                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
1859               end if
1860            end if
1861            if (vNam(varn) .EQ. "v") then
1862               miniv=min(data(varn,:,min_z_int:max_z_int))-min_value
1863               maxiv=max(data(varn,:,min_z_int:max_z_int))+max_value
1864               if (over .EQ. 1) then
1865                  res@xyMonoDashPattern = True
1866                  res@xyDashPattern  = 1
1867                  plot_v = gsn_csm_xy(wks,data(varn,:,:),z,res)
1868               else
1869                  res@gsnLeftString      = vNam(varn)
1870                  res@tiXAxisString      = "["+unit(varn)+"]"
1871                  res@gsnRightString     = " "                 
1872                  if (xs .EQ. -1) then
1873                     res@trXMinF            = miniv
1874                  else
1875                     res@trXMinF            = xs
1876                  end if
1877                  if (xe .EQ. -1) then
1878                     res@trXMaxF            = maxiv
1879                  else
1880                     res@trXMaxF            = xe 
1881                  end if               
1882                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1883               end if 
1884            end if
1885            if (vNam(varn) .EQ. "w") then
1886               miniw=min(data(varn,:,min_z_int:max_z_int))-min_value
1887               maxiw=max(data(varn,:,min_z_int:max_z_int))+max_value
1888               if (over .EQ. 1) then
1889                  res@xyDashPattern = 2
1890                  plot_w = gsn_csm_xy(wks,data(varn,:,:),z,res)
1891               else
1892                  res@gsnLeftString      = vNam(varn)
1893                  res@tiXAxisString      = "["+unit(varn)+"]"
1894                  res@gsnRightString     = " "
1895                  if (xs .EQ. -1) then
1896                     res@trXMinF            = miniw
1897                  else
1898                     res@trXMinF            = xs
1899                  end if
1900                  if (xe .EQ. -1) then
1901                     res@trXMaxF            = maxiw
1902                  else
1903                     res@trXMaxF            = xe 
1904                  end if           
1905                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1906               end if   
1907            end if
1908
1909            if (vNam(varn) .EQ. "pt") then
1910               minipt=min(data(varn,:,min_z_int:max_z_int))-min_value
1911               maxipt=max(data(varn,:,min_z_int:max_z_int))+max_value
1912               if (over .EQ. 1) then
1913                  res@xyDashPattern  = 0
1914                  plot_pt = gsn_csm_xy(wks,data(varn,:,:),z,res)
1915               else
1916                  res@gsnLeftString      = vNam(varn)
1917                  res@tiXAxisString      = "["+unit(varn)+"]"
1918                  res@gsnRightString     = " "
1919                  if (xs .EQ. -1) then
1920                     res@trXMinF            = minipt
1921                  else
1922                     res@trXMinF            = xs
1923                  end if
1924                  if (xe .EQ. -1) then       
1925                     res@trXMaxF            = maxipt
1926                  else
1927                     res@trXMaxF            = xe 
1928                  end if
1929                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1930               end if 
1931            end if
1932            if (vNam(varn) .EQ. "vpt") then
1933               minivpt=min(data(varn,:,min_z_int:max_z_int))-min_value
1934               maxivpt=max(data(varn,:,min_z_int:max_z_int))+max_value
1935               if (over .EQ. 1) then
1936                  res@xyDashPattern  = 1
1937                  plot_vpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
1938               else
1939                  res@gsnLeftString      = vNam(varn)
1940                  res@tiXAxisString      = "["+unit(varn)+"]"
1941                  res@gsnRightString     = " "
1942                  if (xs .EQ. -1) then
1943                     res@trXMinF            = minivpt
1944                  else
1945                     res@trXMinF            = xs
1946                  end if
1947                  if (xe .EQ. -1) then       
1948                     res@trXMaxF            = maxivpt
1949                  else
1950                     res@trXMaxF            = xe 
1951                  end if
1952                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1953               end if
1954            end if
1955            if (vNam(varn) .EQ. "lpt") then
1956               minilpt=min(data(varn,:,min_z_int:max_z_int))-min_value
1957               maxilpt=max(data(varn,:,min_z_int:max_z_int))+max_value
1958               if (over .EQ. 1) then
1959                  res@xyDashPattern  = 2
1960                  plot_lpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
1961               else
1962                  res@gsnLeftString      = vNam(varn)
1963                  res@tiXAxisString      = "["+unit(varn)+"]"
1964                  res@gsnRightString     = " "
1965                  if (xs .EQ. -1) then
1966                     res@trXMinF            = minilpt
1967                  else
1968                     res@trXMinF            = xs
1969                  end if
1970                  if (xe .EQ. -1) then       
1971                     res@trXMaxF            = maxilpt
1972                  else
1973                     res@trXMaxF            = xe 
1974                  end if
1975                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1976               end if
1977            end if
1978
1979            if (vNam(varn) .EQ. "q") then
1980               miniq=min(data(varn,:,min_z_int:max_z_int))-min_value
1981               maxiq=max(data(varn,:,min_z_int:max_z_int))+max_value
1982               if (over .EQ. 1) then
1983                  res@xyDashPattern  = 0
1984                  plot_q = gsn_csm_xy(wks,data(varn,:,:),z,res)
1985               else
1986                  res@gsnLeftString      = vNam(varn)
1987                  res@tiXAxisString      = "["+unit(varn)+"]"
1988                  res@gsnRightString     = " "
1989                  if (xs .EQ. -1) then
1990                     res@trXMinF            = miniq
1991                  else
1992                     res@trXMinF            = xs
1993                  end if
1994                  if (xe .EQ. -1) then       
1995                     res@trXMaxF            = maxiq
1996                  else
1997                     res@trXMaxF            = xe 
1998                  end if
1999                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2000               end if
2001            end if
2002            if (vNam(varn) .EQ. "qv") then
2003               miniqv=min(data(varn,:,min_z_int:max_z_int))-min_value
2004               maxiqv=max(data(varn,:,min_z_int:max_z_int))+max_value
2005               if (over .EQ. 1) then
2006                  res@xyDashPattern  = 1
2007                  plot_qv = gsn_csm_xy(wks,data(varn,:,:),z,res)
2008               else
2009                  res@gsnLeftString      = vNam(varn)
2010                  res@tiXAxisString      = "["+unit(varn)+"]"
2011                  res@gsnRightString     = " "
2012                  if (xs .EQ. -1) then
2013                     res@trXMinF            = miniqv
2014                  else
2015                     res@trXMinF            = xs
2016                  end if
2017                  if (xe .EQ. -1) then         
2018                     res@trXMaxF            = maxiqv
2019                  else
2020                     res@trXMaxF            = xe 
2021                  end if
2022                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2023               end if
2024            end if
2025            if (vNam(varn) .EQ. "ql") then
2026               miniql=min(data(varn,:,min_z_int:max_z_int))-min_value
2027               maxiql=max(data(varn,:,min_z_int:max_z_int))+max_value
2028               if (over .EQ. 1) then
2029                  res@xyDashPattern  = 2
2030                  plot_ql = gsn_csm_xy(wks,data(varn,:,:),z,res)
2031               else
2032                  res@gsnLeftString      = vNam(varn)
2033                  res@tiXAxisString      = "["+unit(varn)+"]"
2034                  res@gsnRightString     = " "
2035                  if (xs .EQ. -1) then
2036                     res@trXMinF            = miniql
2037                  else
2038                     res@trXMinF            = xs
2039                  end if
2040                  if (xe .EQ. -1) then       
2041                     res@trXMaxF            = maxiql
2042                  else
2043                     res@trXMaxF            = xe 
2044                  end if
2045                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2046               end if
2047            end if
2048
2049            if (vNam(varn) .EQ. "e") then
2050               minie=min(data(varn,:,min_z_int:max_z_int))-min_value
2051               maxie=max(data(varn,:,min_z_int:max_z_int))+max_value
2052               if (over .EQ. 1) then
2053                  res@xyDashPattern  = 0
2054                  plot_e = gsn_csm_xy(wks,data(varn,:,:),z,res)
2055               else
2056                  res@gsnLeftString      = vNam(varn)
2057                  res@tiXAxisString      = "["+unit(varn)+"]"
2058                  res@gsnRightString     = " "
2059                  if (xs .EQ. -1) then
2060                     res@trXMinF            = minie
2061                  else
2062                     res@trXMinF            = xs
2063                  end if
2064                  if (xe .EQ. -1) then       
2065                     res@trXMaxF            = maxie
2066                  else
2067                     res@trXMaxF            = xe 
2068                  end if
2069                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2070               end if
2071            end if
2072            if (vNam(varn) .EQ. "es" .OR. vNam(varn) .EQ. "e*") then
2073               minies=min(data(varn,:,min_z_int:max_z_int))-min_value
2074               maxies=max(data(varn,:,min_z_int:max_z_int))+max_value
2075               if (over .EQ. 1) then
2076                  res@xyDashPattern  = 1
2077                  plot_es = gsn_csm_xy(wks,data(varn,:,:),z,res)
2078               else
2079                  res@gsnLeftString      = vNam(varn)
2080                  res@tiXAxisString      = "["+unit(varn)+"]"
2081                  res@gsnRightString     = " "
2082                  if (xs .EQ. -1) then
2083                     res@trXMinF            = minies
2084                  else
2085                     res@trXMinF            = xs
2086                  end if
2087                  if (xe .EQ. -1) then       
2088                     res@trXMaxF            = maxies
2089                  else
2090                     res@trXMaxF            = xe 
2091                  end if
2092                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2093               end if
2094            end if
2095
2096            if (vNam(varn) .EQ. "km") then
2097               minikm=min(data(varn,:,min_z_int:max_z_int))-min_value
2098               maxikm=max(data(varn,:,min_z_int:max_z_int))+max_value
2099               if (over .EQ. 1) then
2100                  res@xyDashPattern  = 0
2101                  plot_km = gsn_csm_xy(wks,data(varn,:,:),z,res)
2102               else
2103                  res@gsnLeftString      = vNam(varn)
2104                  res@tiXAxisString      = "["+unit(varn)+"]"
2105                  res@gsnRightString     = " "
2106                  if (xs .EQ. -1) then
2107                     res@trXMinF            = minikm
2108                  else
2109                     res@trXMinF            = xs
2110                  end if
2111                  if (xe .EQ. -1) then     
2112                     res@trXMaxF            = maxikm
2113                  else
2114                     res@trXMaxF            = xe 
2115                  end if
2116                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2117               end if
2118            end if
2119            if (vNam(varn) .EQ. "kh") then
2120               minikh=min(data(varn,:,min_z_int:max_z_int))-min_value
2121               maxikh=max(data(varn,:,min_z_int:max_z_int))+max_value
2122               if (over .EQ. 1) then
2123                  res@xyDashPattern  = 1
2124                  plot_kh = gsn_csm_xy(wks,data(varn,:,:),z,res)
2125               else
2126                  res@gsnLeftString      = vNam(varn)
2127                  res@tiXAxisString      = "["+unit(varn)+"]"
2128                  res@gsnRightString     = " "
2129                  if (xs .EQ. -1) then
2130                     res@trXMinF            = minikh
2131                  else
2132                     res@trXMinF            = xs
2133                  end if
2134                  if (xe .EQ. -1) then     
2135                     res@trXMaxF            = maxikh
2136                  else
2137                     res@trXMaxF            = xe 
2138                  end if
2139                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2140               end if
2141            end if
2142
2143            if (vNam(varn) .EQ. "wpup" .OR. vNam(varn) .EQ. "w"+dq+"u"+dq) then
2144               miniwpup=min(data(varn,:,min_z_int:max_z_int))-min_value
2145               maxiwpup=max(data(varn,:,min_z_int:max_z_int))+max_value
2146               if (over .EQ. 1) then
2147                  res@xyDashPattern  = 0
2148                  plot_wpup = gsn_csm_xy(wks,data(varn,:,:),z,res)
2149               else
2150                  res@gsnLeftString      = vNam(varn)
2151                  res@tiXAxisString      = "["+unit(varn)+"]"
2152                  res@gsnRightString     = " "
2153                  if (xs .EQ. -1) then
2154                     res@trXMinF            = miniwpup
2155                  else
2156                     res@trXMinF            = xs
2157                  end if
2158                  if (xe .EQ. -1) then
2159                     res@trXMaxF            = maxiwpup
2160                  else
2161                     res@trXMaxF            = xe 
2162                  end if
2163                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2164               end if
2165            end if
2166            if (vNam(varn) .EQ. "wsus" .OR. vNam(varn) .EQ. "w*u*") then
2167               miniwsus=min(data(varn,:,min_z_int:max_z_int))-min_value
2168               maxiwsus=max(data(varn,:,min_z_int:max_z_int))+max_value
2169               if (over .EQ. 1) then
2170                  res@xyDashPattern  = 1
2171                  plot_wsus = gsn_csm_xy(wks,data(varn,:,:),z,res)
2172               else
2173                  res@gsnLeftString      = vNam(varn)
2174                  res@tiXAxisString      = "["+unit(varn)+"]"
2175                  res@gsnRightString     = " "
2176                  if (xs .EQ. -1) then
2177                     res@trXMinF            = miniwsus
2178                  else
2179                     res@trXMinF            = xs
2180                  end if
2181                  if (xe .EQ. -1) then     
2182                     res@trXMaxF            = maxiwsus
2183                  else
2184                     res@trXMaxF            = xe 
2185                  end if
2186                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2187               end if
2188            end if
2189            if (vNam(varn) .EQ. "wu") then
2190               miniwu=min(data(varn,:,min_z_int:max_z_int))-min_value
2191               maxiwu=max(data(varn,:,min_z_int:max_z_int))+max_value
2192               if (over .EQ. 1) then
2193                  res@xyDashPattern  = 2
2194                  plot_wu = gsn_csm_xy(wks,data(varn,:,:),z,res)
2195               else
2196                  res@gsnLeftString      = vNam(varn)
2197                  res@tiXAxisString      = "["+unit(varn)+"]"
2198                  res@gsnRightString     = " "
2199                  if (xs .EQ. -1) then
2200                     res@trXMinF            = miniwu
2201                  else
2202                     res@trXMinF            = xs
2203                  end if
2204                  if (xe .EQ. -1) then
2205                     res@trXMaxF            = maxiwu
2206                  else
2207                     res@trXMaxF            = xe 
2208                  end if
2209                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2210               end if
2211            end if
2212
2213            if (vNam(varn) .EQ. "wpvp" .OR. vNam(varn) .EQ. "w"+dq+"v"+dq) then
2214               miniwpvp=min(data(varn,:,min_z_int:max_z_int))-min_value
2215               maxiwpvp=max(data(varn,:,min_z_int:max_z_int))+max_value
2216               if (over .EQ. 1) then
2217                  res@xyDashPattern  = 0
2218                  plot_wpvp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2219               else
2220                  res@gsnLeftString      = vNam(varn)
2221                  res@tiXAxisString      = "["+unit(varn)+"]"
2222                  res@gsnRightString     = " "
2223                  if (xs .EQ. -1) then
2224                     res@trXMinF            = miniwpvp
2225                  else
2226                     res@trXMinF            = xs
2227                  end if
2228                  if (xe .EQ. -1) then     
2229                     res@trXMaxF            = maxiwpvp
2230                  else
2231                     res@trXMaxF            = xe 
2232                  end if
2233                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2234               end if
2235            end if
2236            if (vNam(varn) .EQ. "wsvs" .OR. vNam(varn) .EQ. "w*v*") then
2237               miniwsvs=min(data(varn,:,min_z_int:max_z_int))-min_value
2238               maxiwsvs=max(data(varn,:,min_z_int:max_z_int))+max_value
2239               if (over .EQ. 1) then
2240                  res@xyDashPattern  = 1
2241                  plot_wsvs = gsn_csm_xy(wks,data(varn,:,:),z,res)
2242               else
2243                  res@gsnLeftString      = vNam(varn)
2244                  res@tiXAxisString      = "["+unit(varn)+"]"
2245                  res@gsnRightString     = " "
2246                  if (xs .EQ. -1) then
2247                     res@trXMinF            = miniwsvs
2248                  else
2249                     res@trXMinF            = xs
2250                  end if
2251                  if (xe .EQ. -1) then     
2252                     res@trXMaxF            = maxiwsvs
2253                  else
2254                     res@trXMaxF            = xe 
2255                  end if
2256                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2257               end if
2258            end if
2259            if (vNam(varn) .EQ. "wv") then
2260               miniwv=min(data(varn,:,min_z_int:max_z_int))-min_value
2261               maxiwv=max(data(varn,:,min_z_int:max_z_int))+max_value
2262               if (over .EQ. 1) then
2263                  res@xyDashPattern  = 2
2264                  plot_wv = gsn_csm_xy(wks,data(varn,:,:),z,res)
2265               else
2266                  res@gsnLeftString      = vNam(varn)
2267                  res@tiXAxisString      = "["+unit(varn)+"]"
2268                  res@gsnRightString     = " "
2269                  if (xs .EQ. -1) then
2270                     res@trXMinF            = miniwv
2271                  else
2272                     res@trXMinF            = xs
2273                  end if
2274                  if (xe .EQ. -1) then       
2275                     res@trXMaxF            = maxiwv
2276                  else
2277                     res@trXMaxF            = xe 
2278                  end if
2279                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2280               end if
2281            end if
2282
2283            if (vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "w"+dq+"pt"+dq) then
2284               miniwpptp=min(data(varn,:,min_z_int:max_z_int))-min_value
2285               maxiwpptp=max(data(varn,:,min_z_int:max_z_int))+max_value
2286               if (over .EQ. 1) then
2287                  res@xyDashPattern  = 0
2288                  plot_wpptp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2289               else
2290                  res@gsnLeftString      = vNam(varn)
2291                  res@tiXAxisString      = "["+unit(varn)+"]"
2292                  res@gsnRightString     = " "
2293                  if (xs .EQ. -1) then
2294                     res@trXMinF            = miniwpptp
2295                  else
2296                     res@trXMinF            = xs
2297                  end if
2298                  if (xe .EQ. -1) then       
2299                     res@trXMaxF            = maxiwpptp
2300                  else
2301                     res@trXMaxF            = xe 
2302                  end if
2303                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2304               end if
2305            end if
2306            if (vNam(varn) .EQ. "wspts" .OR. vNam(varn) .EQ. "w*pt*") then
2307               miniwspts=min(data(varn,:,min_z_int:max_z_int))-min_value
2308               maxiwspts=max(data(varn,:,min_z_int:max_z_int))+max_value
2309               if (over .EQ. 1) then
2310                  res@xyDashPattern  = 1
2311                  plot_wspts = gsn_csm_xy(wks,data(varn,:,:),z,res)
2312               else
2313                  res@gsnLeftString      = vNam(varn)
2314                  res@tiXAxisString      = "["+unit(varn)+"]"
2315                  res@gsnRightString     = " "
2316                  if (xs .EQ. -1) then
2317                     res@trXMinF            = miniwspts
2318                  else
2319                     res@trXMinF            = xs
2320                  end if
2321                  if (xe .EQ. -1) then       
2322                     res@trXMaxF            = maxiwspts
2323                  else
2324                     res@trXMaxF            = xe 
2325                  end if
2326                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2327               end if
2328            end if
2329            if (vNam(varn) .EQ. "wpt") then       
2330               miniwpt=min(data(varn,:,min_z_int:max_z_int))-min_value
2331               maxiwpt=max(data(varn,:,min_z_int:max_z_int))+max_value
2332               if (over .EQ. 1) then
2333                  res@xyDashPattern  = 2
2334                  plot_wpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
2335               else
2336                  res@gsnLeftString      = vNam(varn)
2337                  res@tiXAxisString      = "["+unit(varn)+"]"
2338                  res@gsnRightString     = " "
2339                  if (xs .EQ. -1) then
2340                     res@trXMinF            = miniwpt
2341                  else
2342                     res@trXMinF            = xs
2343                  end if
2344                  if (xe .EQ. -1) then       
2345                     res@trXMaxF            = maxiwpt
2346                  else
2347                     res@trXMaxF            = xe 
2348                  end if
2349                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2350               end if
2351            end if
2352
2353            if (vNam(varn) .EQ. "wsptsBC".OR. vNam(varn) .EQ. "w*pt*BC" ) then
2354               miniwsptsBC=min(data(varn,:,min_z_int:max_z_int))-min_value
2355               maxiwsptsBC=max(data(varn,:,min_z_int:max_z_int))+max_value
2356               if (over .EQ. 1) then
2357                  res@xyDashPattern  = 0
2358                  plot_wsptsBC = gsn_csm_xy(wks,data(varn,:,:),z,res)
2359               else
2360                  res@gsnLeftString      = vNam(varn)
2361                  res@tiXAxisString      = "["+unit(varn)+"]"
2362                  res@gsnRightString     = " "
2363                  if (xs .EQ. -1) then
2364                     res@trXMinF            = miniwsptsBC
2365                  else
2366                     res@trXMinF            = xs
2367                  end if
2368                  if (xe .EQ. -1) then       
2369                     res@trXMaxF            = maxiwsptsBC
2370                  else
2371                     res@trXMaxF            = xe 
2372                  end if
2373                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2374               end if
2375            end if             
2376            if (vNam(varn) .EQ. "wptBC") then
2377               miniwptBC=min(data(varn,:,min_z_int:max_z_int))-min_value
2378               maxiwptBC=max(data(varn,:,min_z_int:max_z_int))+max_value
2379               if (over .EQ. 1) then
2380                  res@xyDashPattern  = 1
2381                  plot_wptBC = gsn_csm_xy(wks,data(varn,:,:),z,res)
2382               else
2383                  res@gsnLeftString      = vNam(varn)
2384                  res@tiXAxisString      = "["+unit(varn)+"]"
2385                  res@gsnRightString     = " "
2386                  if (xs .EQ. -1) then
2387                     res@trXMinF            = miniwptBC
2388                  else
2389                     res@trXMinF            = xs
2390                  end if
2391                  if (xe .EQ. -1) then       
2392                     res@trXMaxF            = maxiwptBC
2393                  else
2394                     res@trXMaxF            = xe 
2395                  end if
2396                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2397               end if
2398            end if
2399
2400            if (vNam(varn) .EQ. "wpvptp" .OR. vNam(varn) .EQ. "w"+dq+"vpt"+dq) then
2401               miniwpvptp=min(data(varn,:,min_z_int:max_z_int))-min_value
2402               maxiwpvptp=max(data(varn,:,min_z_int:max_z_int))+max_value
2403               if (over .EQ. 1) then
2404                  res@xyDashPattern  = 0
2405                  plot_wpvptp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2406               else
2407                  res@gsnLeftString      = vNam(varn)
2408                  res@tiXAxisString      = "["+unit(varn)+"]"
2409                  res@gsnRightString     = " "
2410                  if (xs .EQ. -1) then
2411                     res@trXMinF            = miniwpvptp
2412                  else
2413                     res@trXMinF            = xs
2414                  end if
2415                  if (xe .EQ. -1) then       
2416                     res@trXMaxF            = maxiwpvptp
2417                  else
2418                     res@trXMaxF            = xe 
2419                  end if
2420                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2421               end if
2422            end if
2423            if (vNam(varn) .EQ. "wsvpts" .OR. vNam(varn) .EQ. "w*vpt*") then
2424               miniwsvpts=min(data(varn,:,min_z_int:max_z_int))-min_value
2425               maxiwsvpts=max(data(varn,:,min_z_int:max_z_int))+max_value
2426               if (over .EQ. 1) then
2427                  res@xyDashPattern  = 1
2428                  plot_wsvpts = gsn_csm_xy(wks,data(varn,:,:),z,res)
2429               else
2430                  res@gsnLeftString      = vNam(varn)
2431                  res@tiXAxisString      = "["+unit(varn)+"]"
2432                  res@gsnRightString     = " "
2433                  if (xs .EQ. -1) then
2434                     res@trXMinF            = miniwsvpts
2435                  else
2436                     res@trXMinF            = xs
2437                  end if
2438                  if (xe .EQ. -1) then       
2439                     res@trXMaxF            = maxiwsvpts
2440                  else
2441                     res@trXMaxF            = xe 
2442                  end if
2443                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2444               end if
2445            end if
2446            if (vNam(varn) .EQ. "wvpt") then
2447               miniwvpt=min(data(varn,:,min_z_int:max_z_int))-min_value
2448               maxiwvpt=max(data(varn,:,min_z_int:max_z_int))+max_value
2449               if (over .EQ. 1) then
2450                  res@xyDashPattern  = 2
2451                  plot_wvpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
2452               else
2453                  res@gsnLeftString      = vNam(varn)
2454                  res@tiXAxisString      = "["+unit(varn)+"]"
2455                  res@gsnRightString     = " "
2456                  if (xs .EQ. -1) then
2457                     res@trXMinF            = miniwvpt
2458                  else
2459                     res@trXMinF            = xs
2460                  end if
2461                  if (xe .EQ. -1) then       
2462                     res@trXMaxF            = maxiwvpt
2463                  else
2464                     res@trXMaxF            = xe 
2465                  end if
2466                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2467               end if
2468            end if
2469
2470            if (vNam(varn) .EQ. "wpqp" .OR. vNam(varn) .EQ. "w"+dq+"q"+dq) then
2471               miniwpqp=min(data(varn,:,min_z_int:max_z_int))-min_value
2472               maxiwpqp=max(data(varn,:,min_z_int:max_z_int))+max_value
2473               if (over .EQ. 1) then
2474                  res@xyDashPattern  = 0
2475                  plot_wpqp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2476               else
2477                  res@gsnLeftString      = vNam(varn)
2478                  res@tiXAxisString      = "["+unit(varn)+"]"
2479                  res@gsnRightString     = " "
2480                  if (xs .EQ. -1) then
2481                     res@trXMinF            = miniwpqp
2482                  else
2483                     res@trXMinF            = xs
2484                  end if
2485                  if (xe .EQ. -1) then       
2486                     res@trXMaxF            = maxiwpqp
2487                  else
2488                     res@trXMaxF            = xe 
2489                  end if
2490                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2491               end if
2492            end if
2493            if (vNam(varn) .EQ. "wsqs".OR. vNam(varn) .EQ. "w*s*" ) then
2494               miniwsqs=min(data(varn,:,min_z_int:max_z_int))-min_value
2495               maxiwsqs=max(data(varn,:,min_z_int:max_z_int))+max_value
2496               if (over .EQ. 1) then
2497                  res@xyDashPattern  = 1
2498                  plot_wsqs = gsn_csm_xy(wks,data(varn,:,:),z,res)
2499               else
2500                  res@gsnLeftString      = vNam(varn)
2501                  res@tiXAxisString      = "["+unit(varn)+"]"
2502                  res@gsnRightString     = " "
2503                  if (xs .EQ. -1) then
2504                     res@trXMinF            = miniwsqs
2505                  else
2506                     res@trXMinF            = xs
2507                  end if
2508                  if (xe .EQ. -1) then       
2509                     res@trXMaxF            = maxiwsqs
2510                  else
2511                     res@trXMaxF            = xe 
2512                  end if
2513                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2514               end if
2515            end if
2516            if (vNam(varn) .EQ. "wq") then
2517               miniwq=min(data(varn,:,min_z_int:max_z_int))-min_value
2518               maxiwq=max(data(varn,:,min_z_int:max_z_int))+max_value
2519               if (over .EQ. 1) then
2520                  res@xyDashPattern  = 2
2521                  plot_wq = gsn_csm_xy(wks,data(varn,:,:),z,res)
2522               else
2523                  res@gsnLeftString      = vNam(varn)
2524                  res@tiXAxisString      = "["+unit(varn)+"]"
2525                  res@gsnRightString     = " "
2526                  if (xs .EQ. -1) then
2527                     res@trXMinF            = miniwq
2528                  else
2529                     res@trXMinF            = xs
2530                  end if
2531                  if (xe .EQ. -1) then       
2532                     res@trXMaxF            = maxiwq
2533                  else
2534                     res@trXMaxF            = xe 
2535                  end if
2536                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2537               end if
2538            end if
2539
2540            if (vNam(varn) .EQ. "wpqvp" .OR. vNam(varn) .EQ. "w"+dq+"qv"+dq) then
2541               miniwpqvp=min(data(varn,:,min_z_int:max_z_int))-min_value
2542               maxiwpqvp=max(data(varn,:,min_z_int:max_z_int))+max_value
2543               if (over .EQ. 1) then
2544                  res@xyDashPattern  = 0
2545                  plot_wpqvp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2546               else
2547                  res@gsnLeftString      = vNam(varn)
2548                  res@tiXAxisString      = "["+unit(varn)+"]"
2549                  res@gsnRightString     = " "
2550                  if (xs .EQ. -1) then
2551                     res@trXMinF            = miniwpqvp
2552                  else
2553                     res@trXMinF            = xs
2554                  end if
2555                  if (xe .EQ. -1) then       
2556                     res@trXMaxF            = maxiwpqvp
2557                  else
2558                     res@trXMaxF            = xe 
2559                  end if
2560                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2561               end if
2562            end if
2563            if (vNam(varn) .EQ. "wsqvs" .OR. vNam(varn) .EQ. "w*qv*") then
2564               miniwsqvs=min(data(varn,:,min_z_int:max_z_int))-min_value
2565               maxiwsqvs=max(data(varn,:,min_z_int:max_z_int))+max_value
2566               if (over .EQ. 1) then
2567                  res@xyDashPattern  = 1
2568                  plot_wsqvs = gsn_csm_xy(wks,data(varn,:,:),z,res)
2569               else
2570                  res@gsnLeftString      = vNam(varn)
2571                  res@tiXAxisString      = "["+unit(varn)+"]"
2572                  res@gsnRightString     = " "
2573                  if (xs .EQ. -1) then
2574                     res@trXMinF            = miniwsqvs
2575                  else
2576                     res@trXMinF            = xs
2577                  end if
2578                  if (xe .EQ. -1) then       
2579                     res@trXMaxF            = maxiwsqvs
2580                  else
2581                     res@trXMaxF            = xe 
2582                  end if
2583                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2584               end if
2585            end if
2586            if (vNam(varn) .EQ. "wqv") then
2587               miniwqv=min(data(varn,:,min_z_int:max_z_int))-min_value
2588               maxiwqv=max(data(varn,:,min_z_int:max_z_int))+max_value
2589               if (over .EQ. 1) then
2590                  res@xyDashPattern  = 2
2591                  plot_wqv = gsn_csm_xy(wks,data(varn,:,:),z,res)
2592               else
2593                  res@gsnLeftString      = vNam(varn)
2594                  res@tiXAxisString      = "["+unit(varn)+"]"
2595                  res@gsnRightString     = " "
2596                  if (xs .EQ. -1) then
2597                     res@trXMinF            = miniwqv
2598                  else
2599                     res@trXMinF            = xs
2600                  end if
2601                  if (xe .EQ. -1) then       
2602                     res@trXMaxF            = maxiwqv
2603                  else
2604                     res@trXMaxF            = xe 
2605                  end if
2606                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2607               end if
2608            end if
2609
2610            if (vNam(varn) .EQ. "wpsp" .OR. vNam(varn) .EQ. "w"+dq+"s"+dq) then
2611               miniwpsp=min(data(varn,:,min_z_int:max_z_int))-min_value
2612               maxiwpsp=max(data(varn,:,min_z_int:max_z_int))+max_value
2613               if (over .EQ. 1) then
2614                  res@xyDashPattern  = 0
2615                  plot_wpsp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2616               else
2617                  res@gsnLeftString      = vNam(varn)
2618                  res@tiXAxisString      = "["+unit(varn)+"]"
2619                  res@gsnRightString     = " "
2620                  if (xs .EQ. -1) then
2621                     res@trXMinF            = miniwpsp
2622                  else
2623                     res@trXMinF            = xs
2624                  end if
2625                  if (xe .EQ. -1) then       
2626                     res@trXMaxF            = maxiwpsp
2627                  else
2628                     res@trXMaxF            = xe 
2629                  end if
2630                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2631               end if
2632            end if
2633            if (vNam(varn) .EQ. "wsss" .OR. vNam(varn) .EQ. "w*s*" ) then
2634               miniwsss=min(data(varn,:,min_z_int:max_z_int))-min_value
2635               maxiwsss=max(data(varn,:,min_z_int:max_z_int))+max_value
2636               if (over .EQ. 1) then
2637                  res@xyDashPattern  = 1
2638                  plot_wsss = gsn_csm_xy(wks,data(varn,:,:),z,res)
2639               else
2640                  res@gsnLeftString      = vNam(varn)
2641                  res@tiXAxisString      = "["+unit(varn)+"]"
2642                  res@gsnRightString     = " "
2643                  if (xs .EQ. -1) then
2644                     res@trXMinF            = miniwsss
2645                  else
2646                     res@trXMinF            = xs
2647                  end if
2648                  if (xe .EQ. -1) then       
2649                     res@trXMaxF            = maxiwsss
2650                  else
2651                     res@trXMaxF            = xe 
2652                  end if
2653                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2654               end if
2655            end if
2656            if (vNam(varn) .EQ. "ws") then
2657               miniws=min(data(varn,:,min_z_int:max_z_int))-min_value
2658               maxiws=max(data(varn,:,min_z_int:max_z_int))+max_value
2659               if (over .EQ. 1) then
2660                  res@xyDashPattern  = 2
2661                  plot_ws = gsn_csm_xy(wks,data(varn,:,:),z,res)
2662               else
2663                  res@gsnLeftString      = vNam(varn)
2664                  res@tiXAxisString      = "["+unit(varn)+"]"
2665                  res@gsnRightString     = " "
2666                  if (xs .EQ. -1) then
2667                     res@trXMinF            = miniws
2668                  else
2669                     res@trXMinF            = xs
2670                  end if
2671                  if (xe .EQ. -1) then       
2672                     res@trXMaxF            = maxiws
2673                  else
2674                     res@trXMaxF            = xe 
2675                  end if
2676                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2677               end if
2678            end if
2679
2680            if (vNam(varn) .EQ. "wpsap" .OR. vNam(varn) .EQ. "w"+dq+"sa"+dq) then
2681               miniwpsap=min(data(varn,:,min_z_int:max_z_int))-min_value
2682               maxiwpsap=max(data(varn,:,min_z_int:max_z_int))+max_value
2683               if (over .EQ. 1) then
2684                  res@xyDashPattern  = 0
2685                  plot_wpsap = gsn_csm_xy(wks,data(varn,:,:),z,res)
2686               else
2687                  res@gsnLeftString      = vNam(varn)
2688                  res@tiXAxisString      = "["+unit(varn)+"]"
2689                  res@gsnRightString     = " "
2690                  if (xs .EQ. -1) then
2691                     res@trXMinF            = miniwpsap
2692                  else
2693                     res@trXMinF            = xs
2694                  end if
2695                  if (xe .EQ. -1) then       
2696                     res@trXMaxF            = maxiwpsap
2697                  else
2698                     res@trXMaxF            = xe 
2699                  end if
2700                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2701               end if
2702            end if
2703            if (vNam(varn) .EQ. "wssas" .OR. vNam(varn) .EQ. "w*sa*") then
2704               miniwssas=min(data(varn,:,min_z_int:max_z_int))-min_value
2705               maxiwssas=max(data(varn,:,min_z_int:max_z_int))+max_value
2706               if (over .EQ. 1) then
2707                  res@xyDashPattern  = 1
2708                  plot_wssas = gsn_csm_xy(wks,data(varn,:,:),z,res)
2709               else
2710                  res@gsnLeftString      = vNam(varn)
2711                  res@tiXAxisString      = "["+unit(varn)+"]"
2712                  res@gsnRightString     = " "
2713                  if (xs .EQ. -1) then
2714                     res@trXMinF            = miniwssas
2715                  else
2716                     res@trXMinF            = xs
2717                  end if
2718                  if (xe .EQ. -1) then       
2719                     res@trXMaxF            = maxiwssas
2720                  else
2721                     res@trXMaxF            = xe 
2722                  end if
2723                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2724               end if
2725            end if
2726            if (vNam(varn) .EQ. "wsa") then
2727               miniwsa=min(data(varn,:,min_z_int:max_z_int))-min_value
2728               maxiwsa=max(data(varn,:,min_z_int:max_z_int))+max_value
2729               if (over .EQ. 1) then
2730                  res@xyDashPattern  = 2
2731                  plot_wsa = gsn_csm_xy(wks,data(varn,:,:),z,res)
2732               else
2733                  res@gsnLeftString      = vNam(varn)
2734                  res@tiXAxisString      = "["+unit(varn)+"]"
2735                  res@gsnRightString     = " "
2736                  if (xs .EQ. -1) then
2737                     res@trXMinF            = miniwsa
2738                  else
2739                     res@trXMinF            = xs
2740                  end if
2741                  if (xe .EQ. -1) then       
2742                     res@trXMaxF            = maxiwsa
2743                  else
2744                     res@trXMaxF            = xe 
2745                  end if
2746                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2747               end if
2748            end if
2749
2750            if (vNam(varn) .EQ. "us2" .OR. vNam(varn) .EQ. "u*2") then
2751               minius2=min(data(varn,:,min_z_int:max_z_int))-min_value
2752               maxius2=max(data(varn,:,min_z_int:max_z_int))+max_value
2753               if (over .EQ. 1) then
2754                  res@xyDashPattern  = 0
2755                  plot_us2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
2756               else
2757                  res@gsnLeftString      = vNam(varn)
2758                  res@tiXAxisString      = "["+unit(varn)+"]"
2759                  res@gsnRightString     = " "
2760                  if (xs .EQ. -1) then
2761                     res@trXMinF            = minius2
2762                  else
2763                     res@trXMinF            = xs
2764                  end if
2765                  if (xe .EQ. -1) then       
2766                     res@trXMaxF            = maxius2
2767                  else
2768                     res@trXMaxF            = xe 
2769                  end if
2770                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2771               end if
2772            end if
2773            if (vNam(varn) .EQ. "vs2" .OR. vNam(varn) .EQ. "v*2") then
2774               minivs2=min(data(varn,:,min_z_int:max_z_int))-min_value
2775               maxivs2=max(data(varn,:,min_z_int:max_z_int))+max_value
2776               if (over .EQ. 1) then
2777                  res@xyDashPattern  = 1
2778                  plot_vs2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
2779               else
2780                  res@gsnLeftString      = vNam(varn)
2781                  res@tiXAxisString      = "["+unit(varn)+"]"
2782                  res@gsnRightString     = " "
2783                  if (xs .EQ. -1) then
2784                     res@trXMinF            = minivs2
2785                  else
2786                     res@trXMinF            = xs
2787                  end if
2788                  if (xe .EQ. -1) then       
2789                     res@trXMaxF            = maxivs2
2790                  else
2791                     res@trXMaxF            = xe 
2792                  end if
2793                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2794               end if
2795            end if
2796            if (vNam(varn) .EQ. "ws2" .OR. vNam(varn) .EQ. "w*2") then
2797               miniws2=min(data(varn,:,min_z_int:max_z_int))-min_value
2798               maxiws2=max(data(varn,:,min_z_int:max_z_int))+max_value
2799               if (over .EQ. 1) then
2800                  res@xyDashPattern  = 2
2801                  plot_ws2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
2802               else
2803                  res@gsnLeftString      = vNam(varn)
2804                  res@tiXAxisString      = "["+unit(varn)+"]"
2805                  res@gsnRightString     = " "
2806                  if (xs .EQ. -1) then
2807                     res@trXMinF            = miniws2
2808                  else
2809                     res@trXMinF            = xs
2810                  end if
2811                  if (xe .EQ. -1) then       
2812                     res@trXMaxF            = maxiws2
2813                  else
2814                     res@trXMaxF            = xe 
2815                  end if
2816                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2817               end if
2818            end if
2819
2820            if (vNam(varn) .EQ. "wsususodz" .OR. vNam(varn) .EQ. "w*u*u*:dz") then
2821               miniwsususodz=min(data(varn,:,min_z_int:max_z_int))-min_value
2822               maxiwsususodz=max(data(varn,:,min_z_int:max_z_int))+max_value
2823               if (over .EQ. 1) then
2824                  res@xyDashPattern  = 0
2825                  plot_wsususodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
2826               else
2827                  res@gsnLeftString      = vNam(varn)
2828                  res@tiXAxisString      = "["+unit(varn)+"]"
2829                  res@gsnRightString     = " "
2830                  if (xs .EQ. -1) then
2831                     res@trXMinF            = miniwsususodz
2832                  else
2833                     res@trXMinF            = xs
2834                  end if
2835                  if (xe .EQ. -1) then       
2836                     res@trXMaxF            = maxiwsususodz
2837                  else
2838                     res@trXMaxF            = xe 
2839                  end if
2840                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2841               end if 
2842            end if
2843            if (vNam(varn) .EQ. "wspsodz" .OR. vNam(varn) .EQ. "w*p*:dz") then
2844               miniwspsodz=min(data(varn,:,min_z_int:max_z_int))-min_value
2845               maxiwspsodz=max(data(varn,:,min_z_int:max_z_int))+max_value
2846               if (over .EQ. 1) then
2847                  res@xyDashPattern  = 1
2848                  plot_wspsodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
2849               else
2850                  res@gsnLeftString      = vNam(varn)
2851                  res@tiXAxisString      = "["+unit(varn)+"]"
2852                  res@gsnRightString     = " "
2853                  if (xs .EQ. -1) then
2854                     res@trXMinF            = miniwspsodz
2855                  else
2856                     res@trXMinF            = xs
2857                  end if
2858                  if (xe .EQ. -1) then       
2859                     res@trXMaxF            = maxiwspsodz
2860                  else
2861                     res@trXMaxF            = xe 
2862                  end if
2863                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2864               end if
2865            end if
2866            if (vNam(varn) .EQ. "wpeodz" .OR. vNam(varn) .EQ. "w"+dq+"p:dz") then
2867               miniwpeodz=min(data(varn,:,min_z_int:max_z_int))-min_value
2868               maxiwpeodz=max(data(varn,:,min_z_int:max_z_int))+max_value
2869               if (over .EQ. 1) then
2870                  res@xyDashPattern  = 2
2871                  plot_wpeodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
2872               else
2873                  res@gsnLeftString      = vNam(varn)
2874                  res@tiXAxisString      = "["+unit(varn)+"]"
2875                  res@gsnRightString     = " "
2876                  if (xs .EQ. -1) then
2877                     res@trXMinF            = miniwpeodz
2878                  else
2879                     res@trXMinF            = xs
2880                  end if
2881                  if (xe .EQ. -1) then       
2882                     res@trXMaxF            = maxiwpeodz
2883                  else
2884                     res@trXMaxF            = xe 
2885                  end if
2886                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2887               end if
2888            end if
2889         if (no_files .GT. 1) then
2890            print("nof="+nof+" und n="+n)
2891            multi_plot(nof,n)=plot(n)
2892            max_nof(nof,n)=max(data(varn,:,min_z_int:max_z_int))
2893            min_nof(nof,n)=min(data(varn,:,min_z_int:max_z_int))
2894            name(nof,n)   =vNam(varn)
2895            unit_(nof,n)  =unit(varn)
2896         end if
2897         if (over .EQ. 0) then
2898            n=n+1 
2899         end if 
2900         if (prof3d .EQ. 0)then   
2901            varn=varn+1
2902         end if
2903         delete(temp)
2904         delete(temp_att)
2905      end if         
2906   end do
2907   if (no_files .GT. 1) then
2908      delete(vNam)
2909      delete(files)
2910   end if
2911   
2912   end do
2913   ;#########ENDE DO LOOP FOR no_files GT 1#############
2914
2915   if (isStrSubset(data@long_name," SR " ) .and. over_remind) then
2916      print(" ")
2917      print("If you have outputs of statistic regions you cannot overlay variables;")
2918      print("'over' is set to 0" )
2919      print(" ")
2920      over = 0
2921   end if
2922
2923   if (count_var .EQ. 0) then
2924      print(" ")
2925      print("The variables 'var="+var+"'" )
2926      print("do not exist on your input file;")
2927      print("be sure to have one comma before and after each variable")
2928      print(" ")
2929      exit       
2930   end if
2931   
2932   if (no_files .GT. 1) then
2933      multi_legend=new(6,string)
2934      string_len=new(6,integer)
2935      multi_dash=new(no_files,string)
2936      multi_legend(0)="  "+name_legend_1
2937      string_len(0)=strlen(multi_legend(0))
2938      multi_legend(1)="  "+name_legend_2
2939      string_len(1)=strlen(multi_legend(1))
2940      multi_legend(2)="  "+name_legend_3
2941      string_len(2)=strlen(multi_legend(2))
2942      multi_legend(3)="  "+name_legend_4
2943      string_len(3)=strlen(multi_legend(3))
2944      multi_legend(4)="  "+name_legend_5
2945      string_len(4)=strlen(multi_legend(4))
2946      multi_legend(5)="  "+name_legend_6
2947      string_len(5)=strlen(multi_legend(5))
2948      do ml=1,no_files
2949         multi_dash(ml-1)=ml-1
2950      end do
2951      delete(plot)
2952      plot = new(dim,graphic)
2953      do pl=0,n-1
2954         plot0 = new(1,graphic)
2955         res@trXMinF = min(min_nof(:,pl))
2956         res@trXMaxF = max(max_nof(:,pl))
2957         res@gsnLeftString  = name(0,pl)
2958         res@gsnRightString = unit_(0,pl)
2959         
2960         data_0(:,:) = min(min_nof(:,pl))
2961         plot0 = gsn_csm_xy(wks,data_0(:,:),z_(pl,:),res)
2962
2963         ; ***************************************************
2964         ; legend for combined plot
2965         ; ***************************************************
2966
2967         lgres                    = True
2968         lgMonoDashIndex          = False
2969         lgres@lgLabelFont        = "helvetica"   
2970         lgres@lgLabelFontHeightF = font_size_legend           
2971         lgres@vpWidthF           = max(string_len)*0.015           
2972         lgres@vpHeightF          = 0.03*no_files         
2973         lgres@lgDashIndexes      = multi_dash(no_files-1:0)
2974         lbid = gsn_create_legend(wks,no_files,multi_legend(no_files-1:0),lgres)       
2975
2976         amres = True
2977         amres@amParallelPosF   = max(string_len)*0.012+0.78               
2978         amres@amOrthogonalPosF = -0.0315*no_files+0.431         
2979         annoid1 = gsn_add_annotation(plot0,lbid,amres)
2980
2981         do plo=0,no_files-1
2982            overlay(plot0,multi_plot(plo,pl))
2983            plot(pl)=plot0
2984         end do
2985         delete(plot0)
2986      end do
2987   end if
2988
2989   if (count_var .EQ. 0) then
2990      print(" ")
2991      print("Select a variable 'var=' or use the default value")
2992      print(" ")
2993      print("Your selection '"+var+"' does not exist on the input file")
2994      print(" ")
2995      exit
2996   end if
2997
2998   if (over .EQ. 1 ) then
2999
3000      overlay(plot_u,plot_v)
3001      overlay(plot_u,plot_w)
3002      u=0
3003      overlay(plot_pt,plot_vpt)
3004      overlay(plot_pt,plot_lpt)
3005      pt=0
3006      overlay(plot_q,plot_qv)
3007      overlay(plot_q,plot_ql)
3008      q=0
3009      overlay(plot_e,plot_es)
3010      e=0
3011      overlay(plot_km,plot_kh)
3012      km=0
3013      overlay(plot_wpup,plot_wsus)
3014      overlay(plot_wpup,plot_wu)
3015      wpup=0
3016      overlay(plot_wpvp,plot_wsvs)
3017      overlay(plot_wpvp,plot_wv)
3018      wpvp=0
3019      overlay(plot_wpptp,plot_wspts)
3020      overlay(plot_wpptp,plot_wpt)
3021      wpptp=0
3022      overlay(plot_wsptsBC,plot_wptBC)
3023      wsptsBC=0
3024      overlay(plot_wpvptp,plot_wsvpts)
3025      overlay(plot_wpvptp,plot_wvpt)
3026      wpvptp=0
3027      overlay(plot_wpqp,plot_wsqs)
3028      overlay(plot_wpqp,plot_wq)
3029      wpqp=0
3030      overlay(plot_wpqvp,plot_wsqvs)
3031      overlay(plot_wpqvp,plot_wqv)
3032      wpqvp=0
3033      overlay(plot_wpsp,plot_wsss)
3034      overlay(plot_wpsp,plot_ws)
3035      wpsp=0
3036      overlay(plot_wpsap,plot_wssas)
3037      overlay(plot_wpsap,plot_wsa)
3038      wpsap=0
3039      overlay(plot_us2,plot_vs2)
3040      overlay(plot_us2,plot_ws2)
3041      us2=0
3042      overlay(plot_wsususodz,plot_wspsodz)
3043      overlay(plot_wsususodz,plot_wpeodz)
3044      wsususodz=0
3045
3046   end if
3047
3048   if (over .EQ. 1) then
3049   
3050      do varn = 0,dim-1   
3051         
3052         check = True
3053     
3054         if (prof3d .EQ. 0) then
3055            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
3056               check = False
3057            end if
3058         else
3059            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "zusi") .OR. isStrSubset( vNam(varn), "zwwi") .OR. isStrSubset( vNam(varn), "x") .OR. isStrSubset( vNam(varn), "xu") .OR. isStrSubset( vNam(varn), "y") .OR. isStrSubset( vNam(varn), "yv") .OR. isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
3060               check = False
3061            end if
3062         end if
3063
3064         if (var .NE. "all") then     
3065            check = isStrSubset( var,","+vNam(varn)+"," )
3066         end if     
3067
3068         if (check)then
3069
3070            if (prof3d .EQ. 0) then
3071               if (log_z .EQ. 1) then
3072                  z = f_att->$vNam(varn+1)$(1:dimz-1)
3073               else
3074                  z = f_att->$vNam(varn+1)$               
3075               end if
3076            else
3077               do i=0,b-1           
3078                  if (isStrSubset( a(i),"zu_3d" ))then
3079                     z_v(varn,:) = z_u
3080                     if (log_z .EQ. 1) then
3081                        z = z_v(varn,1:dimz-1)
3082                     else
3083                        z = z_v(varn,:)
3084                     end if
3085                  else
3086                     if (isStrSubset( a(i),"zw_3d" ))then
3087                        z_v(varn,:) = z_w
3088                        if (log_z .EQ. 1) then
3089                           z = z_v(varn,1:dimz-1)
3090                        else
3091                           z = z_v(varn,:)
3092                        end if
3093                     end if                   
3094                  end if
3095               end do           
3096            end if
3097
3098            z=z/norm_z
3099           
3100            if (abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 10)then
3101               min_value = abs(0.01*min(data(varn,:,min_z_int:max_z_int)))
3102               max_value = abs(0.01*max(data(varn,:,min_z_int:max_z_int)))
3103            else
3104               if (abs(min(data(varn,:,min_z_int:max_z_int))) .LT. 0.01 .AND. \
3105                   abs(max(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
3106                  min_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
3107                  max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
3108               else
3109                  if (abs(max(data(varn,:,:))) .LT. 0.01 .AND. \
3110                      abs(min(data(varn,:,min_z_int:max_z_int))) .GT. 0.01)then
3111                     min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
3112                     max_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
3113                  else
3114                     min_value = abs(0.1*min(data(varn,:,min_z_int:max_z_int)))
3115                     max_value = abs(0.1*max(data(varn,:,min_z_int:max_z_int)))
3116                  end if
3117               end if
3118            end if
3119            if (min(data(varn,:,min_z_int:max_z_int)) .EQ. 0 .AND.\
3120                max(data(varn,:,min_z_int:max_z_int)) .EQ. 0)then
3121               min_value = 0.1
3122               max_value = 0.1
3123            end if
3124
3125            res@gsnLeftString      = vNam(varn)
3126            res@tiXAxisString      = "["+unit(varn)+"]"
3127            res@gsnRightString     = " "
3128            res@trYMinF            = min_z
3129            res@trYMaxF            = max_z 
3130            res@xyDashPattern = 0
3131
3132            if (xs .EQ. -1) then
3133               res@trXMinF = min(data(varn,:,min_z_int:max_z_int))-min_value
3134            else
3135               res@trXMinF = xs
3136            end if
3137            if (xe .EQ. -1) then
3138               res@trXMaxF = max(data(varn,:,min_z_int:max_z_int))+max_value
3139            else
3140               res@trXMaxF = xe 
3141            end if
3142            plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
3143           
3144            if (vNam(varn) .EQ. "u" .OR. vNam(varn) .EQ. "v" .OR. vNam(varn) .EQ. "w") then
3145               if (u .EQ. 0) then
3146                  res@gsnLeftString      = "u, v and w"
3147                  res@tiXAxisString      = "["+unit(varn)+"]"
3148                  res@gsnRightString     = " "
3149                  if (xs .EQ. -1) then
3150                     res@trXMinF = min((/miniu,miniv,miniw/))
3151                  else
3152                     res@trXMinF = xs
3153                  end if
3154                  if (xe .EQ. -1) then
3155                     res@trXMaxF = max((/maxiu,maxiv,maxiw/))
3156                  else
3157                     res@trXMaxF = xe 
3158                  end if 
3159                  if (vNam(varn) .EQ. "v")then
3160                     res@xyDashPattern = 1
3161                  end if
3162                  if (vNam(varn) .EQ. "w")then
3163                     res@xyDashPattern = 2
3164                  end if
3165                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3166
3167                  ; ***************************************************
3168                  ; legend for combined plot
3169                  ; ***************************************************
3170     
3171                  lgres                    = True
3172                  lgMonoDashIndex          = False
3173                  lgres@lgLabelFont        = "helvetica"   
3174                  lgres@lgLabelFontHeightF = font_size_legend           
3175                  lgres@vpWidthF           = 0.06           
3176                  lgres@vpHeightF          = 0.12         
3177                  lgres@lgDashIndexes      = (/0,1,2/)
3178                  lbid = gsn_create_legend(wks,3,(/"u","v","w"/),lgres)       
3179
3180                  amres = True
3181                  amres@amParallelPosF   = 0.65             
3182                  amres@amOrthogonalPosF = -0.2           
3183                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3184                  overlay(plot(n),plot_u)
3185                  u=1
3186               else
3187                  if (prof3d .EQ. 0)then
3188                     varn=varn+1
3189                  end if
3190                  continue
3191               end if       
3192            end if 
3193     
3194            if (vNam(varn) .EQ. "pt" .OR. vNam(varn) .EQ. "vpt" .OR. vNam(varn) .EQ. "lpt") then
3195               if (pt .EQ. 0) then
3196                  res@gsnLeftString      = "pt, vpt and lpt"
3197                  res@tiXAxisString      = "["+unit(varn)+"]"
3198                  res@gsnRightString     = " "
3199                  if (xs .EQ. -1) then
3200                     res@trXMinF = min((/minipt,minivpt,minilpt/))
3201                  else
3202                     res@trXMinF = xs
3203                  end if
3204                  if (xe .EQ. -1) then
3205                     res@trXMaxF = max((/maxipt,maxivpt,maxilpt/))
3206                  else
3207                     res@trXMaxF = xe 
3208                  end if
3209                  if (vNam(varn) .EQ. "vpt")then
3210                     res@xyDashPattern = 1
3211                  end if
3212                  if (vNam(varn) .EQ. "lpt")then
3213                     res@xyDashPattern = 2
3214                  end if
3215                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3216
3217                  ; ***************************************************
3218                  ; legend for combined plot
3219                  ; ***************************************************
3220     
3221                  lgres                    = True
3222                  lgMonoDashIndex          = False
3223                  lgres@lgLabelFont        = "helvetica"   
3224                  lgres@lgLabelFontHeightF = font_size_legend         
3225                  lgres@vpWidthF           = 0.07           
3226                  lgres@vpHeightF          = 0.12         
3227                  lgres@lgDashIndexes      = (/0,1,2/)
3228                  lbid = gsn_create_legend(wks,3,(/"pt","vpt","lpt"/),lgres)       
3229
3230                  amres = True
3231                  amres@amParallelPosF   = 0.65             
3232                  amres@amOrthogonalPosF = -0.2           
3233                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3234                  overlay(plot(n),plot_pt)
3235                  pt=1
3236               else
3237                  if (prof3d .EQ. 0)then
3238                     varn=varn+1
3239                  end if
3240                  continue       
3241               end if
3242            end if           
3243            if (vNam(varn) .EQ. "q" .OR. vNam(varn) .EQ. "qv" .OR. vNam(varn) .EQ. "ql") then
3244               if (q .EQ. 0) then
3245                  res@gsnLeftString      = "q, qv and ql"
3246                  res@tiXAxisString      = "["+unit(varn)+"]"
3247                  res@gsnRightString     = " "
3248                  if (xs .EQ. -1) then
3249                     res@trXMinF = min((/miniq,miniqv,miniql/))
3250                  else
3251                     res@trXMinF = xs
3252                  end if
3253                  if (xe .EQ. -1) then
3254                     res@trXMaxF = max((/maxiq,maxiqv,maxiql/))
3255                  else
3256                     res@trXMaxF = xe 
3257                  end if
3258                  if (vNam(varn) .EQ. "qv")then
3259                     res@xyDashPattern = 1
3260                  end if
3261                  if (vNam(varn) .EQ. "ql")then
3262                     res@xyDashPattern = 2
3263                  end if
3264                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3265
3266                  ; ***************************************************
3267                  ; legend for combined plot
3268                  ; ***************************************************
3269     
3270                  lgres                    = True
3271                  lgMonoDashIndex          = False
3272                  lgres@lgLabelFont        = "helvetica"   
3273                  lgres@lgLabelFontHeightF = font_size_legend           
3274                  lgres@vpWidthF           = 0.06         
3275                  lgres@vpHeightF          = 0.12         
3276                  lgres@lgDashIndexes      = (/0,1,2/)
3277                  lbid = gsn_create_legend(wks,3,(/"q","qv","ql"/),lgres)       
3278
3279                  amres = True
3280                  amres@amParallelPosF   = 0.65             
3281                  amres@amOrthogonalPosF = -0.2           
3282                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3283                  overlay(plot(n),plot_q)
3284                  q=1
3285               else
3286                  if (prof3d .EQ. 0)then
3287                     varn=varn+1
3288                  end if
3289                  continue   
3290               end if
3291            end if   
3292           
3293            if (vNam(varn) .EQ. "e" .OR. vNam(varn) .EQ. "es" .OR. vNam(varn) .EQ. "e*" ) then
3294               if (e .EQ. 0) then
3295                  res@gsnLeftString      = "e and e*"
3296                  res@tiXAxisString      = "["+unit(varn)+"]"
3297                  res@gsnRightString     = " "
3298                  if (xs .EQ. -1) then
3299                     res@trXMinF = min((/minie,minies/))
3300                  else
3301                     res@trXMinF = xs
3302                  end if
3303                  if (xe .EQ. -1) then
3304                     res@trXMaxF = max((/maxie,maxies/))
3305                  else
3306                     res@trXMaxF = xe 
3307                  end if
3308                  if (vNam(varn) .EQ. "es")then
3309                     res@xyDashPattern = 1
3310                  end if
3311                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3312
3313                  ; ***************************************************
3314                  ; legend for combined plot
3315                  ; ***************************************************
3316     
3317                  lgres                    = True
3318                  lgMonoDashIndex          = False
3319                  lgres@lgLabelFont        = "helvetica"   
3320                  lgres@lgLabelFontHeightF = font_size_legend           
3321                  lgres@vpWidthF           = 0.06           
3322                  lgres@vpHeightF          = 0.08         
3323                  lgres@lgDashIndexes      = (/0,1,2/)
3324                  lbid = gsn_create_legend(wks,2,(/"e","e*"/),lgres)       
3325
3326                  amres = True
3327                  amres@amParallelPosF   = 0.65             
3328                  amres@amOrthogonalPosF = -0.2           
3329                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3330                  overlay(plot(n),plot_e)
3331                  e=1
3332               else
3333                  if (prof3d .EQ. 0)then
3334                     varn=varn+1
3335                  end if
3336                  continue   
3337               end if
3338            end if           
3339            if (vNam(varn) .EQ. "km" .OR. vNam(varn) .EQ. "kh") then
3340               if (km .EQ. 0) then
3341                  res@gsnLeftString      = "km and kh"
3342                  res@tiXAxisString      = "["+unit(varn)+"]"
3343                  res@gsnRightString     = " "
3344                  if (xs .EQ. -1) then
3345                     res@trXMinF = min((/minikm,minikh/))
3346                  else
3347                     res@trXMinF = xs
3348                  end if
3349                  if (xe .EQ. -1) then
3350                     res@trXMaxF = max((/maxikm,maxikh/))
3351                  else
3352                     res@trXMaxF = xe 
3353                  end if
3354                  if (vNam(varn) .EQ. "kh")then
3355                     res@xyDashPattern = 1
3356                  end if
3357                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3358
3359                  ; ***************************************************
3360                  ; legend for combined plot
3361                  ; ***************************************************
3362     
3363                  lgres                    = True
3364                  lgMonoDashIndex          = False
3365                  lgres@lgLabelFont        = "helvetica"   
3366                  lgres@lgLabelFontHeightF = font_size_legend           
3367                  lgres@vpWidthF           = 0.06           
3368                  lgres@vpHeightF          = 0.08         
3369                  lgres@lgDashIndexes      = (/0,1,2/)
3370                  lbid = gsn_create_legend(wks,2,(/"km","kh"/),lgres)       
3371
3372                  amres = True
3373                  amres@amParallelPosF   = 0.65             
3374                  amres@amOrthogonalPosF = -0.2           
3375                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3376                  overlay(plot(n),plot_km)
3377                  km=1
3378               else
3379                  if (prof3d .EQ. 0)then
3380                     varn=varn+1
3381                  end if
3382                  continue   
3383               end if
3384            end if           
3385           
3386            if (vNam(varn) .EQ. "wpup" .OR. vNam(varn) .EQ. "wsus" .OR. vNam(varn) .EQ. "wu" \
3387                .OR. vNam(varn) .EQ. "w"+dq+"u"+dq .OR. vNam(varn) .EQ. "w*u*") then
3388               if (wpup .EQ. 0) then
3389                  res@gsnLeftString      = "w"+dq+"u"+dq+", w*u* and wu"
3390                  res@tiXAxisString      = "["+unit(varn)+"]"
3391                  res@gsnRightString     = " "
3392                  if (xs .EQ. -1) then
3393                     res@trXMinF = min((/miniwpup,miniwsus,miniwu/))
3394                  else
3395                     res@trXMinF = xs
3396                  end if
3397                  if (xe .EQ. -1) then
3398                     res@trXMaxF = max((/maxiwpup,maxiwsus,maxiwu/))
3399                  else
3400                     res@trXMaxF = xe 
3401                  end if 
3402                  if (vNam(varn) .EQ. "wsus")then
3403                     res@xyDashPattern = 1
3404                  end if
3405                  if (vNam(varn) .EQ. "wu")then
3406                     res@xyDashPattern = 2
3407                  end if
3408                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3409
3410                  ; ***************************************************
3411                  ; legend for combined plot
3412                  ; ***************************************************
3413     
3414                  lgres                    = True
3415                  lgMonoDashIndex          = False
3416                  lgres@lgLabelFont        = "helvetica"   
3417                  lgres@lgLabelFontHeightF = font_size_legend           
3418                  lgres@vpWidthF           = 0.08           
3419                  lgres@vpHeightF          = 0.12         
3420                  lgres@lgDashIndexes      = (/0,1,2/)
3421                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"u"+dq,"w*u*","wu"/),lgres)       
3422
3423                  amres = True
3424                  amres@amParallelPosF   = 0.65             
3425                  amres@amOrthogonalPosF = -0.2           
3426                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3427                  overlay(plot(n),plot_wpup)
3428                  wpup=1
3429               else
3430                  if (prof3d .EQ. 0)then
3431                     varn=varn+1
3432                  end if
3433                  continue   
3434               end if
3435            end if
3436            if (vNam(varn) .EQ. "wpvp" .OR. vNam(varn) .EQ. "wsvs" .OR.vNam(varn) .EQ. "wv"\
3437                .OR. vNam(varn) .EQ. "w"+dq+"v"+dq .OR. vNam(varn) .EQ. "w*v*") then
3438               if (wpvp .EQ. 0) then
3439                  res@gsnLeftString      = "w"+dq+"v"+dq+", w*v* and wv"
3440                  res@tiXAxisString      = "["+unit(varn)+"]"
3441                  res@gsnRightString     = " "
3442                  if (xs .EQ. -1) then
3443                     res@trXMinF = min((/miniwpvp,miniwsvs,miniwv/))
3444                  else
3445                     res@trXMinF = xs
3446                  end if
3447                  if (xe .EQ. -1) then
3448                     res@trXMaxF = max((/maxiwpvp,maxiwsvs,maxiwv/))
3449                  else
3450                     res@trXMaxF = xe 
3451                  end if
3452                  if (vNam(varn) .EQ. "wsvs")then
3453                     res@xyDashPattern = 1
3454                  end if
3455                  if (vNam(varn) .EQ. "wv")then
3456                     res@xyDashPattern = 2
3457                  end if
3458                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3459
3460                  ; ***************************************************
3461                  ; legend for combined plot
3462                  ; ***************************************************
3463     
3464                  lgres                    = True
3465                  lgMonoDashIndex          = False
3466                  lgres@lgLabelFont        = "helvetica"   
3467                  lgres@lgLabelFontHeightF = font_size_legend           
3468                  lgres@vpWidthF           = 0.08         
3469                  lgres@vpHeightF          = 0.12         
3470                  lgres@lgDashIndexes      = (/0,1,2/)
3471                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"v"+dq,"w*v*","wv"/),lgres)       
3472
3473                  amres = True
3474                  amres@amParallelPosF   = 0.65             
3475                  amres@amOrthogonalPosF = -0.2           
3476                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3477                  overlay(plot(n),plot_wpvp)
3478                  wpvp=1
3479               else
3480                  if (prof3d .EQ. 0)then
3481                     varn=varn+1
3482                  end if
3483                  continue   
3484               end if
3485            end if
3486            if (vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "wspts" .OR. vNam(varn) .EQ. "wpt"\
3487                .OR. vNam(varn) .EQ. "w"+dq+"pt"+dq .OR. vNam(varn) .EQ. "w*pt*") then
3488               if (wpptp .EQ. 0) then                 
3489                  res@gsnLeftString      = "w"+dq+"pt"+dq+", w*pt* and wpt"
3490                  res@tiXAxisString      = "["+unit(varn)+"]"
3491                  res@gsnRightString     = " "
3492                  if (xs .EQ. -1) then
3493                     res@trXMinF = min((/miniwpptp,miniwspts,miniwpt/))
3494                  else
3495                     res@trXMinF = xs
3496                  end if
3497                  if (xe .EQ. -1) then
3498                     res@trXMaxF = max((/maxiwpptp,maxiwspts,maxiwpt/))
3499                  else
3500                     res@trXMaxF = xe 
3501                  end if
3502                  if (vNam(varn) .EQ. "wspts" .OR. vNam(varn) .EQ. "w*pt*")then
3503                     res@xyDashPattern = 1
3504                  end if
3505                  if (vNam(varn) .EQ. "wpt")then
3506                     res@xyDashPattern = 2
3507                  end if
3508                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3509
3510                  ; ***************************************************
3511                  ; legend for combined plot
3512                  ; ***************************************************
3513     
3514                  lgres                    = True
3515                  lgMonoDashIndex          = False
3516                  lgres@lgLabelFont        = "helvetica"   
3517                  lgres@lgLabelFontHeightF = font_size_legend           
3518                  lgres@vpWidthF           = 0.09           
3519                  lgres@vpHeightF          = 0.12         
3520                  lgres@lgDashIndexes      = (/0,1,2/)             
3521                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"pt"+dq,"w*pt*","wpt"/),lgres)     
3522
3523                  amres = True
3524                  amres@amParallelPosF   = 0.65             
3525                  amres@amOrthogonalPosF = -0.2           
3526                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3527                  overlay(plot(n),plot_wpptp)
3528                  wpptp=1
3529               else
3530                  if (prof3d .EQ. 0)then
3531                     varn=varn+1
3532                  end if
3533                  continue   
3534               end if
3535            end if
3536            if (vNam(varn) .EQ. "wsptsBC" .OR. vNam(varn) .EQ. "wptBC" .OR. vNam(varn) .EQ. "w*pt*BC") then
3537               if (wsptsBC .EQ. 0) then
3538                  res@gsnLeftString      = "w*pt*BC and wptBC"
3539                  res@tiXAxisString      = "["+unit(varn)+"]"
3540                  res@gsnRightString     = " "
3541                  if (xs .EQ. -1) then
3542                     res@trXMinF = min((/miniwsptsBC,miniwptBC/))
3543                  else
3544                     res@trXMinF = xs
3545                  end if
3546                  if (xe .EQ. -1) then
3547                     res@trXMaxF = max((/maxiwsptsBC,maxiwptBC/))
3548                  else
3549                     res@trXMaxF = xe 
3550                  end if
3551                  if (vNam(varn) .EQ. "wptBC")then
3552                     res@xyDashPattern = 1
3553                  end if
3554                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3555
3556                  ; ***************************************************
3557                  ; legend for combined plot
3558                  ; ***************************************************
3559     
3560                  lgres                    = True
3561                  lgMonoDashIndex          = False
3562                  lgres@lgLabelFont        = "helvetica"   
3563                  lgres@lgLabelFontHeightF = font_size_legend           
3564                  lgres@vpWidthF           = 0.1           
3565                  lgres@vpHeightF          = 0.12         
3566                  lgres@lgDashIndexes      = (/0,1,2/)
3567                  lbid = gsn_create_legend(wks,3,(/"w*pt*BC","wptBC"/),lgres)       
3568
3569                  amres = True
3570                  amres@amParallelPosF   = 0.65             
3571                  amres@amOrthogonalPosF = -0.2           
3572                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3573                  overlay(plot(n),plot_wsptsBC)
3574                  wsptsBC=1
3575               else
3576                  if (prof3d .EQ. 0)then
3577                     varn=varn+1
3578                  end if
3579                  continue   
3580               end if 
3581            end if             
3582            if (vNam(varn) .EQ. "wpvptp" .OR. vNam(varn) .EQ. "wsvpts" .OR. vNam(varn) .EQ. "wvpt"\
3583                .OR. vNam(varn) .EQ. "w"+dq+"vpt"+dq .OR. vNam(varn) .EQ. "w*vpt*") then
3584               if (wpvptp .EQ. 0) then
3585                  res@gsnLeftString      = "w"+dq+"vpt"+dq+", w*vpt* and wvpt"
3586                  res@tiXAxisString      = "["+unit(varn)+"]"
3587                  res@gsnRightString     = " "
3588                  if (xs .EQ. -1) then
3589                     res@trXMinF = min((/miniwpvptp,miniwsvpts,miniwvpt/))
3590                  else
3591                     res@trXMinF = xs
3592                  end if
3593                  if (xe .EQ. -1) then
3594                     res@trXMaxF = max((/maxiwpvptp,maxiwsvpts,maxiwvpt/))
3595                  else
3596                     res@trXMaxF = xe 
3597                  end if
3598                  if (vNam(varn) .EQ. "wsvpts")then
3599                     res@xyDashPattern = 1
3600                  end if
3601                  if (vNam(varn) .EQ. "wvpt")then
3602                     res@xyDashPattern = 2
3603                  end if
3604                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3605
3606                  ; ***************************************************
3607                  ; legend for combined plot
3608                  ; ***************************************************
3609     
3610                  lgres                    = True
3611                  lgMonoDashIndex          = False
3612                  lgres@lgLabelFont        = "helvetica"   
3613                  lgres@lgLabelFontHeightF = font_size_legend           
3614                  lgres@vpWidthF           = 0.1           
3615                  lgres@vpHeightF          = 0.12         
3616                  lgres@lgDashIndexes      = (/0,1,2/)
3617                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"vpt"+dq,"w*vpt*","wvpt"/),lgres)       
3618
3619                  amres = True
3620                  amres@amParallelPosF   = 0.65             
3621                  amres@amOrthogonalPosF = -0.2           
3622                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3623                  overlay(plot(n),plot_wpvptp)
3624                  wpvptp=1
3625               else
3626                  if (prof3d .EQ. 0)then
3627                     varn=varn+1
3628                  end if
3629                  continue   
3630               end if
3631            end if
3632            if (vNam(varn) .EQ. "wpqp" .OR. vNam(varn) .EQ. "wsqs" .OR. vNam(varn) .EQ. "wq"\
3633                 .OR. vNam(varn) .EQ. "w"+dq+"q"+dq .OR. vNam(varn) .EQ. "w*q*") then
3634               if (wpqp .EQ. 0) then
3635                  res@gsnLeftString      = "w"+dq+"q"+dq+", w*q* and wq"
3636                  res@tiXAxisString      = "["+unit(varn)+"]"
3637                  res@gsnRightString     = " "
3638                  if (xs .EQ. -1) then
3639                     res@trXMinF = min((/miniwpqp,miniwsqs,miniwq/))
3640                  else
3641                     res@trXMinF = xs
3642                  end if
3643                  if (xe .EQ. -1) then
3644                     res@trXMaxF = max((/maxiwpqp,maxiwsqs,maxiwq/))
3645                  else
3646                     res@trXMaxF = xe 
3647                  end if 
3648                  if (vNam(varn) .EQ. "wsqs")then
3649                     res@xyDashPattern = 1
3650                  end if
3651                  if (vNam(varn) .EQ. "wq")then
3652                     res@xyDashPattern = 2
3653                  end if
3654                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3655
3656                  ; ***************************************************
3657                  ; legend for combined plot
3658                  ; ***************************************************
3659     
3660                  lgres                    = True
3661                  lgMonoDashIndex          = False
3662                  lgres@lgLabelFont        = "helvetica"   
3663                  lgres@lgLabelFontHeightF = font_size_legend           
3664                  lgres@vpWidthF           = 0.08           
3665                  lgres@vpHeightF          = 0.12         
3666                  lgres@lgDashIndexes      = (/0,1,2/)
3667                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"q"+dq,"w*q*","wq"/),lgres)       
3668
3669                  amres = True
3670                  amres@amParallelPosF   = 0.65             
3671                  amres@amOrthogonalPosF = -0.2           
3672                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3673                  overlay(plot(n),plot_wpqp)
3674                  wpqp=1
3675               else
3676                  if (prof3d .EQ. 0)then
3677                     varn=varn+1
3678                  end if
3679                  continue   
3680               end if
3681            end if
3682            if (vNam(varn) .EQ. "wpqvp" .OR. vNam(varn) .EQ. "wsqvs" .OR. vNam(varn) .EQ. "wqv"\
3683                .OR. vNam(varn) .EQ. "w"+dq+"qv"+dq .OR. vNam(varn) .EQ. "w*qv*") then
3684               if (wpqvp .EQ. 0) then
3685                  res@gsnLeftString      ="w"+dq+"qv"+dq+" , w*qv* and wqv"
3686                  res@tiXAxisString      = "["+unit(varn)+"]"
3687                  res@gsnRightString     = " "
3688                  if (xs .EQ. -1) then
3689                     res@trXMinF = min((/miniwpqp,miniwsqvs,miniwqv/))
3690                  else
3691                     res@trXMinF = xs
3692                  end if
3693                  if (xe .EQ. -1) then
3694                     res@trXMaxF = max((/maxiwpqp,maxiwsqvs,maxiwqv/))
3695                  else
3696                     res@trXMaxF = xe 
3697                  end if
3698                  if (vNam(varn) .EQ. "wsqvs")then
3699                     res@xyDashPattern = 1
3700                  end if
3701                  if (vNam(varn) .EQ. "wqv")then
3702                     res@xyDashPattern = 2
3703                  end if
3704                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3705
3706                  ; ***************************************************
3707                  ; legend for combined plot
3708                  ; ***************************************************
3709     
3710                  lgres                    = True
3711                  lgMonoDashIndex          = False
3712                  lgres@lgLabelFont        = "helvetica"   
3713                  lgres@lgLabelFontHeightF = font_size_legend           
3714                  lgres@vpWidthF           = 0.09           
3715                  lgres@vpHeightF          = 0.12         
3716                  lgres@lgDashIndexes      = (/0,1,2/)
3717                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"qv"+dq,"w*qv*","wqv"/),lgres)       
3718
3719                  amres = True
3720                  amres@amParallelPosF   = 0.65             
3721                  amres@amOrthogonalPosF = -0.2           
3722                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3723                  overlay(plot(n),plot_wpqvp)
3724                  wpqvp=1
3725               else
3726                  if (prof3d .EQ. 0)then
3727                     varn=varn+1
3728                  end if
3729                  continue   
3730               end if
3731            end if
3732            if (vNam(varn) .EQ. "wpsp" .OR. vNam(varn) .EQ. "wsss" .OR. vNam(varn) .EQ. "ws"\
3733                .OR. vNam(varn) .EQ. "w"+dq+"s"+dq .OR. vNam(varn) .EQ. "w*s*") then
3734               if (wpsp .EQ. 0) then
3735                  res@gsnLeftString      = "w"+dq+"s"+dq+", w*s* and ws"
3736                  res@tiXAxisString      = "["+unit(varn)+"]"
3737                  res@gsnRightString     = " "
3738                  if (xs .EQ. -1) then
3739                     res@trXMinF = min((/miniwpsp,miniwsss,miniws/))
3740                  else
3741                     res@trXMinF = xs
3742                  end if
3743                  if (xe .EQ. -1) then
3744                     res@trXMaxF = max((/maxiwpsp,maxiwsss,maxiws/))
3745                  else
3746                     res@trXMaxF = xe 
3747                  end if
3748                  if (vNam(varn) .EQ. "wsss")then
3749                     res@xyDashPattern = 1
3750                  end if
3751                  if (vNam(varn) .EQ. "ws")then
3752                     res@xyDashPattern = 2
3753                  end if
3754                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3755
3756                  ; ***************************************************
3757                  ; legend for combined plot
3758                  ; ***************************************************
3759     
3760                  lgres                    = True
3761                  lgMonoDashIndex          = False
3762                  lgres@lgLabelFont        = "helvetica"   
3763                  lgres@lgLabelFontHeightF = font_size_legend           
3764                  lgres@vpWidthF           = 0.08           
3765                  lgres@vpHeightF          = 0.12         
3766                  lgres@lgDashIndexes      = (/0,1,2/)
3767                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"s"+dq,"w*s*","ws"/),lgres)       
3768
3769                  amres = True
3770                  amres@amParallelPosF   = 0.65             
3771                  amres@amOrthogonalPosF = -0.2           
3772                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3773                  overlay(plot(n),plot_wpsp)
3774                  wpsp=1
3775               else
3776                  if (prof3d .EQ. 0)then
3777                     varn=varn+1
3778                  end if
3779                  continue   
3780               end if
3781            end if
3782            if (vNam(varn) .EQ. "wpsap" .OR.vNam(varn) .EQ. "wssas" .OR. vNam(varn) .EQ. "wsa"\
3783                .OR. vNam(varn) .EQ. "w"+dq+"sa"+dq .OR. vNam(varn) .EQ. "w*sa*") then
3784               if (wpsap .EQ. 0) then
3785                  res@gsnLeftString      = "w"+dq+"sa"+dq+", w*sa* and wsa"
3786                  res@tiXAxisString      = "["+unit(varn)+"]"
3787                  res@gsnRightString     = " "
3788                  if (xs .EQ. -1) then
3789                     res@trXMinF = min((/miniwpsap,miniwssas,miniwsa/))
3790                  else
3791                     res@trXMinF = xs
3792                  end if
3793                  if (xe .EQ. -1) then
3794                     res@trXMaxF = max((/maxiwpsap,maxiwssas,maxiwsa/))
3795                  else
3796                     res@trXMaxF = xe 
3797                  end if
3798                  if (vNam(varn) .EQ. "wssas")then
3799                     res@xyDashPattern = 1
3800                  end if
3801                  if (vNam(varn) .EQ. "wsa")then
3802                     res@xyDashPattern = 2
3803                  end if
3804                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3805
3806                  ; ***************************************************
3807                  ; legend for combined plot
3808                  ; ***************************************************
3809     
3810                  lgres                    = True
3811                  lgMonoDashIndex          = False
3812                  lgres@lgLabelFont        = "helvetica"   
3813                  lgres@lgLabelFontHeightF = font_size_legend           
3814                  lgres@vpWidthF           = 0.09           
3815                  lgres@vpHeightF          = 0.12         
3816                  lgres@lgDashIndexes      = (/0,1,2/)
3817                  lbid = gsn_create_legend(wks,3,(/"w"+dq+"sa"+dq,"w*sa*","wsa"/),lgres)       
3818
3819                  amres = True
3820                  amres@amParallelPosF   = 0.65             
3821                  amres@amOrthogonalPosF = -0.2           
3822                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3823                  overlay(plot(n),plot_wpsap)
3824                  wpsap=1
3825               else
3826                  if (prof3d .EQ. 0)then
3827                     varn=varn+1
3828                  end if
3829                  continue   
3830               end if
3831            end if
3832         
3833            if (vNam(varn) .EQ. "us2" .OR. vNam(varn) .EQ. "vs2" .OR. vNam(varn) .EQ. "ws2" \
3834                .OR. vNam(varn) .EQ. "u*2" .OR. vNam(varn) .EQ. "v*2" .OR. vNam(varn) .EQ. "w*2" ) then
3835               if (us2 .EQ. 0) then
3836                  res@gsnLeftString      = "u*2, v*2 and w*2"
3837                  res@tiXAxisString      = "["+unit(varn)+"]"
3838                  res@gsnRightString     = " "
3839                  if (xs .EQ. -1) then
3840                     res@trXMinF = min((/minius2,minivs2,miniws2/))
3841                  else
3842                     res@trXMinF = xs
3843                  end if
3844                  if (xe .EQ. -1) then
3845                     res@trXMaxF = max((/maxius2,maxivs2,maxiws2/))
3846                  else
3847                     res@trXMaxF = xe 
3848                  end if
3849                  if (vNam(varn) .EQ. "vs2")then
3850                     res@xyDashPattern = 1
3851                  end if
3852                  if (vNam(varn) .EQ. "ws2")then
3853                     res@xyDashPattern = 2
3854                  end if
3855                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3856
3857                  ; ***************************************************
3858                  ; legend for combined plot
3859                  ; ***************************************************
3860     
3861                  lgres                    = True
3862                  lgMonoDashIndex          = False
3863                  lgres@lgLabelFont        = "helvetica"   
3864                  lgres@lgLabelFontHeightF = font_size_legend           
3865                  lgres@vpWidthF           = 0.07           
3866                  lgres@vpHeightF          = 0.12         
3867                  lgres@lgDashIndexes      = (/0,1,2/)
3868                  lbid = gsn_create_legend(wks,3,(/"u*2","v*2","w*2"/),lgres)       
3869
3870                  amres = True
3871                  amres@amParallelPosF   = 0.65             
3872                  amres@amOrthogonalPosF = -0.2           
3873                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3874                  overlay(plot(n),plot_us2)
3875                  us2=1
3876               else
3877                  if (prof3d .EQ. 0)then
3878                     varn=varn+1
3879                  end if
3880                  continue   
3881               end if
3882            end if
3883           
3884            if (vNam(varn) .EQ. "wsususodz" .OR. vNam(varn) .EQ. "wspsodz" .OR. vNam(varn) .EQ. "wpeodz" \
3885               .OR. vNam(varn) .EQ. "w*u*u*:dz" .OR. vNam(varn) .EQ. "w*p*:dz" .OR. vNam(varn) .EQ. "w"+dq+"e:dz") then
3886               if (wsususodz .EQ. 0) then
3887                  res@gsnLeftString      = "w*u*u*:dz, w*p*:dz and w"+dq+"e:dz"
3888                  res@tiXAxisString      = "["+unit(varn)+"]"
3889                  res@gsnRightString     = " "
3890                  if (xs .EQ. -1) then
3891                     res@trXMinF = min((/miniwsususodz,miniwspsodz,miniwpeodz/))
3892                  else
3893                     res@trXMinF = xs
3894                  end if
3895                  if (xe .EQ. -1) then
3896                     res@trXMaxF = max((/maxiwsususodz,maxiwspsodz,maxiwpeodz/))
3897                  else
3898                     res@trXMaxF = xe 
3899                  end if
3900                  if (vNam(varn) .EQ. "wspsodz")then
3901                     res@xyDashPattern = 1
3902                  end if
3903                  if (vNam(varn) .EQ. "wpeodz")then
3904                     res@xyDashPattern = 2
3905                  end if
3906                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3907
3908                  ; ***************************************************
3909                  ; legend for combined plot
3910                  ; ***************************************************
3911     
3912                  lgres                    = True
3913                  lgMonoDashIndex          = False
3914                  lgres@lgLabelFont        = "helvetica"   
3915                  lgres@lgLabelFontHeightF = font_size_legend           
3916                  lgres@vpWidthF           = 0.12           
3917                  lgres@vpHeightF          = 0.12         
3918                  lgres@lgDashIndexes      = (/0,1,2/)
3919                  lbid = gsn_create_legend(wks,3,(/"w*u*u*:dz","w*p*:dz","w"+dq+"e:dz"/),lgres)       
3920
3921                  amres = True
3922                  amres@amParallelPosF   = 0.65             
3923                  amres@amOrthogonalPosF = -0.2           
3924                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3925                  overlay(plot(n),plot_wsususodz)
3926                  wsususodz=1
3927               else
3928                  if (prof3d .EQ. 0)then
3929                     varn=varn+1
3930                  end if
3931                  continue   
3932               end if
3933            end if     
3934            n=n+1
3935            if (prof3d .EQ. 0)then
3936               varn=varn+1
3937            end if   
3938         end if
3939      end do
3940   end if
3941   
3942   com_var_avail=new(count_var,string)   
3943
3944   if (combine .EQ. 1) then
3945      co=0     
3946      n_o=0
3947      do varn = 0,dim-1
3948 
3949         check = True
3950     
3951         if (prof3d .EQ. 0) then
3952            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
3953               check = False
3954            end if
3955         else
3956            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "zusi") .OR. isStrSubset( vNam(varn), "zwwi") .OR. isStrSubset( vNam(varn), "x") .OR. isStrSubset( vNam(varn), "xu") .OR. isStrSubset( vNam(varn), "y") .OR. isStrSubset( vNam(varn), "yv") .OR. isStrSubset( vNam(varn), "zu_3d") .OR. isStrSubset( vNam(varn), "zw_3d")) then
3957               check = False
3958            end if
3959         end if
3960
3961         if (var .NE. "all") then         
3962            check = isStrSubset( var,","+vNam(varn)+"," )
3963         end if     
3964
3965         if (check)then
3966           
3967            if (prof3d .EQ. 0) then
3968               if (log_z .EQ. 1) then
3969                  z = f_att->$vNam(varn+1)$(1:dimz-1)
3970               else
3971                  z = f_att->$vNam(varn+1)$               
3972               end if
3973            else
3974               do i=0,b-1           
3975                  if (isStrSubset( a(i),"zu_3d" ))then
3976                     z_v(varn,:) = z_u
3977                     if (log_z .EQ. 1) then
3978                        z = z_v(varn,1:dimz-1)
3979                     else
3980                        z = z_v(varn,:)
3981                     end if
3982                  else
3983                     if (isStrSubset( a(i),"zw_3d" ))then
3984                        z_v(varn,:) = z_w
3985                        if (log_z .EQ. 1) then
3986                           z = z_v(varn,1:dimz-1)
3987                        else
3988                           z = z_v(varn,:)
3989                        end if
3990                     end if                   
3991                  end if
3992               end do           
3993            end if
3994
3995            z=z/norm_z
3996           
3997            com_var_avail(n_o)=vNam(varn)
3998           
3999            com=isStrSubset( c_var,","+vNam(varn)+"," )
4000            if (com)then
4001               co = co+1           
4002               if (n_o .EQ. 1) then
4003                  res@xyDashPattern  = 1                                   
4004               else           
4005                  if (n_o .EQ. 2) then
4006                     res@xyDashPattern  = 2
4007                  else
4008                     res@xyDashPattern  = 0
4009                     res@gsnLeftString  = "Combined Plot of "+c_var
4010                     res@tiXAxisString      = "["+unit(varn)+"]"
4011                     res@gsnRightString     = " "
4012                     if (xs .EQ. -1) then
4013                        res@trXMinF = min(mini)
4014                     else
4015                        res@trXMinF = xs
4016                     end if
4017                     if (xe .EQ. -1) then
4018                        res@trXMaxF = max(maxi)
4019                     else
4020                        res@trXMaxF = xe 
4021                     end if
4022                  end if
4023               end if
4024               label(n_o)=vNam(varn)
4025               color_o(n_o)=237
4026               plot_o(n_o)=gsn_csm_xy(wks,data(varn,:,:),z,res)
4027               n_o=n_o+1
4028            end if
4029            if (prof3d .EQ. 0)then
4030               varn=varn+1
4031            end if           
4032         end if
4033      end do
4034   
4035      if(number_comb .EQ. 2)then
4036         if (co .EQ. 2)then
4037            overlay(plot_o(0),plot_o(1))
4038         else
4039            print(" ")
4040            print("combining is not possible,")
4041            print("'c_var'(= "+c_var+") must include two variables of the general plots = ")
4042            print("- "+com_var_avail)
4043            print("be sure to have one comma before and after the variable")
4044            print(" ")
4045            exit 
4046         end if
4047      end if
4048      if(number_comb .EQ. 3)then
4049         if (co .EQ. 3)then
4050            overlay(plot_o(0),plot_o(1))
4051            overlay(plot_o(0),plot_o(2))
4052         else
4053            print(" ")
4054            print("combining is not possible,")
4055            print("'c_var'(= "+c_var+") must include three variables of the general plots = ")
4056            print("- "+com_var_avail)
4057            print("be sure to have one comma before and after the variable")
4058            print(" ")
4059            exit
4060         end if
4061      end if
4062
4063      ; ***************************************************
4064      ; legend for combined plot
4065      ; ***************************************************
4066     
4067      lgres                    = True
4068      lgMonoDashIndex          = False
4069      lgres@lgDashIndexes      = (/0,1,2/)
4070      lgres@lgLabelFont        = "helvetica"   
4071      lgres@lgLabelFontHeightF = font_size_legend           
4072      lgres@vpWidthF           = 0.12           
4073      lgres@vpHeightF          = 0.1           
4074 
4075      lbid = gsn_create_legend(wks,number_comb,label,lgres)       
4076
4077      amres = True
4078      amres@amParallelPosF   = 0.65                 
4079      amres@amOrthogonalPosF = -0.2           
4080      annoid1 = gsn_add_annotation(plot_o(0),lbid,amres)
4081   
4082      plot(0) = plot_o(0)
4083
4084   end if
4085
4086   ; ***************************************************
4087   ; merge plots onto one page
4088   ; ***************************************************
4089
4090   do m=0,n-1
4091      plot_(m)=plot(n-1-m)
4092   end do
4093
4094   if ((format_out .EQ. "eps" .OR. format_out .EQ. "epsi") .AND. n .gt. no_rows*no_columns) then
4095      gsn_panel(wks,plot_,(/n,1/),resP)
4096      print(" ")
4097      print("Outputs to .eps or .epsi have only one frame")
4098      print(" ")
4099   else   
4100      do i = 0,n-1, no_rows*no_columns
4101         if( (i+no_rows*no_columns) .gt. (n-1)) then
4102            gsn_panel(wks,plot_(i:n-1),(/no_rows,no_columns/),resP)
4103         else
4104            gsn_panel(wks,plot_(i:i+no_rows*no_columns-1),(/no_rows,no_columns/),resP)
4105         end if
4106      end do
4107   end if
4108
4109   print(" ")
4110   print("Output to: " + file_out +"."+ format_out)
4111   print(" ")
4112
4113end
Note: See TracBrowser for help on using the repository browser.