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

Last change on this file since 310 was 267, checked in by weinreis, 15 years ago

NCL scripts profiles cross_sections ncl_preference and UserGuide? modified

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