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

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