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

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