source: palm/trunk/SCRIPTS/NCL/profiles.ncl @ 342

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

Plots of profiles appear in the order specified by the variable var.

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