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

Last change on this file since 218 was 218, checked in by letzel, 15 years ago
  • User can check user parameters and deduce further quantities in user_check_parameters
  • Topography definition according to new user parameter topography_grid_convention (init_grid, modules, user_header, user_init_grid, user_parin)
  • New subdirectory trunk/EXAMPLES with two examples highlighting the topography_grid_convention
File size: 142.8 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_1 = -2
102         end_f_1 = -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_1 = -2
133         end_f_1 = -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_1 = -2
164         end_f_1 = -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_1 = -2
195         end_f_1 = -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_1 = -2
226         end_f_1 = -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
329      else
330         print(" ")
331         print("1st input file: '"+file_in+"' 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   else
801      t_all = f[:]->time(1:)
802   end if
803   nt    = dimsizes(t_all)
804   delta_t=t_all(nt-1)/nt
805
806   ; ****************************************************       
807   ; start of time step and different types of mistakes that could be done
808   ; ****************************************************
809   
810   if (start_time_step .EQ. -1.) then           
811      start_time_step=t_all(0)/3600     
812   else
813      if (start_time_step .GT. t_all(nt-1)/3600)then
814         print(" ")
815         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")
816         print(" ")
817         print("Select another 'start_time_step'")
818         print(" ")
819         exit
820      end if
821      if (start_time_step .LT. t_all(0)/3600)then
822         print(" ")
823         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
824         print(" ")
825         exit
826      end if
827   end if
828
829   do i=0,nt-1   
830      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
831         st=i
832         break
833      end if
834   end do
835   if (.not. isvar("st"))then
836      print(" ")
837      print("'start_time_step' = "+ start_time_step +"h is invalid")
838      print(" ")
839      print("Select another 'start_time_step'")
840      print(" ")
841      exit
842   end if
843   
844   ; ****************************************************
845   ; end of time step and different types of mistakes that could be done
846   ; ****************************************************
847
848   if (end_time_step .EQ. -1.) then             
849      end_time_step = t_all(nt-1)/3600 
850   else
851      if (end_time_step .GT. t_all(nt-1)/3600)then
852         print(" ")
853         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")
854         print(" ")
855         print("Select another 'end_time_step'") 
856         print(" ")
857         exit
858      end if
859      if (end_time_step .LT. start_time_step/3600)then
860         print(" ")
861         print("'end_time_step' = "+ end_time_step +"h is lower than 'start_time_step' = "+start_time_step+"h")
862         print(" ")
863         print("Select another 'start_time_step' or 'end_time_step'")
864         print(" ")
865         exit
866      end if
867   end if
868
869   do i=0,nt-1     
870      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
871         et=i
872         break
873      end if
874   end do
875   if (.not. isvar("et"))then
876      print(" ")
877      print("'end_time_step' = "+ end_time_step +"h is invalid")
878      print(" ")
879      print("Select another 'end_time_step'")
880      print(" ")
881      exit
882   end if
883
884   delete(start_time_step)
885   start_time_step=round(st,3)
886   delete(end_time_step)
887   end_time_step=round(et,3)
888
889   print(" ")
890   print("Output of time steps from "+t_all(start_time_step)/3600+" h = "+t_all(start_time_step)+" s => index = "+start_time_step)
891   print("                     till "+t_all(end_time_step)/3600+" h = "+t_all(end_time_step)+" s => index = "+end_time_step)
892   print(" ")
893
894   ; ****************************************************
895   ; set up legend and colors
896   ; ****************************************************
897   
898   legend_label=new(nt,double)
899   do p=start_time_step,end_time_step
900      if (t_all(p)/3600 .LT. 1) then
901         legend_label(p-start_time_step)=decimalPlaces(t_all(p)/3600,3,True)
902      else
903         legend_label(p-start_time_step)=decimalPlaces(t_all(p)/3600,0,True)
904      end if
905   end do
906   
907   np = end_time_step-start_time_step+1 
908
909   ; ***************************************************
910   ; set up recourses
911   ; ***************************************************
912
913   res                         = True
914   res@gsnDraw                 = False
915   res@gsnFrame                = False
916   res@gsnPaperOrientation     = "portrait"
917   res@gsnPaperWidth           = 8.27
918   res@gsnPaperHeight          = 11.69
919   res@gsnPaperMargin          = 0.79
920   res@txFont                  = "helvetica"
921   res@tiMainFont              = "helvetica"
922   res@tiXAxisFont             = "helvetica"
923   res@tiYAxisFont             = "helvetica"
924   res@tmXBLabelFont           = "helvetica"
925   res@tmYLLabelFont           = "helvetica"
926   res@lgLabelFont             = "helvetica"
927   res@tmLabelAutoStride       = True
928   res@pmLegendDisplayMode     = "Always"
929   res@pmLegendSide            = "Top"
930   res@xyExplicitLegendLabels  = legend_label
931   res@pmLegendParallelPosF    = 1.15
932   res@pmLegendOrthogonalPosF  = -1.0
933   res@pmLegendWidthF          = 0.12
934   res@pmLegendHeightF         = 0.04*(end_time_step-start_time_step+1)
935   res@lgLabelFontHeightF     = font_size
936   res@lgTitleString      = "Time [h]"
937   res@lgTitleFontHeightF = font_size   
938   res@txFontHeightF      = font_size
939   res@tiXAxisFontHeightF = font_size
940   res@tiYAxisFontHeightF = font_size
941   res@tmXBLabelFontHeightF = font_size
942   res@tmYLLabelFontHeightF = font_size
943   res@tiXAxisString      = " "
944   if ( black .eq. 0 ) then 
945      res@xyLineColors = ispan(2,237,235/np)
946   end if
947   if (norm_z .EQ. 1)then
948      res@tiYAxisString      = "Height [m]"
949   else   
950      res@tiYAxisString      = "Height / "+norm_z+" [m]"
951   end if
952   
953   if (log_z .EQ. 1) then
954      res@trYLog = True
955   end if
956
957   if (dash .EQ. 0 ) then
958      res@xyMonoDashPattern       = True
959   else
960      if (no_files .GT. 1)
961         res@xyMonoDashPattern       = True   
962         print(" ")
963         print("If you use more than one file, patterns for different timesteps cannot be used")
964         print(" ")
965      end if       
966   end if
967   
968   res@tmXBMinorPerMajor = 4
969   res@tmYLMinorPerMajor = 4
970
971   resP                        = True
972   resP@txFont                 = "helvetica"
973   resP@txString               = f_att@title
974   resP@txFuncCode             = "~"
975   resP@txFontHeightF          = 0.015
976
977   ; ***************************************************
978   ; set up graphics for plot
979   ; ***************************************************
980
981   if (combine .EQ. 1) then
982      plot_o = new(number_comb,graphic)   
983      label=new(number_comb,string)
984      color_o=new(number_comb,integer)
985      mini=new(number_comb,float)
986      maxi=new(number_comb,float)
987   end if
988 
989   wks=gsn_open_wks(format_out,file_out)
990   gsn_define_colormap(wks,"rainbow+white")
991
992   ; ***************************************************
993   ; set up minimum and maximum height
994   ; ***************************************************
995
996   if (log_z .EQ. 1)then
997      if (min_z .EQ. -1)then
998         if (isvar("z_u"))then
999            min_z=z_u(1)
1000         else
1001            min_z=z_w(1)
1002         end if       
1003      else
1004         if (isvar("z_w"))then
1005            if (min_z .GE. max(z_w) ) then
1006               print(" ")
1007               print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_w)+")")
1008               print(" ")
1009               exit
1010            end if         
1011         else
1012            if (min_z .GE. max(z_u) ) then
1013               print(" ")
1014               print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_u)+")")
1015               print(" ")
1016               exit
1017            end if
1018         end if
1019         if (isvar("z_u"))then   
1020            if (min_z .LT. z_u(1) ) then
1021               print(" ")
1022               print("Begin height 'min_z' at least at level k=1 (="+z_u(1)+"m) due to the logarithmic scale of the y-axis")
1023               print(" ")
1024               exit
1025            end if
1026         else
1027            if (min_z .LT. z_w(1) ) then
1028               print(" ")
1029               print("Begin height 'min_z' at least at level k=1 (="+z_w(1)+"m) due to the logarithmic scale of the y-axis")
1030               print(" ")
1031               exit
1032            end if   
1033         end if
1034      end if
1035   else
1036      if (isvar("z_u"))then
1037         if (min_z .EQ. -1)then
1038            min_z=z_u(0)
1039         end if
1040      else
1041         if (min_z .EQ. -1)then
1042            min_z=z_w(0)
1043         end if   
1044      end if
1045      if (isvar("z_w"))then
1046         if (min_z .GE. max(z_w) ) then
1047            print(" ")
1048            print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_w)+")")
1049            print(" ")
1050            exit
1051         end if
1052      else
1053         if (min_z .EQ. -1)then
1054            min_z=z_u(0)
1055         end if
1056         if (min_z .GE. max(z_u) ) then
1057            print(" ")
1058            print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_u)+")")
1059            print(" ")
1060            exit
1061         end if
1062      end if
1063   end if
1064   
1065   if (isvar("z_w"))then
1066      if (max_z .EQ. -1)then
1067         max_z=max(z_w)
1068      end if
1069   else
1070      if (max_z .EQ. -1)then
1071         max_z=max(z_u)
1072      end if   
1073   end if
1074   
1075   if (isvar("z_w"))then
1076      if (max_z .GT. max(z_w) ) then
1077         print(" ")
1078         print("Maximum of height ('max_z'="+max_z+") is greater than available heights (="+max(z_w)+")")
1079         print(" ")
1080         exit
1081      end if
1082   end if
1083
1084   min_z=min_z/norm_z
1085   max_z=max_z/norm_z
1086
1087   ; ***************************************************
1088   ; read data and create plots
1089   ; ***************************************************
1090     
1091   do ti = start_time_step, end_time_step
1092      if( t_all(ti) .lt. 10^36) then
1093         start_time_step = ti
1094         break
1095      end if
1096   end do 
1097   
1098   if (log_z .EQ. 1) then
1099      data   = new((/dim,(end_time_step-start_time_step)+1,dimz-1/),float)
1100      data_0 = new((/(end_time_step-start_time_step)+1,dimz-1/),float)
1101      data_0 = 0.1
1102      t      = new((/(end_time_step-start_time_step)+1,dimz-1/),float)
1103      t      = 0.0
1104      unit   = new(dim,string)
1105      if (isvar("z_u"))then
1106         if (typeof(z_u) .EQ. "double")then
1107            z_v    = new((/dim,dimz/),double)
1108            z_     = new((/dim,dimz-1/),double)
1109         else
1110            if (typeof(z_u) .EQ. "float")then
1111               z_v    = new((/dim,dimz/),float)
1112               z_     = new((/dim,dimz-1/),float)
1113            end if
1114         end if
1115      else
1116         if (isvar("z_w"))then
1117            if (typeof(z_w) .EQ. "double")then
1118               z_v    = new((/dim,dimz/),double)
1119               z_     = new((/dim,dimz-1/),double)
1120            else
1121               if (typeof(z_w) .EQ. "float")then
1122                  z_v    = new((/dim,dimz/),float)
1123                  z_     = new((/dim,dimz-1/),float)
1124               end if
1125            end if
1126         end if
1127      end if
1128   else
1129      data   = new((/dim,(end_time_step-start_time_step)+1,dimz/),float)
1130      data_0 = new((/(end_time_step-start_time_step)+1,dimz/),float)
1131      data_0 = 0.0
1132      t      = new((/(end_time_step-start_time_step)+1,dimz/),float)
1133      t      = 0.0
1134      unit   = new(dim,string)
1135      if (isvar("z_u"))then
1136         if (typeof(z_u) .EQ. "double")then
1137            z_v    = new((/dim,dimz/),double)
1138            z_     = new((/dim,dimz/),double)
1139         else
1140            if (typeof(z_u) .EQ. "float")then
1141               z_v    = new((/dim,dimz/),float)
1142               z_     = new((/dim,dimz/),float)
1143            end if
1144         end if
1145      else
1146         if (isvar("z_w"))then
1147            if (typeof(z_w) .EQ. "double")then
1148               z_v    = new((/dim,dimz/),double)
1149               z_     = new((/dim,dimz/),double)
1150            else
1151               if (typeof(z_w) .EQ. "float")then
1152                  z_v    = new((/dim,dimz/),float)
1153                  z_     = new((/dim,dimz/),float)
1154               end if
1155            end if
1156         end if
1157      end if
1158   end if
1159
1160   end if
1161   ;------------------------------------------------------ above steps only for first file
1162
1163   ; ***************************************************
1164   ; indicate plot number
1165   ; ***************************************************
1166   
1167   if (combine .EQ. 1) then
1168      n = 1
1169   else
1170      n = 0
1171   end if
1172
1173   if (over .EQ. 1) then
1174      plot_u         = gsn_csm_xy(wks,t,data_0(:,:),res)
1175      miniu = 1.E27
1176      maxiu =-1.E27
1177      plot_v         = gsn_csm_xy(wks,t,data_0(:,:),res)
1178      miniv = 1.E27
1179      maxiv =-1.E27
1180      plot_w         = gsn_csm_xy(wks,t,data_0(:,:),res)
1181      miniw = 1.E27
1182      maxiw =-1.E27
1183      plot_pt        = gsn_csm_xy(wks,t,data_0(:,:),res)
1184      minipt = 1.E27
1185      maxipt =-1.E27
1186      plot_vpt       = gsn_csm_xy(wks,t,data_0(:,:),res)
1187      minivpt = 1.E27
1188      maxivpt =-1.E27
1189      plot_lpt       = gsn_csm_xy(wks,t,data_0(:,:),res)
1190      minilpt = 1.E27
1191      maxilpt =-1.E27
1192      plot_q         = gsn_csm_xy(wks,t,data_0(:,:),res)
1193      miniq = 1.E27
1194      maxiq =-1.E27
1195      plot_qv        = gsn_csm_xy(wks,t,data_0(:,:),res)
1196      miniqv = 1.E27
1197      maxiqv =-1.E27
1198      plot_ql        = gsn_csm_xy(wks,t,data_0(:,:),res)
1199      miniql = 1.E27
1200      maxiql =-1.E27
1201      plot_rho       = gsn_csm_xy(wks,t,data_0(:,:),res)
1202      plot_s         = gsn_csm_xy(wks,t,data_0(:,:),res)
1203      plot_sa        = gsn_csm_xy(wks,t,data_0(:,:),res)
1204      plot_e         = gsn_csm_xy(wks,t,data_0(:,:),res)
1205      minie = 1.E27
1206      maxie =-1.E27
1207      plot_es        = gsn_csm_xy(wks,t,data_0(:,:),res)
1208      minie = 1.E27
1209      maxie =-1.E27
1210      plot_km        = gsn_csm_xy(wks,t,data_0(:,:),res)
1211      minie = 1.E27
1212      maxie =-1.E27
1213      plot_kh        = gsn_csm_xy(wks,t,data_0(:,:),res)
1214      minie = 1.E27
1215      maxie =-1.E27
1216      plot_l         = gsn_csm_xy(wks,t,data_0(:,:),res)     
1217      plot_wpup      = gsn_csm_xy(wks,t,data_0(:,:),res)
1218      miniwpup = 1.E27
1219      maxiwpup =-1.E27
1220      plot_wsus      = gsn_csm_xy(wks,t,data_0(:,:),res)
1221      miniwsus = 1.E27
1222      maxiwsus =-1.E27
1223      plot_wu        = gsn_csm_xy(wks,t,data_0(:,:),res)
1224      miniwu = 1.E27
1225      maxiwu =-1.E27
1226      plot_wpvp      = gsn_csm_xy(wks,t,data_0(:,:),res)
1227      miniwpvp = 1.E27
1228      maxiwpvp =-1.E27
1229      plot_wsvs      = gsn_csm_xy(wks,t,data_0(:,:),res)
1230      miniwsvs = 1.E27
1231      maxiwsvs =-1.E27
1232      plot_wv        = gsn_csm_xy(wks,t,data_0(:,:),res)
1233      miniwv = 1.E27
1234      maxiwv =-1.E27
1235      plot_wpptp     = gsn_csm_xy(wks,t,data_0(:,:),res)
1236      miniwpptp = 1.E27
1237      maxiwpptp =-1.E27
1238      plot_wspts     = gsn_csm_xy(wks,t,data_0(:,:),res)
1239      miniwspts = 1.E27
1240      maxiwspts =-1.E27
1241      plot_wpt       = gsn_csm_xy(wks,t,data_0(:,:),res)
1242      miniwpt = 1.E27
1243      maxiwpt =-1.E27
1244      plot_wsptsBC   = gsn_csm_xy(wks,t,data_0(:,:),res)
1245      miniwsptsBC = 1.E27
1246      maxiwsptsBC =-1.E27
1247      plot_wptBC     = gsn_csm_xy(wks,t,data_0(:,:),res)
1248      miniwptBC = 1.E27
1249      maxiwptBC =-1.E27
1250      plot_wpvptp    = gsn_csm_xy(wks,t,data_0(:,:),res)
1251      miniwpvptp = 1.E27
1252      maxiwpvptp =-1.E27
1253      plot_wsvpts    = gsn_csm_xy(wks,t,data_0(:,:),res)
1254      miniwsvpts = 1.E27
1255      maxiewsvpts=-1.E27
1256      plot_wvpt      = gsn_csm_xy(wks,t,data_0(:,:),res)
1257      miniwvpt = 1.E27
1258      maxiwvpt =-1.E27
1259      plot_wpqp      = gsn_csm_xy(wks,t,data_0(:,:),res)
1260      miniwpqp = 1.E27
1261      maxiwpqp =-1.E27
1262      plot_wsqs      = gsn_csm_xy(wks,t,data_0(:,:),res)
1263      miniwsqs = 1.E27
1264      maxiwsqs =-1.E27
1265      plot_wq        = gsn_csm_xy(wks,t,data_0(:,:),res)
1266      miniwq = 1.E27
1267      maxiwq =-1.E27
1268      plot_wpqvp     = gsn_csm_xy(wks,t,data_0(:,:),res)
1269      miniwpqvp = 1.E27
1270      maxiwpqvp =-1.E27
1271      plot_wsqvs     = gsn_csm_xy(wks,t,data_0(:,:),res)
1272      miniwsqvs = 1.E27
1273      maxiwsqvs =-1.E27
1274      plot_wqv       = gsn_csm_xy(wks,t,data_0(:,:),res)
1275      miniwqv = 1.E27
1276      maxiwqv =-1.E27
1277      plot_wpsp      = gsn_csm_xy(wks,t,data_0(:,:),res)
1278      miniwpsp = 1.E27
1279      maxiwpsp =-1.E27
1280      plot_wsss      = gsn_csm_xy(wks,t,data_0(:,:),res)
1281      miniwsss = 1.E27
1282      maxiwsss =-1.E27
1283      plot_ws        = gsn_csm_xy(wks,t,data_0(:,:),res)
1284      miniws = 1.E27
1285      maxiws =-1.E27
1286      plot_wpsap     = gsn_csm_xy(wks,t,data_0(:,:),res)
1287      miniwpsap = 1.E27
1288      maxiwpsap =-1.E27
1289      plot_wssas     = gsn_csm_xy(wks,t,data_0(:,:),res)
1290      miniwssas = 1.E27
1291      maxiwssas =-1.E27
1292      plot_wsa       = gsn_csm_xy(wks,t,data_0(:,:),res)
1293      miniwsa = 1.E27
1294      maxiwsa =-1.E27
1295      plot_wses      = gsn_csm_xy(wks,t,data_0(:,:),res)
1296      plot_us2       = gsn_csm_xy(wks,t,data_0(:,:),res)
1297      minius2 = 1.E27
1298      maxius2 =-1.E27
1299      plot_vs2       = gsn_csm_xy(wks,t,data_0(:,:),res)
1300      minivs2 = 1.E27
1301      maxivs2 =-1.E27
1302      plot_ws2       = gsn_csm_xy(wks,t,data_0(:,:),res)
1303      miniws2 = 1.E27
1304      maxiws2 =-1.E27
1305      plot_pts2      = gsn_csm_xy(wks,t,data_0(:,:),res)
1306      plot_ws3       = gsn_csm_xy(wks,t,data_0(:,:),res)
1307      plot_Sw        = gsn_csm_xy(wks,t,data_0(:,:),res)
1308      plot_ws2pts    = gsn_csm_xy(wks,t,data_0(:,:),res)
1309      plot_wspts2    = gsn_csm_xy(wks,t,data_0(:,:),res)
1310      plot_wsususodz = gsn_csm_xy(wks,t,data_0(:,:),res)
1311      miniwsususodz = 1.E27
1312      maxiwsususodz =-1.E27
1313      plot_wspsodz   = gsn_csm_xy(wks,t,data_0(:,:),res)
1314      miniwspsodz = 1.E27
1315      maxiwspsodz =-1.E27
1316      plot_wpeodz    = gsn_csm_xy(wks,t,data_0(:,:),res)
1317      miniwpeodz = 1.E27
1318      maxiwpeodz =-1.E27
1319   end if
1320
1321   if (prof3d .EQ. 1)then
1322
1323   if (end_x .EQ. -1) then
1324      end_x=dimx-2
1325   end if
1326   if (end_y .EQ. -1)then
1327      end_y=dimy-2
1328   end if
1329   if (start_x .LT. 0)then
1330      print(" ")
1331      print("'start_x' is lower than 0 and set to 0")
1332      print(" ")
1333      start_x=0
1334   end if
1335   if (start_x .GT. dimx-1)then
1336      print(" ")
1337      print("'start_x' is greater than available x-range and set to maximum of x-range (excluding ghostpoint)")
1338      print(" ")
1339      start_x=dimx-2
1340   end if
1341   if (end_x .EQ. dimx-1)then
1342      print(" ")
1343      print("'end_x' = "+end_x+" and includes the ghostpoint")
1344      print(" ")
1345   end if
1346   if (end_x .GT. dimx-1)then
1347      print(" ")
1348      print("'end_x' = "+end_x+" is greater than available x-range and set to maximum of x-range (excluding ghostpoint)")
1349      print(" ")
1350      end_x=dimx-2
1351   end if
1352   if (end_x .LT. start_x)then
1353      print(" ")
1354      print("'end_x' = "+end_x+" is lower than 'start_x' = "+start_x+" and set to maximum of x-range (excluding ghostpoint)")
1355      print(" ")
1356      end_x=dimx-2
1357   end if
1358   if (start_y .LT. 0)then
1359      print(" ")
1360      print("'start_y' is lower than 0 and set to 0")
1361      print(" ")
1362      start_y=0
1363   end if
1364   if (start_y .GT. dimy-1)then
1365      print(" ")
1366      print("'start_y' is greater than available y-range and set to maximum of y-range (excluding ghostpoint)")
1367      print(" ")
1368      start_x=dimy-2
1369   end if
1370   if (end_y .EQ. dimy-1)then
1371      print(" ")
1372      print("'end_y' = "+end_y+" and includes the ghostpoint")
1373      print(" ")
1374   end if
1375   if (end_y .GT. dimy-1)then
1376      print(" ")
1377      print("'end_y' = "+end_y+" is greater than available y-range and set to maximum of y-range (excluding ghostpoint)")
1378      print(" ")
1379      end_x=dimy-2
1380   end if
1381   if (end_y .LT. start_y)then
1382      print(" ")
1383      print("'end_y' = "+end_y+" is lower than 'start_y' = "+start_y+" and set to maximum of y-range (excluding ghostpoint)")
1384      print(" ")
1385      end_y=dimy-2
1386   end if
1387   
1388   end if
1389 
1390   n_o=0
1391   count_var=0
1392
1393   do varn = 0,dim-1
1394
1395      check = True
1396     
1397      if (prof3d .EQ. 0) then
1398         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
1399            check = False
1400         end if
1401      else
1402         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
1403            check = False
1404         end if
1405      end if
1406
1407      if (var .NE. "all") then
1408         check = isStrSubset( var,","+vNam(varn)+"," )
1409      end if
1410
1411      if (combine .EQ. 1) then         
1412         com=isStrSubset(c_var,","+vNam(varn)+"," )     
1413         if (com) then     
1414            if (prof3d .EQ. 0) then
1415               temp = f[:]->$vNam(varn)$(1:,:)
1416               temp_att = f_att->$vNam(varn)$
1417               if (log_z .EQ. 1) then
1418                  data(varn,:,:) = temp(start_time_step:end_time_step,1:dimz-1)
1419               else
1420                  data(varn,:,:) = temp(start_time_step:end_time_step,0:dimz-1)
1421               end if
1422            else
1423               if (log_z .EQ. 1) then
1424                  do i=1,dimz-1
1425                     do j=start_time_step,end_time_step
1426                        temp= f[:]->$vNam(varn)$
1427                        temp_att = f_att->$vNam(varn)$
1428                        data_temp = temp(j,i,start_y:end_y,start_x:end_x)
1429                        data(varn,j-start_time_step,i-1) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1430                     end do
1431                  end do
1432               else
1433                  do i=0,dimz-1
1434                     do j=start_time_step,end_time_step
1435                        temp= f[:]->$vNam(varn)$
1436                        temp_att = f_att->$vNam(varn)$
1437                        data_temp = temp(j,i,start_y:end_y,start_x:end_x)
1438                        data(varn,j-start_time_step,i) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1439                     end do
1440                  end do
1441               end if
1442               print(" ")
1443               print("Variable for combine '"+vNam(varn)+"' is read")
1444               print(" ")
1445            end if                 
1446            unit(varn) = temp_att@units
1447            if (n_o .GT. number_comb-1) then
1448               print(" ")
1449               print("Set 'number_comb' to the number of overlaying variables ('c_var' = "+c_var+")")
1450               print(" ")
1451               exit
1452            end if
1453            mini(n_o)=min(data(varn,:,:))
1454            maxi(n_o)=max(data(varn,:,:))
1455            n_o=n_o+1
1456         end if
1457      end if
1458
1459      if(check) then
1460         if (isStrSubset(vNam(varn),"_0" ))then
1461            print(" ")
1462            print("If you have Outputs of statistic regions you cannot overlay variables; 'over' is set to 0")
1463            print(" ")
1464            over = 0
1465         end if
1466       
1467         count_var=count_var+1
1468
1469         if (prof3d .EQ. 0) then
1470            temp = f[:]->$vNam(varn)$(1:,:)
1471            temp_att = f_att->$vNam(varn)$
1472         else
1473             if (log_z .EQ. 1) then
1474               do i=1,dimz-1
1475                  do j=start_time_step,end_time_step
1476                     temp= f[:]->$vNam(varn)$(j,i,start_y:end_y,start_x:end_x)
1477                     temp_att = f_att->$vNam(varn)$
1478                     data_temp = temp(j,i,start_y:end_y,start_x:end_x)
1479                     data(varn,j-start_time_step,i-1) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1480                  end do
1481               end do
1482            else
1483               do i=0,dimz-1
1484                  do j=start_time_step,end_time_step
1485                     temp= f[:]->$vNam(varn)$;(j,i,start_y:end_y,start_x:end_x)
1486                     temp_att = f_att->$vNam(varn)$
1487                     data_temp = temp(j,i,start_y:end_y,start_x:end_x)
1488                     data_temp!0 = "t"
1489                     data_temp!1 = "z"
1490                     data(varn,j-start_time_step,i) = dim_avg_Wrap(dim_avg_Wrap(data_temp))
1491                  end do
1492               end do
1493            end if
1494            print(" ")
1495            print("Variable '"+vNam(varn)+"' is read")
1496            print(" ")
1497            unit(varn) = temp_att@units
1498            a=getvardims(temp_att)
1499            b=dimsizes(a)
1500         end if
1501
1502         if (prof3d .EQ. 0) then
1503            if (log_z .EQ. 1) then
1504               z = f_att->$vNam(varn+1)$(1:dimz-1)
1505               unit(varn) = temp_att@units
1506               data(varn,:,:) = temp(start_time_step:end_time_step,1:dimz-1)
1507            else
1508               z = f_att->$vNam(varn+1)$
1509               unit(varn) = temp_att@units
1510               data(varn,:,:) = temp(start_time_step:end_time_step,:)
1511            end if
1512         else
1513            do i=0,b-1           
1514               if (isStrSubset( a(i),"zu_3d" ))then
1515                  z_v(varn,:) = z_u
1516                  if (log_z .EQ. 1) then
1517                     z = z_v(varn,1:dimz-1)
1518                  else
1519                     z = z_v(varn,:)
1520                  end if
1521               else
1522                  if (isStrSubset( a(i),"zw_3d" ))then
1523                     z_v(varn,:) = z_w
1524                     if (log_z .EQ. 1) then
1525                        z = z_v(varn,1:dimz-1)
1526                     else
1527                        z = z_v(varn,:)
1528                     end if
1529                  end if                   
1530               end if
1531            end do           
1532         end if
1533
1534         if (data(varn,0,0) .GT. 1.E35) then
1535            data(varn,0,:) = data(varn,1,:)
1536         end if
1537         if (nof .EQ. 0) then
1538            z_(n,:)=z/norm_z
1539            z    = z_(n,:)
1540         else
1541            z=z/norm_z
1542         end if
1543   
1544         if (over .EQ. 0) then 
1545            res@gsnLeftString      = vNam(varn)
1546            res@tiXAxisString      = "["+unit(varn)+"]"
1547            res@gsnRightString     = " "
1548            res@trYMinF            = min_z
1549            res@trYMaxF            = max_z
1550            if (xs .EQ. -1) then
1551               res@trXMinF            = min(data(varn,:,:))
1552            else
1553               res@trXMinF            = xs
1554            end if
1555            if (xe .EQ. -1) then
1556               res@trXMaxF            = max(data(varn,:,:))
1557            else
1558               res@trXMaxF            = xe 
1559            end if         
1560            plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
1561         end if       
1562         
1563            if (vNam(varn) .EQ. "u") then
1564               miniu=min(data(varn,:,:))
1565               maxiu=max(data(varn,:,:))
1566               if (over .EQ. 1) then
1567                  res@xyDashPattern  = 0
1568                  plot_u = gsn_csm_xy(wks,data(varn,:,:),z,res)
1569               else
1570                  res@gsnLeftString      = vNam(varn)
1571                  res@tiXAxisString      = "["+unit(varn)+"]"
1572                  res@gsnRightString     = " "                 
1573                  if (xs .EQ. -1) then
1574                     res@trXMinF            = miniu
1575                  else
1576                     res@trXMinF            = xs
1577                  end if
1578                  if (xe .EQ. -1) then       
1579                     res@trXMaxF            = maxiu
1580                  else
1581                     res@trXMaxF            = xe 
1582                  end if               
1583                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
1584               end if
1585            end if
1586            if (vNam(varn) .EQ. "v") then
1587               miniv=min(data(varn,:,:))
1588               maxiv=max(data(varn,:,:))
1589               if (over .EQ. 1) then
1590                  res@xyDashPattern  = 1
1591                  plot_v = gsn_csm_xy(wks,data(varn,:,:),z,res)
1592               else
1593                  res@gsnLeftString      = vNam(varn)
1594                  res@tiXAxisString      = "["+unit(varn)+"]"
1595                  res@gsnRightString     = " "                 
1596                  if (xs .EQ. -1) then
1597                     res@trXMinF            = miniv
1598                  else
1599                     res@trXMinF            = xs
1600                  end if
1601                  if (xe .EQ. -1) then
1602                     res@trXMaxF            = maxiv
1603                  else
1604                     res@trXMaxF            = xe 
1605                  end if               
1606                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1607               end if 
1608            end if
1609            if (vNam(varn) .EQ. "w") then
1610               miniw=min(data(varn,:,:))
1611               maxiw=max(data(varn,:,:))
1612               if (over .EQ. 1) then
1613                  res@xyDashPattern  = 2
1614                  plot_w = gsn_csm_xy(wks,data(varn,:,:),z,res)
1615               else
1616                  res@gsnLeftString      = vNam(varn)
1617                  res@tiXAxisString      = "["+unit(varn)+"]"
1618                  res@gsnRightString     = " "
1619                  if (xs .EQ. -1) then
1620                     res@trXMinF            = miniw
1621                  else
1622                     res@trXMinF            = xs
1623                  end if
1624                  if (xe .EQ. -1) then
1625                     res@trXMaxF            = maxiw
1626                  else
1627                     res@trXMaxF            = xe 
1628                  end if           
1629                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1630               end if   
1631            end if
1632
1633            if (vNam(varn) .EQ. "pt") then
1634               minipt=min(data(varn,:,:))
1635               maxipt=max(data(varn,:,:))
1636               if (over .EQ. 1) then
1637                  res@xyDashPattern  = 0
1638                  plot_pt = gsn_csm_xy(wks,data(varn,:,:),z,res)
1639               else
1640                  res@gsnLeftString      = vNam(varn)
1641                  res@tiXAxisString      = "["+unit(varn)+"]"
1642                  res@gsnRightString     = " "
1643                  if (xs .EQ. -1) then
1644                     res@trXMinF            = minipt
1645                  else
1646                     res@trXMinF            = xs
1647                  end if
1648                  if (xe .EQ. -1) then       
1649                     res@trXMaxF            = maxipt
1650                  else
1651                     res@trXMaxF            = xe 
1652                  end if
1653                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1654               end if 
1655            end if
1656            if (vNam(varn) .EQ. "vpt") then
1657               minivpt=min(data(varn,:,:))
1658               maxivpt=max(data(varn,:,:))
1659               if (over .EQ. 1) then
1660                  res@xyDashPattern  = 1
1661                  plot_vpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
1662               else
1663                  res@gsnLeftString      = vNam(varn)
1664                  res@tiXAxisString      = "["+unit(varn)+"]"
1665                  res@gsnRightString     = " "
1666                  if (xs .EQ. -1) then
1667                     res@trXMinF            = minivpt
1668                  else
1669                     res@trXMinF            = xs
1670                  end if
1671                  if (xe .EQ. -1) then       
1672                     res@trXMaxF            = maxivpt
1673                  else
1674                     res@trXMaxF            = xe 
1675                  end if
1676                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1677               end if
1678            end if
1679            if (vNam(varn) .EQ. "lpt") then
1680               minilpt=min(data(varn,:,:))
1681               maxilpt=max(data(varn,:,:))
1682               if (over .EQ. 1) then
1683                  res@xyDashPattern  = 2
1684                  plot_lpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
1685               else
1686                  res@gsnLeftString      = vNam(varn)
1687                  res@tiXAxisString      = "["+unit(varn)+"]"
1688                  res@gsnRightString     = " "
1689                  if (xs .EQ. -1) then
1690                     res@trXMinF            = minilpt
1691                  else
1692                     res@trXMinF            = xs
1693                  end if
1694                  if (xe .EQ. -1) then       
1695                     res@trXMaxF            = maxilpt
1696                  else
1697                     res@trXMaxF            = xe 
1698                  end if
1699                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1700               end if
1701            end if
1702
1703            if (vNam(varn) .EQ. "q") then
1704               miniq=min(data(varn,:,:))
1705               maxiq=max(data(varn,:,:))
1706               if (over .EQ. 1) then
1707                  res@xyDashPattern  = 0
1708                  plot_q = gsn_csm_xy(wks,data(varn,:,:),z,res)
1709               else
1710                  res@gsnLeftString      = vNam(varn)
1711                  res@tiXAxisString      = "["+unit(varn)+"]"
1712                  res@gsnRightString     = " "
1713                  if (xs .EQ. -1) then
1714                     res@trXMinF            = minilq
1715                  else
1716                     res@trXMinF            = xs
1717                  end if
1718                  if (xe .EQ. -1) then       
1719                     res@trXMaxF            = maxilq
1720                  else
1721                     res@trXMaxF            = xe 
1722                  end if
1723                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1724               end if
1725            end if
1726            if (vNam(varn) .EQ. "qv") then
1727               miniqv=min(data(varn,:,:))
1728               maxiqv=max(data(varn,:,:))
1729               if (over .EQ. 1) then
1730                  res@xyDashPattern  = 1
1731                  plot_qv = gsn_csm_xy(wks,data(varn,:,:),z,res)
1732               else
1733                  res@gsnLeftString      = vNam(varn)
1734                  res@tiXAxisString      = "["+unit(varn)+"]"
1735                  res@gsnRightString     = " "
1736                  if (xs .EQ. -1) then
1737                     res@trXMinF            = minilqv
1738                  else
1739                     res@trXMinF            = xs
1740                  end if
1741                  if (xe .EQ. -1) then       
1742                     res@trXMaxF            = maxilqv
1743                  else
1744                     res@trXMaxF            = xe 
1745                  end if
1746                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1747               end if
1748            end if
1749            if (vNam(varn) .EQ. "ql") then
1750               miniql=min(data(varn,:,:))
1751               maxiql=max(data(varn,:,:))
1752               if (over .EQ. 1) then
1753                  res@xyDashPattern  = 2
1754                  plot_ql = gsn_csm_xy(wks,data(varn,:,:),z,res)
1755               else
1756                  res@gsnLeftString      = vNam(varn)
1757                  res@tiXAxisString      = "["+unit(varn)+"]"
1758                  res@gsnRightString     = " "
1759                  if (xs .EQ. -1) then
1760                     res@trXMinF            = miniql
1761                  else
1762                     res@trXMinF            = xs
1763                  end if
1764                  if (xe .EQ. -1) then       
1765                     res@trXMaxF            = maxiql
1766                  else
1767                     res@trXMaxF            = xe 
1768                  end if
1769                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1770               end if
1771            end if
1772
1773            if (vNam(varn) .EQ. "e") then
1774               minie=min(data(varn,:,:))
1775               maxie=max(data(varn,:,:))
1776               if (over .EQ. 1) then
1777                  res@xyDashPattern  = 0
1778                  plot_e = gsn_csm_xy(wks,data(varn,:,:),z,res)
1779               else
1780                  res@gsnLeftString      = vNam(varn)
1781                  res@tiXAxisString      = "["+unit(varn)+"]"
1782                  res@gsnRightString     = " "
1783                  if (xs .EQ. -1) then
1784                     res@trXMinF            = minie
1785                  else
1786                     res@trXMinF            = xs
1787                  end if
1788                  if (xe .EQ. -1) then       
1789                     res@trXMaxF            = maxie
1790                  else
1791                     res@trXMaxF            = xe 
1792                  end if
1793                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1794               end if
1795            end if
1796            if (vNam(varn) .EQ. "es") then
1797               minies=min(data(varn,:,:))
1798               maxies=max(data(varn,:,:))
1799               if (over .EQ. 1) then
1800                  res@xyDashPattern  = 1
1801                  plot_es = gsn_csm_xy(wks,data(varn,:,:),z,res)
1802               else
1803                  res@gsnLeftString      = vNam(varn)
1804                  res@tiXAxisString      = "["+unit(varn)+"]"
1805                  res@gsnRightString     = " "
1806                  if (xs .EQ. -1) then
1807                     res@trXMinF            = minies
1808                  else
1809                     res@trXMinF            = xs
1810                  end if
1811                  if (xe .EQ. -1) then       
1812                     res@trXMaxF            = maxies
1813                  else
1814                     res@trXMaxF            = xe 
1815                  end if
1816                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1817               end if
1818            end if
1819
1820            if (vNam(varn) .EQ. "km") then
1821               minikm=min(data(varn,:,:))
1822               maxikm=max(data(varn,:,:))
1823               if (over .EQ. 1) then
1824                  res@xyDashPattern  = 0
1825                  plot_km = gsn_csm_xy(wks,data(varn,:,:),z,res)
1826               else
1827                  res@gsnLeftString      = vNam(varn)
1828                  res@tiXAxisString      = "["+unit(varn)+"]"
1829                  res@gsnRightString     = " "
1830                  if (xs .EQ. -1) then
1831                     res@trXMinF            = minikm
1832                  else
1833                     res@trXMinF            = xs
1834                  end if
1835                  if (xe .EQ. -1) then       
1836                     res@trXMaxF            = maxikm
1837                  else
1838                     res@trXMaxF            = xe 
1839                  end if
1840                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1841               end if
1842            end if
1843            if (vNam(varn) .EQ. "kh") then
1844               minikh=min(data(varn,:,:))
1845               maxikh=max(data(varn,:,:))
1846               if (over .EQ. 1) then
1847                  res@xyDashPattern  = 1
1848                  plot_kh = gsn_csm_xy(wks,data(varn,:,:),z,res)
1849               else
1850                  res@gsnLeftString      = vNam(varn)
1851                  res@tiXAxisString      = "["+unit(varn)+"]"
1852                  res@gsnRightString     = " "
1853                  if (xs .EQ. -1) then
1854                     res@trXMinF            = minikh
1855                  else
1856                     res@trXMinF            = xs
1857                  end if
1858                  if (xe .EQ. -1) then       
1859                     res@trXMaxF            = maxikh
1860                  else
1861                     res@trXMaxF            = xe 
1862                  end if
1863                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1864               end if
1865            end if
1866
1867            if (vNam(varn) .EQ. "wpup") then
1868               miniwpup=min(data(varn,:,:))
1869               maxiwpup=max(data(varn,:,:))
1870               if (over .EQ. 1) then
1871                  res@xyDashPattern  = 0
1872                  plot_wpup = gsn_csm_xy(wks,data(varn,:,:),z,res)
1873               else
1874                  res@gsnLeftString      = vNam(varn)
1875                  res@tiXAxisString      = "["+unit(varn)+"]"
1876                  res@gsnRightString     = " "
1877                  if (xs .EQ. -1) then
1878                     res@trXMinF            = miniwpup
1879                  else
1880                     res@trXMinF            = xs
1881                  end if
1882                  if (xe .EQ. -1) then       
1883                     res@trXMaxF            = maxiwpup
1884                  else
1885                     res@trXMaxF            = xe 
1886                  end if
1887                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1888               end if
1889            end if
1890            if (vNam(varn) .EQ. "wsus") then
1891               miniwsus=min(data(varn,:,:))
1892               maxiwsus=max(data(varn,:,:))
1893               if (over .EQ. 1) then
1894                  res@xyDashPattern  = 1
1895                  plot_wsus = gsn_csm_xy(wks,data(varn,:,:),z,res)
1896               else
1897                  res@gsnLeftString      = vNam(varn)
1898                  res@tiXAxisString      = "["+unit(varn)+"]"
1899                  res@gsnRightString     = " "
1900                  if (xs .EQ. -1) then
1901                     res@trXMinF            = miniwsus
1902                  else
1903                     res@trXMinF            = xs
1904                  end if
1905                  if (xe .EQ. -1) then       
1906                     res@trXMaxF            = maxiwsus
1907                  else
1908                     res@trXMaxF            = xe 
1909                  end if
1910                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1911               end if
1912            end if
1913            if (vNam(varn) .EQ. "wu") then
1914               miniwu=min(data(varn,:,:))
1915               maxiwu=max(data(varn,:,:))
1916               if (over .EQ. 1) then
1917                  res@xyDashPattern  = 2
1918                  plot_wu = gsn_csm_xy(wks,data(varn,:,:),z,res)
1919               else
1920                  res@gsnLeftString      = vNam(varn)
1921                  res@tiXAxisString      = "["+unit(varn)+"]"
1922                  res@gsnRightString     = " "
1923                  if (xs .EQ. -1) then
1924                     res@trXMinF            = miniwu
1925                  else
1926                     res@trXMinF            = xs
1927                  end if
1928                  if (xe .EQ. -1) then       
1929                     res@trXMaxF            = maxiwu
1930                  else
1931                     res@trXMaxF            = xe 
1932                  end if
1933                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1934               end if
1935            end if
1936
1937            if (vNam(varn) .EQ. "wpvp") then
1938               miniwpvp=min(data(varn,:,:))
1939               maxiwpvp=max(data(varn,:,:))
1940               if (over .EQ. 1) then
1941                  res@xyDashPattern  = 0
1942                  plot_wpvp = gsn_csm_xy(wks,data(varn,:,:),z,res)
1943               else
1944                  res@gsnLeftString      = vNam(varn)
1945                  res@tiXAxisString      = "["+unit(varn)+"]"
1946                  res@gsnRightString     = " "
1947                  if (xs .EQ. -1) then
1948                     res@trXMinF            = miniwpvp
1949                  else
1950                     res@trXMinF            = xs
1951                  end if
1952                  if (xe .EQ. -1) then       
1953                     res@trXMaxF            = maxiwpvp
1954                  else
1955                     res@trXMaxF            = xe 
1956                  end if
1957                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1958               end if
1959            end if
1960            if (vNam(varn) .EQ. "wsvs") then
1961               miniwsvs=min(data(varn,:,:))
1962               maxiwsvs=max(data(varn,:,:))
1963               if (over .EQ. 1) then
1964                  res@xyDashPattern  = 1
1965                  plot_wsvs = gsn_csm_xy(wks,data(varn,:,:),z,res)
1966               else
1967                  res@gsnLeftString      = vNam(varn)
1968                  res@tiXAxisString      = "["+unit(varn)+"]"
1969                  res@gsnRightString     = " "
1970                  if (xs .EQ. -1) then
1971                     res@trXMinF            = miniwsvs
1972                  else
1973                     res@trXMinF            = xs
1974                  end if
1975                  if (xe .EQ. -1) then       
1976                     res@trXMaxF            = maxiwsvs
1977                  else
1978                     res@trXMaxF            = xe 
1979                  end if
1980                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
1981               end if
1982            end if
1983            if (vNam(varn) .EQ. "wv") then
1984               miniwv=min(data(varn,:,:))
1985               maxiwv=max(data(varn,:,:))
1986               if (over .EQ. 1) then
1987                  res@xyDashPattern  = 2
1988                  plot_wv = gsn_csm_xy(wks,data(varn,:,:),z,res)
1989               else
1990                  res@gsnLeftString      = vNam(varn)
1991                  res@tiXAxisString      = "["+unit(varn)+"]"
1992                  res@gsnRightString     = " "
1993                  if (xs .EQ. -1) then
1994                     res@trXMinF            = miniwv
1995                  else
1996                     res@trXMinF            = xs
1997                  end if
1998                  if (xe .EQ. -1) then       
1999                     res@trXMaxF            = maxiwv
2000                  else
2001                     res@trXMaxF            = xe 
2002                  end if
2003                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2004               end if
2005            end if
2006
2007            if (vNam(varn) .EQ. "wpptp") then
2008               miniwpptp=min(data(varn,:,:))
2009               maxiwpptp=max(data(varn,:,:))
2010               if (over .EQ. 1) then
2011                  res@xyDashPattern  = 0
2012                  plot_wpptp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2013               else
2014                  res@gsnLeftString      = vNam(varn)
2015                  res@tiXAxisString      = "["+unit(varn)+"]"
2016                  res@gsnRightString     = " "
2017                  if (xs .EQ. -1) then
2018                     res@trXMinF            = miniwpptp
2019                  else
2020                     res@trXMinF            = xs
2021                  end if
2022                  if (xe .EQ. -1) then       
2023                     res@trXMaxF            = maxiwpptp
2024                  else
2025                     res@trXMaxF            = xe 
2026                  end if
2027                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2028               end if
2029            end if
2030            if (vNam(varn) .EQ. "wspts") then
2031               miniwspts=min(data(varn,:,:))
2032               maxiwspts=max(data(varn,:,:))
2033               if (over .EQ. 1) then
2034                  res@xyDashPattern  = 1
2035                  plot_wspts = gsn_csm_xy(wks,data(varn,:,:),z,res)
2036               else
2037                  res@gsnLeftString      = vNam(varn)
2038                  res@tiXAxisString      = "["+unit(varn)+"]"
2039                  res@gsnRightString     = " "
2040                  if (xs .EQ. -1) then
2041                     res@trXMinF            = miniwspts
2042                  else
2043                     res@trXMinF            = xs
2044                  end if
2045                  if (xe .EQ. -1) then       
2046                     res@trXMaxF            = maxiwspts
2047                  else
2048                     res@trXMaxF            = xe 
2049                  end if
2050                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2051               end if
2052            end if
2053            if (vNam(varn) .EQ. "wpt") then
2054               miniwpt=min(data(varn,:,:))
2055               maxiwpt=max(data(varn,:,:))
2056               if (over .EQ. 1) then
2057                  res@xyDashPattern  = 2
2058                  plot_wpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
2059               else
2060                  res@gsnLeftString      = vNam(varn)
2061                  res@tiXAxisString      = "["+unit(varn)+"]"
2062                  res@gsnRightString     = " "
2063                  if (xs .EQ. -1) then
2064                     res@trXMinF            = miniwpt
2065                  else
2066                     res@trXMinF            = xs
2067                  end if
2068                  if (xe .EQ. -1) then       
2069                     res@trXMaxF            = maxiwpt
2070                  else
2071                     res@trXMaxF            = xe 
2072                  end if
2073                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2074               end if
2075            end if
2076
2077            if (vNam(varn) .EQ. "wsptsBC") then
2078               miniwsptsBC=min(data(varn,:,:))
2079               maxiwsptsBC=max(data(varn,:,:))
2080               if (over .EQ. 1) then
2081                  res@xyDashPattern  = 0
2082                  plot_wsptsBC = gsn_csm_xy(wks,data(varn,:,:),z,res)
2083               else
2084                  res@gsnLeftString      = vNam(varn)
2085                  res@tiXAxisString      = "["+unit(varn)+"]"
2086                  res@gsnRightString     = " "
2087                  if (xs .EQ. -1) then
2088                     res@trXMinF            = miniwsptsBC
2089                  else
2090                     res@trXMinF            = xs
2091                  end if
2092                  if (xe .EQ. -1) then       
2093                     res@trXMaxF            = maxiwsptsBC
2094                  else
2095                     res@trXMaxF            = xe 
2096                  end if
2097                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2098               end if
2099            end if             
2100            if (vNam(varn) .EQ. "wptBC") then
2101               miniwptBC=min(data(varn,:,:))
2102               maxiwptBC=max(data(varn,:,:))
2103               if (over .EQ. 1) then
2104                  res@xyDashPattern  = 1
2105                  plot_wptBC = gsn_csm_xy(wks,data(varn,:,:),z,res)
2106               else
2107                  res@gsnLeftString      = vNam(varn)
2108                  res@tiXAxisString      = "["+unit(varn)+"]"
2109                  res@gsnRightString     = " "
2110                  if (xs .EQ. -1) then
2111                     res@trXMinF            = miniwptBC
2112                  else
2113                     res@trXMinF            = xs
2114                  end if
2115                  if (xe .EQ. -1) then       
2116                     res@trXMaxF            = maxiwptBC
2117                  else
2118                     res@trXMaxF            = xe 
2119                  end if
2120                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2121               end if
2122            end if
2123
2124            if (vNam(varn) .EQ. "wpvptp") then
2125               miniwpvptp=min(data(varn,:,:))
2126               maxiwpvptp=max(data(varn,:,:))
2127               if (over .EQ. 1) then
2128                  res@xyDashPattern  = 0
2129                  plot_wpvptp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2130               else
2131                  res@gsnLeftString      = vNam(varn)
2132                  res@tiXAxisString      = "["+unit(varn)+"]"
2133                  res@gsnRightString     = " "
2134                  if (xs .EQ. -1) then
2135                     res@trXMinF            = miniwpvptp
2136                  else
2137                     res@trXMinF            = xs
2138                  end if
2139                  if (xe .EQ. -1) then       
2140                     res@trXMaxF            = maxiwpvptp
2141                  else
2142                     res@trXMaxF            = xe 
2143                  end if
2144                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2145               end if
2146            end if
2147            if (vNam(varn) .EQ. "wsvpts") then
2148               miniwsvpts=min(data(varn,:,:))
2149               maxiwsvpts=max(data(varn,:,:))
2150               if (over .EQ. 1) then
2151                  res@xyDashPattern  = 1
2152                  plot_wsvpts = gsn_csm_xy(wks,data(varn,:,:),z,res)
2153               else
2154                  res@gsnLeftString      = vNam(varn)
2155                  res@tiXAxisString      = "["+unit(varn)+"]"
2156                  res@gsnRightString     = " "
2157                  if (xs .EQ. -1) then
2158                     res@trXMinF            = miniwsvpts
2159                  else
2160                     res@trXMinF            = xs
2161                  end if
2162                  if (xe .EQ. -1) then       
2163                     res@trXMaxF            = maxiwsvpts
2164                  else
2165                     res@trXMaxF            = xe 
2166                  end if
2167                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2168               end if
2169            end if
2170            if (vNam(varn) .EQ. "wvpt") then
2171               miniwvpt=min(data(varn,:,:))
2172               maxiwvpt=max(data(varn,:,:))
2173               if (over .EQ. 1) then
2174                  res@xyDashPattern  = 2
2175                  plot_wvpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
2176               else
2177                  res@gsnLeftString      = vNam(varn)
2178                  res@tiXAxisString      = "["+unit(varn)+"]"
2179                  res@gsnRightString     = " "
2180                  if (xs .EQ. -1) then
2181                     res@trXMinF            = miniwvpt
2182                  else
2183                     res@trXMinF            = xs
2184                  end if
2185                  if (xe .EQ. -1) then       
2186                     res@trXMaxF            = maxiwvpt
2187                  else
2188                     res@trXMaxF            = xe 
2189                  end if
2190                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2191               end if
2192            end if
2193
2194            if (vNam(varn) .EQ. "wpqp") then
2195               miniwpqp=min(data(varn,:,:))
2196               maxiwpqp=max(data(varn,:,:))
2197               if (over .EQ. 1) then
2198                  res@xyDashPattern  = 0
2199                  plot_wpqp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2200               else
2201                  res@gsnLeftString      = vNam(varn)
2202                  res@tiXAxisString      = "["+unit(varn)+"]"
2203                  res@gsnRightString     = " "
2204                  if (xs .EQ. -1) then
2205                     res@trXMinF            = miniwpqp
2206                  else
2207                     res@trXMinF            = xs
2208                  end if
2209                  if (xe .EQ. -1) then       
2210                     res@trXMaxF            = maxiwpqp
2211                  else
2212                     res@trXMaxF            = xe 
2213                  end if
2214                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2215               end if
2216            end if
2217            if (vNam(varn) .EQ. "wsqs") then
2218               miniwsqs=min(data(varn,:,:))
2219               maxiwsqs=max(data(varn,:,:))
2220               if (over .EQ. 1) then
2221                  res@xyDashPattern  = 1
2222                  plot_wsqs = gsn_csm_xy(wks,data(varn,:,:),z,res)
2223               else
2224                  res@gsnLeftString      = vNam(varn)
2225                  res@tiXAxisString      = "["+unit(varn)+"]"
2226                  res@gsnRightString     = " "
2227                  if (xs .EQ. -1) then
2228                     res@trXMinF            = miniwsqs
2229                  else
2230                     res@trXMinF            = xs
2231                  end if
2232                  if (xe .EQ. -1) then       
2233                     res@trXMaxF            = maxiwsqs
2234                  else
2235                     res@trXMaxF            = xe 
2236                  end if
2237                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2238               end if
2239            end if
2240            if (vNam(varn) .EQ. "wq") then
2241               miniwq=min(data(varn,:,:))
2242               maxiwq=max(data(varn,:,:))
2243               if (over .EQ. 1) then
2244                  res@xyDashPattern  = 2
2245                  plot_wq = gsn_csm_xy(wks,data(varn,:,:),z,res)
2246               else
2247                  res@gsnLeftString      = vNam(varn)
2248                  res@tiXAxisString      = "["+unit(varn)+"]"
2249                  res@gsnRightString     = " "
2250                  if (xs .EQ. -1) then
2251                     res@trXMinF            = miniwq
2252                  else
2253                     res@trXMinF            = xs
2254                  end if
2255                  if (xe .EQ. -1) then       
2256                     res@trXMaxF            = maxiwq
2257                  else
2258                     res@trXMaxF            = xe 
2259                  end if
2260                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2261               end if
2262            end if
2263
2264            if (vNam(varn) .EQ. "wpqvp") then
2265               miniwpqvp=min(data(varn,:,:))
2266               maxiwpqvp=max(data(varn,:,:))
2267               if (over .EQ. 1) then
2268                  res@xyDashPattern  = 0
2269                  plot_wpqvp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2270               else
2271                  res@gsnLeftString      = vNam(varn)
2272                  res@tiXAxisString      = "["+unit(varn)+"]"
2273                  res@gsnRightString     = " "
2274                  if (xs .EQ. -1) then
2275                     res@trXMinF            = miniwpqvp
2276                  else
2277                     res@trXMinF            = xs
2278                  end if
2279                  if (xe .EQ. -1) then       
2280                     res@trXMaxF            = maxiwpqvp
2281                  else
2282                     res@trXMaxF            = xe 
2283                  end if
2284                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2285               end if
2286            end if
2287            if (vNam(varn) .EQ. "wsqvs") then
2288               miniwsqvs=min(data(varn,:,:))
2289               maxiwsqvs=max(data(varn,:,:))
2290               if (over .EQ. 1) then
2291                  res@xyDashPattern  = 1
2292                  plot_wsqvs = gsn_csm_xy(wks,data(varn,:,:),z,res)
2293               else
2294                  res@gsnLeftString      = vNam(varn)
2295                  res@tiXAxisString      = "["+unit(varn)+"]"
2296                  res@gsnRightString     = " "
2297                  if (xs .EQ. -1) then
2298                     res@trXMinF            = miniwsqvs
2299                  else
2300                     res@trXMinF            = xs
2301                  end if
2302                  if (xe .EQ. -1) then       
2303                     res@trXMaxF            = maxiwsqvs
2304                  else
2305                     res@trXMaxF            = xe 
2306                  end if
2307                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2308               end if
2309            end if
2310            if (vNam(varn) .EQ. "wqv") then
2311               miniwqv=min(data(varn,:,:))
2312               maxiwqv=max(data(varn,:,:))
2313               if (over .EQ. 1) then
2314                  res@xyDashPattern  = 2
2315                  plot_wqv = gsn_csm_xy(wks,data(varn,:,:),z,res)
2316               else
2317                  res@gsnLeftString      = vNam(varn)
2318                  res@tiXAxisString      = "["+unit(varn)+"]"
2319                  res@gsnRightString     = " "
2320                  if (xs .EQ. -1) then
2321                     res@trXMinF            = miniwqv
2322                  else
2323                     res@trXMinF            = xs
2324                  end if
2325                  if (xe .EQ. -1) then       
2326                     res@trXMaxF            = maxiwqv
2327                  else
2328                     res@trXMaxF            = xe 
2329                  end if
2330                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2331               end if
2332            end if
2333
2334            if (vNam(varn) .EQ. "wpsp") then
2335               miniwpsp=min(data(varn,:,:))
2336               maxiwpsp=max(data(varn,:,:))
2337               if (over .EQ. 1) then
2338                  res@xyDashPattern  = 0
2339                  plot_wpsp = gsn_csm_xy(wks,data(varn,:,:),z,res)
2340               else
2341                  res@gsnLeftString      = vNam(varn)
2342                  res@tiXAxisString      = "["+unit(varn)+"]"
2343                  res@gsnRightString     = " "
2344                  if (xs .EQ. -1) then
2345                     res@trXMinF            = miniwpsp
2346                  else
2347                     res@trXMinF            = xs
2348                  end if
2349                  if (xe .EQ. -1) then       
2350                     res@trXMaxF            = maxiwpsp
2351                  else
2352                     res@trXMaxF            = xe 
2353                  end if
2354                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2355               end if
2356            end if
2357            if (vNam(varn) .EQ. "wsss") then
2358               miniwsss=min(data(varn,:,:))
2359               maxiwsss=max(data(varn,:,:))
2360               if (over .EQ. 1) then
2361                  res@xyDashPattern  = 1
2362                  plot_wsss = gsn_csm_xy(wks,data(varn,:,:),z,res)
2363               else
2364                  res@gsnLeftString      = vNam(varn)
2365                  res@tiXAxisString      = "["+unit(varn)+"]"
2366                  res@gsnRightString     = " "
2367                  if (xs .EQ. -1) then
2368                     res@trXMinF            = miniwsss
2369                  else
2370                     res@trXMinF            = xs
2371                  end if
2372                  if (xe .EQ. -1) then       
2373                     res@trXMaxF            = maxiwsss
2374                  else
2375                     res@trXMaxF            = xe 
2376                  end if
2377                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2378               end if
2379            end if
2380            if (vNam(varn) .EQ. "ws") then
2381               miniws=min(data(varn,:,:))
2382               maxiws=max(data(varn,:,:))
2383               if (over .EQ. 1) then
2384                  res@xyDashPattern  = 2
2385                  plot_ws = gsn_csm_xy(wks,data(varn,:,:),z,res)
2386               else
2387                  res@gsnLeftString      = vNam(varn)
2388                  res@tiXAxisString      = "["+unit(varn)+"]"
2389                  res@gsnRightString     = " "
2390                  if (xs .EQ. -1) then
2391                     res@trXMinF            = miniws
2392                  else
2393                     res@trXMinF            = xs
2394                  end if
2395                  if (xe .EQ. -1) then       
2396                     res@trXMaxF            = maxiws
2397                  else
2398                     res@trXMaxF            = xe 
2399                  end if
2400                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2401               end if
2402            end if
2403
2404            if (vNam(varn) .EQ. "wpsap") then
2405               miniwpsap=min(data(varn,:,:))
2406               maxiwpsap=max(data(varn,:,:))
2407               if (over .EQ. 1) then
2408                  res@xyDashPattern  = 0
2409                  plot_wpsap = gsn_csm_xy(wks,data(varn,:,:),z,res)
2410               else
2411                  res@gsnLeftString      = vNam(varn)
2412                  res@tiXAxisString      = "["+unit(varn)+"]"
2413                  res@gsnRightString     = " "
2414                  if (xs .EQ. -1) then
2415                     res@trXMinF            = miniwpsap
2416                  else
2417                     res@trXMinF            = xs
2418                  end if
2419                  if (xe .EQ. -1) then       
2420                     res@trXMaxF            = maxiwpsap
2421                  else
2422                     res@trXMaxF            = xe 
2423                  end if
2424                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2425               end if
2426            end if
2427            if (vNam(varn) .EQ. "wssas") then
2428               miniwssas=min(data(varn,:,:))
2429               maxiwssas=max(data(varn,:,:))
2430               if (over .EQ. 1) then
2431                  res@xyDashPattern  = 1
2432                  plot_wssas = gsn_csm_xy(wks,data(varn,:,:),z,res)
2433               else
2434                  res@gsnLeftString      = vNam(varn)
2435                  res@tiXAxisString      = "["+unit(varn)+"]"
2436                  res@gsnRightString     = " "
2437                  if (xs .EQ. -1) then
2438                     res@trXMinF            = miniwssas
2439                  else
2440                     res@trXMinF            = xs
2441                  end if
2442                  if (xe .EQ. -1) then       
2443                     res@trXMaxF            = maxiwssas
2444                  else
2445                     res@trXMaxF            = xe 
2446                  end if
2447                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2448               end if
2449            end if
2450            if (vNam(varn) .EQ. "wsa") then
2451               miniwsa=min(data(varn,:,:))
2452               maxiwsa=max(data(varn,:,:))
2453               if (over .EQ. 1) then
2454                  res@xyDashPattern  = 2
2455                  plot_wsa = gsn_csm_xy(wks,data(varn,:,:),z,res)
2456               else
2457                  res@gsnLeftString      = vNam(varn)
2458                  res@tiXAxisString      = "["+unit(varn)+"]"
2459                  res@gsnRightString     = " "
2460                  if (xs .EQ. -1) then
2461                     res@trXMinF            = miniwsa
2462                  else
2463                     res@trXMinF            = xs
2464                  end if
2465                  if (xe .EQ. -1) then       
2466                     res@trXMaxF            = maxiwsa
2467                  else
2468                     res@trXMaxF            = xe 
2469                  end if
2470                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2471               end if
2472            end if
2473
2474            if (vNam(varn) .EQ. "us2") then
2475               minius2=min(data(varn,:,:))
2476               maxius2=max(data(varn,:,:))
2477               if (over .EQ. 1) then
2478                  res@xyDashPattern  = 0
2479                  plot_us2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
2480               else
2481                  res@gsnLeftString      = vNam(varn)
2482                  res@tiXAxisString      = "["+unit(varn)+"]"
2483                  res@gsnRightString     = " "
2484                  if (xs .EQ. -1) then
2485                     res@trXMinF            = minius2
2486                  else
2487                     res@trXMinF            = xs
2488                  end if
2489                  if (xe .EQ. -1) then       
2490                     res@trXMaxF            = maxius2
2491                  else
2492                     res@trXMaxF            = xe 
2493                  end if
2494                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2495               end if
2496            end if
2497            if (vNam(varn) .EQ. "vs2") then
2498               minivs2=min(data(varn,:,:))
2499               maxivs2=max(data(varn,:,:))
2500               if (over .EQ. 1) then
2501                  res@xyDashPattern  = 1
2502                  plot_vs2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
2503               else
2504                  res@gsnLeftString      = vNam(varn)
2505                  res@tiXAxisString      = "["+unit(varn)+"]"
2506                  res@gsnRightString     = " "
2507                  if (xs .EQ. -1) then
2508                     res@trXMinF            = minivs2
2509                  else
2510                     res@trXMinF            = xs
2511                  end if
2512                  if (xe .EQ. -1) then       
2513                     res@trXMaxF            = maxivs2
2514                  else
2515                     res@trXMaxF            = xe 
2516                  end if
2517                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2518               end if
2519            end if
2520            if (vNam(varn) .EQ. "ws2") then
2521               miniws2=min(data(varn,:,:))
2522               maxiws2=max(data(varn,:,:))
2523               if (over .EQ. 1) then
2524                  res@xyDashPattern  = 2
2525                  plot_ws2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
2526               else
2527                  res@gsnLeftString      = vNam(varn)
2528                  res@tiXAxisString      = "["+unit(varn)+"]"
2529                  res@gsnRightString     = " "
2530                  if (xs .EQ. -1) then
2531                     res@trXMinF            = miniws2
2532                  else
2533                     res@trXMinF            = xs
2534                  end if
2535                  if (xe .EQ. -1) then       
2536                     res@trXMaxF            = maxiws2
2537                  else
2538                     res@trXMaxF            = xe 
2539                  end if
2540                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2541               end if
2542            end if
2543
2544            if (vNam(varn) .EQ. "wsususodz") then
2545               miniwsususodz=min(data(varn,:,:))
2546               maxiwsususodz=max(data(varn,:,:))
2547               if (over .EQ. 1) then
2548                  res@xyDashPattern  = 0
2549                  plot_wsususodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
2550               else
2551                  res@gsnLeftString      = vNam(varn)
2552                  res@tiXAxisString      = "["+unit(varn)+"]"
2553                  res@gsnRightString     = " "
2554                  if (xs .EQ. -1) then
2555                     res@trXMinF            = miniwsususodz
2556                  else
2557                     res@trXMinF            = xs
2558                  end if
2559                  if (xe .EQ. -1) then       
2560                     res@trXMaxF            = maxiwsususodz
2561                  else
2562                     res@trXMaxF            = xe 
2563                  end if
2564                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2565               end if 
2566            end if
2567            if (vNam(varn) .EQ. "wspsodz") then
2568               miniwspsodz=min(data(varn,:,:))
2569               maxiwspsodz=max(data(varn,:,:))
2570               if (over .EQ. 1) then
2571                  res@xyDashPattern  = 1
2572                  plot_wspsodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
2573               else
2574                  res@gsnLeftString      = vNam(varn)
2575                  res@tiXAxisString      = "["+unit(varn)+"]"
2576                  res@gsnRightString     = " "
2577                  if (xs .EQ. -1) then
2578                     res@trXMinF            = miniwspsodz
2579                  else
2580                     res@trXMinF            = xs
2581                  end if
2582                  if (xe .EQ. -1) then       
2583                     res@trXMaxF            = maxiwspsodz
2584                  else
2585                     res@trXMaxF            = xe 
2586                  end if
2587                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2588               end if
2589            end if
2590            if (vNam(varn) .EQ. "wpeodz") then
2591               miniwpeodz=min(data(varn,:,:))
2592               maxiwpeodz=max(data(varn,:,:))
2593               if (over .EQ. 1) then
2594                  res@xyDashPattern  = 2
2595                  plot_wpeodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
2596               else
2597                  res@gsnLeftString      = vNam(varn)
2598                  res@tiXAxisString      = "["+unit(varn)+"]"
2599                  res@gsnRightString     = " "
2600                  if (xs .EQ. -1) then
2601                     res@trXMinF            = miniwpeodz
2602                  else
2603                     res@trXMinF            = xs
2604                  end if
2605                  if (xe .EQ. -1) then       
2606                     res@trXMaxF            = maxiwpeodz
2607                  else
2608                     res@trXMaxF            = xe 
2609                  end if
2610                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
2611               end if
2612            end if
2613         if (no_files .GT. 1) then
2614            multi_plot(nof,n)=plot(n)
2615            max_nof(nof,n)=max(data(varn,:,:))
2616            min_nof(nof,n)=min(data(varn,:,:))
2617            name(nof,n)   =vNam(varn)
2618            unit_(nof,n)  =unit(varn)
2619         end if
2620         if (over .EQ. 0) then
2621            n=n+1 
2622         end if 
2623         if (prof3d .EQ. 0)then   
2624            varn=varn+1
2625         end if
2626         delete(temp)
2627      end if         
2628   end do
2629   if (no_files .GT. 1) then
2630      delete(vNam)
2631      delete(files)
2632   end if
2633   
2634   end do
2635   ;#########ENDE DO LOOP FOR no_files GT 1#############
2636   
2637   if (count_var .EQ. 0) then
2638      print(" ")
2639      print("The variables 'var="+var+"' do not exist on your input file;")
2640      print("be sure to have one comma berfore and after each variable")
2641      print(" ")
2642      exit
2643   end if
2644   
2645   if (no_files .GT. 1) then
2646      multi_legend=new(6,string)
2647      string_len=new(6,integer)
2648      multi_dash=new(no_files,string)
2649      multi_legend(0)="  "+name_legend_1
2650      string_len(0)=strlen(multi_legend(0))
2651      multi_legend(1)="  "+name_legend_2
2652      string_len(1)=strlen(multi_legend(1))
2653      multi_legend(2)="  "+name_legend_3
2654      string_len(2)=strlen(multi_legend(2))
2655      multi_legend(3)="  "+name_legend_4
2656      string_len(3)=strlen(multi_legend(3))
2657      multi_legend(4)="  "+name_legend_5
2658      string_len(4)=strlen(multi_legend(4))
2659      multi_legend(5)="  "+name_legend_6
2660      string_len(5)=strlen(multi_legend(5))
2661      do ml=1,no_files
2662         multi_dash(ml-1)=ml-1
2663      end do
2664      delete(plot)
2665      plot = new(dim,graphic)
2666      do pl=0,n-1
2667         plot0 = new(1,graphic)
2668         res@trXMinF = min(min_nof(:,pl))
2669         res@trXMaxF = max(max_nof(:,pl))
2670         res@gsnLeftString  = name(0,pl)
2671         res@gsnRightString = unit_(0,pl)
2672   
2673         plot0 = gsn_csm_xy(wks,data_0(:,:),z_(pl,:),res)
2674
2675         ; ***************************************************
2676         ; legend for combined plot
2677         ; ***************************************************
2678
2679         lgres                    = True
2680         lgMonoDashIndex          = False
2681         lgres@lgLabelFont        = "helvetica"   
2682         lgres@lgLabelFontHeightF = font_size_legend           
2683         lgres@vpWidthF           = max(string_len)*0.012           
2684         lgres@vpHeightF          = 0.04*no_files         
2685         lgres@lgDashIndexes      = multi_dash(no_files-1:0)
2686         lbid = gsn_create_legend(wks,no_files,multi_legend(no_files-1:0),lgres)       
2687
2688         amres = True
2689         amres@amParallelPosF   = max(string_len)*0.01+0.78                 
2690         amres@amOrthogonalPosF = -0.0315*no_files+0.431         
2691         annoid1 = gsn_add_annotation(plot0,lbid,amres)
2692
2693         do plo=0,no_files-1
2694            overlay(plot0,multi_plot(plo,pl))
2695            plot(pl)=plot0
2696         end do
2697         delete(plot0)
2698      end do
2699   end if
2700
2701   if (count_var .EQ. 0) then
2702      print(" ")
2703      print("Select a variable 'var=' or use the default value")
2704      print(" ")
2705      print("Your selection '"+var+"' does not exist on the input file")
2706      print(" ")
2707      exit
2708   end if
2709
2710   if (over .EQ. 1 ) then
2711
2712      overlay(plot_u,plot_v)
2713      overlay(plot_u,plot_w)
2714      u=0
2715      overlay(plot_pt,plot_vpt)
2716      overlay(plot_pt,plot_lpt)
2717      pt=0
2718      overlay(plot_q,plot_qv)
2719      overlay(plot_q,plot_ql)
2720      q=0
2721      overlay(plot_e,plot_es)
2722      e=0
2723      overlay(plot_km,plot_kh)
2724      km=0
2725      overlay(plot_wpup,plot_wsus)
2726      overlay(plot_wpup,plot_wu)
2727      wpup=0
2728      overlay(plot_wpvp,plot_wsvs)
2729      overlay(plot_wpvp,plot_wv)
2730      wpvp=0
2731      overlay(plot_wpptp,plot_wspts)
2732      overlay(plot_wpptp,plot_wpt)
2733      wpptp=0
2734      overlay(plot_wsptsBC,plot_wptBC)
2735      wsptsBC=0
2736      overlay(plot_wpvptp,plot_wsvpts)
2737      overlay(plot_wpvptp,plot_wvpt)
2738      wpvptp=0
2739      overlay(plot_wpqp,plot_wsqs)
2740      overlay(plot_wpqp,plot_wq)
2741      wpqp=0
2742      overlay(plot_wpqvp,plot_wsqvs)
2743      overlay(plot_wpqvp,plot_wqv)
2744      wpqvp=0
2745      overlay(plot_wpsp,plot_wsss)
2746      overlay(plot_wpsp,plot_ws)
2747      wpsp=0
2748      overlay(plot_wpsap,plot_wssas)
2749      overlay(plot_wpsap,plot_wsa)
2750      wpsap=0
2751      overlay(plot_us2,plot_vs2)
2752      overlay(plot_us2,plot_ws2)
2753      us2=0
2754      overlay(plot_wsususodz,plot_wspsodz)
2755      overlay(plot_wsususodz,plot_wpeodz)
2756      wsususodz=0
2757
2758   end if
2759
2760   if (over .EQ. 1) then
2761   
2762      do varn = 0,dim-1   
2763         
2764         check = True
2765     
2766         if (prof3d .EQ. 0) then
2767            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
2768               check = False
2769            end if
2770         else
2771            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
2772               check = False
2773            end if
2774         end if
2775
2776         if (var .NE. "all") then     
2777            check = isStrSubset( var,","+vNam(varn)+"," )
2778         end if     
2779
2780         if (check)then
2781
2782            if (prof3d .EQ. 0) then
2783               if (log_z .EQ. 1) then
2784                  z = f->$vNam(varn+1)$(1:dimz-1)
2785               else
2786                  z = f->$vNam(varn+1)$               
2787               end if
2788            else
2789               do i=0,b-1           
2790                  if (isStrSubset( a(i),"zu_3d" ))then
2791                     z_v(varn,:) = z_u
2792                     if (log_z .EQ. 1) then
2793                        z = z_v(varn,1:dimz-1)
2794                     else
2795                        z = z_v(varn,:)
2796                     end if
2797                  else
2798                     if (isStrSubset( a(i),"zw_3d" ))then
2799                        z_v(varn,:) = z_w
2800                        if (log_z .EQ. 1) then
2801                           z = z_v(varn,1:dimz-1)
2802                        else
2803                           z = z_v(varn,:)
2804                        end if
2805                     end if                   
2806                  end if
2807               end do           
2808            end if
2809
2810            z=z/norm_z
2811
2812            res@gsnLeftString      = vNam(varn)
2813            res@tiXAxisString      = "["+unit(varn)+"]"
2814            res@gsnRightString     = " "
2815            res@trYMinF            = min_z
2816            res@trYMaxF            = max_z 
2817            if (xs .EQ. -1) then
2818               res@trXMinF = min(data(varn,:,:))
2819            else
2820               res@trXMinF = xs
2821            end if
2822            if (xe .EQ. -1) then
2823               res@trXMaxF = max(data(varn,:,:))
2824            else
2825               res@trXMaxF = xe 
2826            end if
2827            plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
2828           
2829            if (vNam(varn) .EQ. "u" .OR. vNam(varn) .EQ. "v" .OR. vNam(varn) .EQ. "w") then
2830               if (u .EQ. 0) then
2831                  res@gsnLeftString      = "u, v and w"
2832                  res@tiXAxisString      = "["+unit(varn)+"]"
2833                  res@gsnRightString     = " "
2834                  if (xs .EQ. -1) then
2835                     res@trXMinF = min((/miniu,miniv,miniw/))
2836                  else
2837                     res@trXMinF = xs
2838                  end if
2839                  if (xe .EQ. -1) then
2840                     res@trXMaxF = max((/maxiu,maxiv,maxiw/))
2841                  else
2842                     res@trXMaxF = xe 
2843                  end if 
2844                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
2845
2846                  ; ***************************************************
2847                  ; legend for combined plot
2848                  ; ***************************************************
2849     
2850                  lgres                    = True
2851                  lgMonoDashIndex          = False
2852                  lgres@lgLabelFont        = "helvetica"   
2853                  lgres@lgLabelFontHeightF = font_size_legend           
2854                  lgres@vpWidthF           = 0.12           
2855                  lgres@vpHeightF          = 0.1         
2856                  lgres@lgDashIndexes      = (/0,1,2/)
2857                  lbid = gsn_create_legend(wks,3,(/"u","v","w"/),lgres)       
2858
2859                  amres = True
2860                  amres@amParallelPosF   = 0.65             
2861                  amres@amOrthogonalPosF = -0.2           
2862                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
2863                  overlay(plot(n),plot_u)
2864                  u=1
2865               else
2866                  if (prof3d .EQ. 0)then
2867                     varn=varn+1
2868                  end if
2869                  continue
2870               end if       
2871            end if 
2872     
2873            if (vNam(varn) .EQ. "pt" .OR. vNam(varn) .EQ. "vpt" .OR. vNam(varn) .EQ. "lpt") then
2874               if (pt .EQ. 0) then
2875                  res@gsnLeftString      = "pt, vpt and lpt"
2876                  res@tiXAxisString      = "["+unit(varn)+"]"
2877                  res@gsnRightString     = " "
2878                  if (xs .EQ. -1) then
2879                     res@trXMinF = min((/minipt,minivpt,minilpt/))
2880                  else
2881                     res@trXMinF = xs
2882                  end if
2883                  if (xe .EQ. -1) then
2884                     res@trXMaxF = max((/maxipt,maxivpt,maxilpt/))
2885                  else
2886                     res@trXMaxF = xe 
2887                  end if
2888
2889                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
2890
2891                  ; ***************************************************
2892                  ; legend for combined plot
2893                  ; ***************************************************
2894     
2895                  lgres                    = True
2896                  lgMonoDashIndex          = False
2897                  lgres@lgLabelFont        = "helvetica"   
2898                  lgres@lgLabelFontHeightF = font_size_legend           
2899                  lgres@vpWidthF           = 0.12           
2900                  lgres@vpHeightF          = 0.1         
2901                  lgres@lgDashIndexes      = (/0,1,2/)
2902                  lbid = gsn_create_legend(wks,3,(/"pt","vpt","lpt"/),lgres)       
2903
2904                  amres = True
2905                  amres@amParallelPosF   = 0.65             
2906                  amres@amOrthogonalPosF = -0.2           
2907                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
2908                  overlay(plot(n),plot_pt)
2909                  pt=1
2910               else
2911                  if (prof3d .EQ. 0)then
2912                     varn=varn+1
2913                  end if
2914                  continue       
2915               end if
2916            end if           
2917            if (vNam(varn) .EQ. "q" .OR. vNam(varn) .EQ. "qv" .OR. vNam(varn) .EQ. "ql") then
2918               if (q .EQ. 0) then
2919                  res@gsnLeftString      = "q, qv and ql"
2920                  res@tiXAxisString      = "["+unit(varn)+"]"
2921                  res@gsnRightString     = " "
2922                  if (xs .EQ. -1) then
2923                     res@trXMinF = min((/miniq,miniqv,miniql/))
2924                  else
2925                     res@trXMinF = xs
2926                  end if
2927                  if (xe .EQ. -1) then
2928                     res@trXMaxF = max((/maxiq,maxiqv,maxiql/))
2929                  else
2930                     res@trXMaxF = xe 
2931                  end if
2932
2933                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
2934
2935                  ; ***************************************************
2936                  ; legend for combined plot
2937                  ; ***************************************************
2938     
2939                  lgres                    = True
2940                  lgMonoDashIndex          = False
2941                  lgres@lgLabelFont        = "helvetica"   
2942                  lgres@lgLabelFontHeightF = font_size_legend           
2943                  lgres@vpWidthF           = 0.12           
2944                  lgres@vpHeightF          = 0.1         
2945                  lgres@lgDashIndexes      = (/0,1,2/)
2946                  lbid = gsn_create_legend(wks,3,(/"q","qv","ql"/),lgres)       
2947
2948                  amres = True
2949                  amres@amParallelPosF   = 0.65             
2950                  amres@amOrthogonalPosF = -0.2           
2951                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
2952                  overlay(plot(n),plot_q)
2953                  q=1
2954               else
2955                  if (prof3d .EQ. 0)then
2956                     varn=varn+1
2957                  end if
2958                  continue   
2959               end if
2960            end if   
2961           
2962            if (vNam(varn) .EQ. "e" .OR. vNam(varn) .EQ. "es") then
2963               if (e .EQ. 0) then
2964                  res@gsnLeftString      = "e and es"
2965                  res@tiXAxisString      = "["+unit(varn)+"]"
2966                  res@gsnRightString     = " "
2967                  if (xs .EQ. -1) then
2968                     res@trXMinF = min((/minie,minies/))
2969                  else
2970                     res@trXMinF = xs
2971                  end if
2972                  if (xe .EQ. -1) then
2973                     res@trXMaxF = max((/maxie,maxies/))
2974                  else
2975                     res@trXMaxF = xe 
2976                  end if
2977                 
2978                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
2979
2980                  ; ***************************************************
2981                  ; legend for combined plot
2982                  ; ***************************************************
2983     
2984                  lgres                    = True
2985                  lgMonoDashIndex          = False
2986                  lgres@lgLabelFont        = "helvetica"   
2987                  lgres@lgLabelFontHeightF = font_size_legend           
2988                  lgres@vpWidthF           = 0.12           
2989                  lgres@vpHeightF          = 0.1         
2990                  lgres@lgDashIndexes      = (/0,1,2/)
2991                  lbid = gsn_create_legend(wks,3,(/"e","es"/),lgres)       
2992
2993                  amres = True
2994                  amres@amParallelPosF   = 0.65             
2995                  amres@amOrthogonalPosF = -0.2           
2996                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
2997                  overlay(plot(n),plot_e)
2998                  e=1
2999               else
3000                  if (prof3d .EQ. 0)then
3001                     varn=varn+1
3002                  end if
3003                  continue   
3004               end if
3005            end if           
3006            if (vNam(varn) .EQ. "km" .OR. vNam(varn) .EQ. "kh") then
3007               if (km .EQ. 0) then
3008                  res@gsnLeftString      = "km and kh"
3009                  res@tiXAxisString      = "["+unit(varn)+"]"
3010                  res@gsnRightString     = " "
3011                  if (xs .EQ. -1) then
3012                     res@trXMinF = min((/minikm,minikh/))
3013                  else
3014                     res@trXMinF = xs
3015                  end if
3016                  if (xe .EQ. -1) then
3017                     res@trXMaxF = max((/maxikm,maxikh/))
3018                  else
3019                     res@trXMaxF = xe 
3020                  end if
3021
3022                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3023
3024                  ; ***************************************************
3025                  ; legend for combined plot
3026                  ; ***************************************************
3027     
3028                  lgres                    = True
3029                  lgMonoDashIndex          = False
3030                  lgres@lgLabelFont        = "helvetica"   
3031                  lgres@lgLabelFontHeightF = font_size_legend           
3032                  lgres@vpWidthF           = 0.12           
3033                  lgres@vpHeightF          = 0.1         
3034                  lgres@lgDashIndexes      = (/0,1,2/)
3035                  lbid = gsn_create_legend(wks,3,(/"km","kh"/),lgres)       
3036
3037                  amres = True
3038                  amres@amParallelPosF   = 0.65             
3039                  amres@amOrthogonalPosF = -0.2           
3040                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3041                  overlay(plot(n),plot_km)
3042                  km=1
3043               else
3044                  if (prof3d .EQ. 0)then
3045                     varn=varn+1
3046                  end if
3047                  continue   
3048               end if
3049            end if           
3050           
3051            if (vNam(varn) .EQ. "wpup" .OR. vNam(varn) .EQ. "wsus" .OR. vNam(varn) .EQ. "wu") then
3052               if (wpup .EQ. 0) then
3053                  res@gsnLeftString      = "wpup, wsus and wu"
3054                  res@tiXAxisString      = "["+unit(varn)+"]"
3055                  res@gsnRightString     = " "
3056                  if (xs .EQ. -1) then
3057                     res@trXMinF = min((/miniwpup,miniwsus,miniwu/))
3058                  else
3059                     res@trXMinF = xs
3060                  end if
3061                  if (xe .EQ. -1) then
3062                     res@trXMaxF = max((/maxiwpup,maxiwsus,maxiwu/))
3063                  else
3064                     res@trXMaxF = xe 
3065                  end if 
3066
3067                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3068
3069                  ; ***************************************************
3070                  ; legend for combined plot
3071                  ; ***************************************************
3072     
3073                  lgres                    = True
3074                  lgMonoDashIndex          = False
3075                  lgres@lgLabelFont        = "helvetica"   
3076                  lgres@lgLabelFontHeightF = font_size_legend           
3077                  lgres@vpWidthF           = 0.12           
3078                  lgres@vpHeightF          = 0.1         
3079                  lgres@lgDashIndexes      = (/0,1,2/)
3080                  lbid = gsn_create_legend(wks,3,(/"wpup","wsus","wu"/),lgres)       
3081
3082                  amres = True
3083                  amres@amParallelPosF   = 0.65             
3084                  amres@amOrthogonalPosF = -0.2           
3085                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3086                  overlay(plot(n),plot_wpup)
3087                  wpup=1
3088               else
3089                  if (prof3d .EQ. 0)then
3090                     varn=varn+1
3091                  end if
3092                  continue   
3093               end if
3094            end if
3095            if (vNam(varn) .EQ. "wpvp" .OR. vNam(varn) .EQ. "wsvs" .OR.vNam(varn) .EQ. "wv") then
3096               if (wpvp .EQ. 0) then
3097                  res@gsnLeftString      = "wpvp, wsus and wv"
3098                  res@tiXAxisString      = "["+unit(varn)+"]"
3099                  res@gsnRightString     = " "
3100                  if (xs .EQ. -1) then
3101                     res@trXMinF = min((/miniwpvp,miniwsvs,miniwv/))
3102                  else
3103                     res@trXMinF = xs
3104                  end if
3105                  if (xe .EQ. -1) then
3106                     res@trXMaxF = max((/maxiwpvp,maxiwsvs,maxiwv/))
3107                  else
3108                     res@trXMaxF = xe 
3109                  end if
3110                 
3111                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3112
3113                  ; ***************************************************
3114                  ; legend for combined plot
3115                  ; ***************************************************
3116     
3117                  lgres                    = True
3118                  lgMonoDashIndex          = False
3119                  lgres@lgLabelFont        = "helvetica"   
3120                  lgres@lgLabelFontHeightF = font_size_legend           
3121                  lgres@vpWidthF           = 0.12           
3122                  lgres@vpHeightF          = 0.1         
3123                  lgres@lgDashIndexes      = (/0,1,2/)
3124                  lbid = gsn_create_legend(wks,3,(/"wpvp","wsvs","wv"/),lgres)       
3125
3126                  amres = True
3127                  amres@amParallelPosF   = 0.65             
3128                  amres@amOrthogonalPosF = -0.2           
3129                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3130                  overlay(plot(n),plot_wpvp)
3131                  wpup=0
3132               else
3133                  if (prof3d .EQ. 0)then
3134                     varn=varn+1
3135                  end if
3136                  continue   
3137               end if
3138            end if
3139            if (vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "wspts" .OR. vNam(varn) .EQ. "wpt") then
3140               if (wpptp .EQ. 0) then
3141                  res@gsnLeftString      = "wpptp, wspts and wv"
3142                  res@tiXAxisString      = "["+unit(varn)+"]"
3143                  res@gsnRightString     = " "
3144                  if (xs .EQ. -1) then
3145                     res@trXMinF = min((/miniwpptp,miniwspts,miniwpt/))
3146                  else
3147                     res@trXMinF = xs
3148                  end if
3149                  if (xe .EQ. -1) then
3150                     res@trXMaxF = max((/maxiwpptp,maxiwspts,maxiwpt/))
3151                  else
3152                     res@trXMaxF = xe 
3153                  end if
3154
3155                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3156
3157                  ; ***************************************************
3158                  ; legend for combined plot
3159                  ; ***************************************************
3160     
3161                  lgres                    = True
3162                  lgMonoDashIndex          = False
3163                  lgres@lgLabelFont        = "helvetica"   
3164                  lgres@lgLabelFontHeightF = font_size_legend           
3165                  lgres@vpWidthF           = 0.12           
3166                  lgres@vpHeightF          = 0.1         
3167                  lgres@lgDashIndexes      = (/0,1,2/)
3168                  lbid = gsn_create_legend(wks,3,(/"wpptp","wspts","wpt"/),lgres)       
3169
3170                  amres = True
3171                  amres@amParallelPosF   = 0.65             
3172                  amres@amOrthogonalPosF = -0.2           
3173                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3174                  overlay(plot(n),plot_wpptp)
3175                  wpptp=1
3176               else
3177                  if (prof3d .EQ. 0)then
3178                     varn=varn+1
3179                  end if
3180                  continue   
3181               end if
3182            end if
3183            if (vNam(varn) .EQ. "wsptsBC" .OR. vNam(varn) .EQ. "wptBC") then
3184               if (wsptsBC .EQ. 0) then
3185                  res@gsnLeftString      = "wsptsBC and wptBC"
3186                  res@tiXAxisString      = "["+unit(varn)+"]"
3187                  res@gsnRightString     = " "
3188                  if (xs .EQ. -1) then
3189                     res@trXMinF = min((/miniwsptsBC,miniwptBC/))
3190                  else
3191                     res@trXMinF = xs
3192                  end if
3193                  if (xe .EQ. -1) then
3194                     res@trXMaxF = max((/maxiwsptsBC,maxiwptBC/))
3195                  else
3196                     res@trXMaxF = xe 
3197                  end if
3198
3199                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3200
3201                  ; ***************************************************
3202                  ; legend for combined plot
3203                  ; ***************************************************
3204     
3205                  lgres                    = True
3206                  lgMonoDashIndex          = False
3207                  lgres@lgLabelFont        = "helvetica"   
3208                  lgres@lgLabelFontHeightF = font_size_legend           
3209                  lgres@vpWidthF           = 0.12           
3210                  lgres@vpHeightF          = 0.1         
3211                  lgres@lgDashIndexes      = (/0,1,2/)
3212                  lbid = gsn_create_legend(wks,3,(/"wsptsBC","wptBC"/),lgres)       
3213
3214                  amres = True
3215                  amres@amParallelPosF   = 0.65             
3216                  amres@amOrthogonalPosF = -0.2           
3217                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3218                  overlay(plot(n),plot_wsptsBC)
3219                  wsptsBC=1
3220               else
3221                  if (prof3d .EQ. 0)then
3222                     varn=varn+1
3223                  end if
3224                  continue   
3225               end if 
3226            end if             
3227            if (vNam(varn) .EQ. "wpvptp" .OR. vNam(varn) .EQ. "wsvpts" .OR. vNam(varn) .EQ. "wvpt") then
3228               if (wpvptp .EQ. 0) then
3229                  res@gsnLeftString      = "wpvptp, wsvpts and wv"
3230                  res@tiXAxisString      = "["+unit(varn)+"]"
3231                  res@gsnRightString     = " "
3232                  if (xs .EQ. -1) then
3233                     res@trXMinF = min((/miniwpvptp,miniwsvpts,miniwvpt/))
3234                  else
3235                     res@trXMinF = xs
3236                  end if
3237                  if (xe .EQ. -1) then
3238                     res@trXMaxF = max((/maxiwpvptp,maxiwsvpts,maxiwvpt/))
3239                  else
3240                     res@trXMaxF = xe 
3241                  end if
3242                 
3243                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3244
3245                  ; ***************************************************
3246                  ; legend for combined plot
3247                  ; ***************************************************
3248     
3249                  lgres                    = True
3250                  lgMonoDashIndex          = False
3251                  lgres@lgLabelFont        = "helvetica"   
3252                  lgres@lgLabelFontHeightF = font_size_legend           
3253                  lgres@vpWidthF           = 0.12           
3254                  lgres@vpHeightF          = 0.1         
3255                  lgres@lgDashIndexes      = (/0,1,2/)
3256                  lbid = gsn_create_legend(wks,3,(/"wpvptp","wsvpts","wvpt"/),lgres)       
3257
3258                  amres = True
3259                  amres@amParallelPosF   = 0.65             
3260                  amres@amOrthogonalPosF = -0.2           
3261                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3262                  overlay(plot(n),plot_wpvptp)
3263                  wpvptp=1
3264               else
3265                  if (prof3d .EQ. 0)then
3266                     varn=varn+1
3267                  end if
3268                  continue   
3269               end if
3270            end if
3271            if (vNam(varn) .EQ. "wpqp" .OR. vNam(varn) .EQ. "wsqs" .OR. vNam(varn) .EQ. "wq") then
3272               if (wpqp .EQ. 0) then
3273                  res@gsnLeftString      = "wpqp, wsqs and wq"
3274                  res@tiXAxisString      = "["+unit(varn)+"]"
3275                  res@gsnRightString     = " "
3276                  if (xs .EQ. -1) then
3277                     res@trXMinF = min((/miniwpqp,miniwsqs,miniwq/))
3278                  else
3279                     res@trXMinF = xs
3280                  end if
3281                  if (xe .EQ. -1) then
3282                     res@trXMaxF = max((/maxiwpqp,maxiwsqs,maxiwq/))
3283                  else
3284                     res@trXMaxF = xe 
3285                  end if 
3286                 
3287                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3288
3289                  ; ***************************************************
3290                  ; legend for combined plot
3291                  ; ***************************************************
3292     
3293                  lgres                    = True
3294                  lgMonoDashIndex          = False
3295                  lgres@lgLabelFont        = "helvetica"   
3296                  lgres@lgLabelFontHeightF = font_size_legend           
3297                  lgres@vpWidthF           = 0.12           
3298                  lgres@vpHeightF          = 0.1         
3299                  lgres@lgDashIndexes      = (/0,1,2/)
3300                  lbid = gsn_create_legend(wks,3,(/"wpqp","wsqs","wq"/),lgres)       
3301
3302                  amres = True
3303                  amres@amParallelPosF   = 0.65             
3304                  amres@amOrthogonalPosF = -0.2           
3305                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3306                  overlay(plot(n),plot_wpqp)
3307                  wpqp=1
3308               else
3309                  if (prof3d .EQ. 0)then
3310                     varn=varn+1
3311                  end if
3312                  continue   
3313               end if
3314            end if
3315            if (vNam(varn) .EQ. "wpqvp" .OR. vNam(varn) .EQ. "wsqvs" .OR. vNam(varn) .EQ. "wqv") then
3316               if (wpqvp .EQ. 0) then
3317                  res@gsnLeftString      = "wpqvp, wsqvs and wqv"
3318                  res@tiXAxisString      = "["+unit(varn)+"]"
3319                  res@gsnRightString     = " "
3320                  if (xs .EQ. -1) then
3321                     res@trXMinF = min((/miniwpqp,miniwsqvs,miniwqv/))
3322                  else
3323                     res@trXMinF = xs
3324                  end if
3325                  if (xe .EQ. -1) then
3326                     res@trXMaxF = max((/maxiwpqp,maxiwsqvs,maxiwqv/))
3327                  else
3328                     res@trXMaxF = xe 
3329                  end if
3330                 
3331                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3332
3333                  ; ***************************************************
3334                  ; legend for combined plot
3335                  ; ***************************************************
3336     
3337                  lgres                    = True
3338                  lgMonoDashIndex          = False
3339                  lgres@lgLabelFont        = "helvetica"   
3340                  lgres@lgLabelFontHeightF = font_size_legend           
3341                  lgres@vpWidthF           = 0.12           
3342                  lgres@vpHeightF          = 0.1         
3343                  lgres@lgDashIndexes      = (/0,1,2/)
3344                  lbid = gsn_create_legend(wks,3,(/"wpqvp","wsqvs","wqv"/),lgres)       
3345
3346                  amres = True
3347                  amres@amParallelPosF   = 0.65             
3348                  amres@amOrthogonalPosF = -0.2           
3349                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3350                  overlay(plot(n),plot_wpqvp)
3351                  wpqvp=1
3352               else
3353                  if (prof3d .EQ. 0)then
3354                     varn=varn+1
3355                  end if
3356                  continue   
3357               end if
3358            end if
3359            if (vNam(varn) .EQ. "wpsp" .OR. vNam(varn) .EQ. "wsss" .OR. vNam(varn) .EQ. "ws") then
3360               if (wpsp .EQ. 0) then
3361                  res@gsnLeftString      = "wpsp, wsss and ws"
3362                  res@tiXAxisString      = "["+unit(varn)+"]"
3363                  res@gsnRightString     = " "
3364                  if (xs .EQ. -1) then
3365                     res@trXMinF = min((/miniwpsp,miniwsss,miniws/))
3366                  else
3367                     res@trXMinF = xs
3368                  end if
3369                  if (xe .EQ. -1) then
3370                     res@trXMaxF = max((/maxiwpsp,maxiwsss,maxiws/))
3371                  else
3372                     res@trXMaxF = xe 
3373                  end if
3374
3375                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3376
3377                  ; ***************************************************
3378                  ; legend for combined plot
3379                  ; ***************************************************
3380     
3381                  lgres                    = True
3382                  lgMonoDashIndex          = False
3383                  lgres@lgLabelFont        = "helvetica"   
3384                  lgres@lgLabelFontHeightF = font_size_legend           
3385                  lgres@vpWidthF           = 0.12           
3386                  lgres@vpHeightF          = 0.1         
3387                  lgres@lgDashIndexes      = (/0,1,2/)
3388                  lbid = gsn_create_legend(wks,3,(/"wpsp","wsss","ws"/),lgres)       
3389
3390                  amres = True
3391                  amres@amParallelPosF   = 0.65             
3392                  amres@amOrthogonalPosF = -0.2           
3393                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3394                  overlay(plot(n),plot_wpsp)
3395                  wpsp=1
3396               else
3397                  if (prof3d .EQ. 0)then
3398                     varn=varn+1
3399                  end if
3400                  continue   
3401               end if
3402            end if
3403            if (vNam(varn) .EQ. "wpsap" .OR.vNam(varn) .EQ. "wssas" .OR. vNam(varn) .EQ. "wsa") then
3404               if (wpsap .EQ. 0) then
3405                  res@gsnLeftString      = "wpsap, wssas and wsa"
3406                  res@tiXAxisString      = "["+unit(varn)+"]"
3407                  res@gsnRightString     = " "
3408                  if (xs .EQ. -1) then
3409                     res@trXMinF = min((/miniwpsap,miniwssas,miniwsa/))
3410                  else
3411                     res@trXMinF = xs
3412                  end if
3413                  if (xe .EQ. -1) then
3414                     res@trXMaxF = max((/maxiwpsap,maxiwssas,maxiwsa/))
3415                  else
3416                     res@trXMaxF = xe 
3417                  end if
3418
3419                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3420
3421                  ; ***************************************************
3422                  ; legend for combined plot
3423                  ; ***************************************************
3424     
3425                  lgres                    = True
3426                  lgMonoDashIndex          = False
3427                  lgres@lgLabelFont        = "helvetica"   
3428                  lgres@lgLabelFontHeightF = font_size_legend           
3429                  lgres@vpWidthF           = 0.12           
3430                  lgres@vpHeightF          = 0.1         
3431                  lgres@lgDashIndexes      = (/0,1,2/)
3432                  lbid = gsn_create_legend(wks,3,(/"wpsap","wssas","wsa"/),lgres)       
3433
3434                  amres = True
3435                  amres@amParallelPosF   = 0.65             
3436                  amres@amOrthogonalPosF = -0.2           
3437                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3438                  overlay(plot(n),plot_wpsap)
3439                  wpsap=1
3440               else
3441                  if (prof3d .EQ. 0)then
3442                     varn=varn+1
3443                  end if
3444                  continue   
3445               end if
3446            end if
3447         
3448            if (vNam(varn) .EQ. "us2" .OR. vNam(varn) .EQ. "vs2" .OR. vNam(varn) .EQ. "ws2") then
3449               if (us2 .EQ. 0) then
3450                  res@gsnLeftString      = "us2, vs2 and ws2"
3451                  res@tiXAxisString      = "["+unit(varn)+"]"
3452                  res@gsnRightString     = " "
3453                  if (xs .EQ. -1) then
3454                     res@trXMinF = min((/minius2,minivs2,miniws2/))
3455                  else
3456                     res@trXMinF = xs
3457                  end if
3458                  if (xe .EQ. -1) then
3459                     res@trXMaxF = max((/maxius2,maxivs2,maxiws2/))
3460                  else
3461                     res@trXMaxF = xe 
3462                  end if
3463                 
3464                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3465
3466                  ; ***************************************************
3467                  ; legend for combined plot
3468                  ; ***************************************************
3469     
3470                  lgres                    = True
3471                  lgMonoDashIndex          = False
3472                  lgres@lgLabelFont        = "helvetica"   
3473                  lgres@lgLabelFontHeightF = font_size_legend           
3474                  lgres@vpWidthF           = 0.12           
3475                  lgres@vpHeightF          = 0.1         
3476                  lgres@lgDashIndexes      = (/0,1,2/)
3477                  lbid = gsn_create_legend(wks,3,(/"us2","vs2","ws2"/),lgres)       
3478
3479                  amres = True
3480                  amres@amParallelPosF   = 0.65             
3481                  amres@amOrthogonalPosF = -0.2           
3482                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3483                  overlay(plot(n),plot_us2)
3484                  us2=1
3485               else
3486                  if (prof3d .EQ. 0)then
3487                     varn=varn+1
3488                  end if
3489                  continue   
3490               end if
3491            end if
3492           
3493            if (vNam(varn) .EQ. "wsususodz" .OR. vNam(varn) .EQ. "wspsodz" .OR. vNam(varn) .EQ. "wpeodz" ) then
3494               if (wsususodz .EQ. 0) then
3495                  res@gsnLeftString      = "wsususodz, wspsodz and ws2"
3496                  res@tiXAxisString      = "["+unit(varn)+"]"
3497                  res@gsnRightString     = " "
3498                  if (xs .EQ. -1) then
3499                     res@trXMinF = min((/miniwsususodz,miniwspsodz,miniwpeodz/))
3500                  else
3501                     res@trXMinF = xs
3502                  end if
3503                  if (xe .EQ. -1) then
3504                     res@trXMaxF = max((/maxiwsususodz,maxiwspsodz,maxiwpeodz/))
3505                  else
3506                     res@trXMaxF = xe 
3507                  end if
3508                 
3509                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
3510
3511                  ; ***************************************************
3512                  ; legend for combined plot
3513                  ; ***************************************************
3514     
3515                  lgres                    = True
3516                  lgMonoDashIndex          = False
3517                  lgres@lgLabelFont        = "helvetica"   
3518                  lgres@lgLabelFontHeightF = font_size_legend           
3519                  lgres@vpWidthF           = 0.12           
3520                  lgres@vpHeightF          = 0.1         
3521                  lgres@lgDashIndexes      = (/0,1,2/)
3522                  lbid = gsn_create_legend(wks,3,(/"wsususodz","wspsodz","wpeodz"/),lgres)       
3523
3524                  amres = True
3525                  amres@amParallelPosF   = 0.65             
3526                  amres@amOrthogonalPosF = -0.2           
3527                  annoid1 = gsn_add_annotation(plot(n),lbid,amres)                 
3528                  overlay(plot(n),plot_wsususodz)
3529                  wsususodz=1
3530               else
3531                  if (prof3d .EQ. 0)then
3532                     varn=varn+1
3533                  end if
3534                  continue   
3535               end if
3536            end if     
3537            n=n+1
3538            if (prof3d .EQ. 0)then
3539               varn=varn+1
3540            end if   
3541         end if
3542      end do
3543   end if
3544   
3545   com_var_avail=new(count_var,string)   
3546
3547   if (combine .EQ. 1) then
3548      co=0     
3549      n_o=0
3550      do varn = 0,dim-1
3551 
3552         check = True
3553     
3554         if (prof3d .EQ. 0) then
3555            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
3556               check = False
3557            end if
3558         else
3559            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
3560               check = False
3561            end if
3562         end if
3563
3564         if (var .NE. "all") then         
3565            check = isStrSubset( var,","+vNam(varn)+"," )
3566         end if     
3567
3568         if (check)then
3569           
3570            if (prof3d .EQ. 0) then
3571               if (log_z .EQ. 1) then
3572                  z = f->$vNam(varn+1)$(1:dimz-1)
3573               else
3574                  z = f->$vNam(varn+1)$               
3575               end if
3576            else
3577               do i=0,b-1           
3578                  if (isStrSubset( a(i),"zu_3d" ))then
3579                     z_v(varn,:) = z_u
3580                     if (log_z .EQ. 1) then
3581                        z = z_v(varn,1:dimz-1)
3582                     else
3583                        z = z_v(varn,:)
3584                     end if
3585                  else
3586                     if (isStrSubset( a(i),"zw_3d" ))then
3587                        z_v(varn,:) = z_w
3588                        if (log_z .EQ. 1) then
3589                           z = z_v(varn,1:dimz-1)
3590                        else
3591                           z = z_v(varn,:)
3592                        end if
3593                     end if                   
3594                  end if
3595               end do           
3596            end if
3597
3598            z=z/norm_z
3599           
3600            com_var_avail(n_o)=vNam(varn)
3601           
3602            com=isStrSubset( c_var,","+vNam(varn)+"," )
3603       
3604            if (com)then
3605               co = co+1           
3606               if (n_o .EQ. 1) then
3607                  res@xyDashPattern  = 1                                   
3608               else           
3609                  if (n_o .EQ. 2) then
3610                     res@xyDashPattern  = 2
3611                  else
3612                     res@xyDashPattern  = 0
3613                     res@gsnLeftString  = "Combined Plot of "+c_var
3614                     res@tiXAxisString      = "["+unit(varn)+"]"
3615                     res@gsnRightString     = " "
3616                     if (xs .EQ. -1) then
3617                        res@trXMinF = min(mini)
3618                     else
3619                        res@trXMinF = xs
3620                     end if
3621                     if (xe .EQ. -1) then
3622                        res@trXMaxF = max(maxi)
3623                     else
3624                        res@trXMaxF = xe 
3625                     end if
3626                  end if
3627               end if
3628               label(n_o)=vNam(varn)
3629               color_o(n_o)=237
3630               plot_o(n_o)=gsn_csm_xy(wks,data(varn,:,:),z,res)
3631               n_o=n_o+1
3632            end if
3633            if (prof3d .EQ. 0)then
3634               varn=varn+1
3635            end if           
3636         end if
3637      end do
3638   
3639      if(number_comb .EQ. 2)then
3640         if (co .EQ. 2)then
3641            overlay(plot_o(0),plot_o(1))
3642         else
3643            print(" ")
3644            print("combining is not possible,")
3645            print("'c_var'(= "+c_var+") must include two variables of the general plots = ")
3646            print("- "+com_var_avail)
3647            print("be sure to have one comma berfore and after the variable")
3648            print(" ")
3649            exit 
3650         end if
3651      end if
3652      if(number_comb .EQ. 3)then
3653         if (co .EQ. 3)then
3654            overlay(plot_o(0),plot_o(1))
3655            overlay(plot_o(0),plot_o(2))
3656         else
3657            print(" ")
3658            print("combining is not possible,")
3659            print("'c_var'(= "+c_var+") must include three variables of the general plots = ")
3660            print("- "+com_var_avail)
3661            print("be sure to have one comma berfore and after the variable")
3662            print(" ")
3663            exit
3664         end if
3665      end if
3666
3667      ; ***************************************************
3668      ; legend for combined plot
3669      ; ***************************************************
3670     
3671      lgres                    = True
3672      lgMonoDashIndex          = False
3673      lgres@lgDashIndexes      = (/0,1,2/)
3674      lgres@lgLabelFont        = "helvetica"   
3675      lgres@lgLabelFontHeightF = font_size_legend           
3676      lgres@vpWidthF           = 0.12           
3677      lgres@vpHeightF          = 0.1           
3678 
3679      lbid = gsn_create_legend(wks,number_comb,label,lgres)       
3680
3681      amres = True
3682      amres@amParallelPosF   = 0.65                 
3683      amres@amOrthogonalPosF = -0.2           
3684      annoid1 = gsn_add_annotation(plot_o(0),lbid,amres)
3685   
3686      plot(0) = plot_o(0)
3687
3688   end if
3689
3690   ; ***************************************************
3691   ; merge plots onto one page
3692   ; ***************************************************
3693
3694   do m=0,n-1
3695      plot_(m)=plot(n-1-m)
3696   end do
3697
3698   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
3699      gsn_panel(wks,plot_,(/n,1/),resP)
3700   else   
3701      do i = 0,n-1, no_rows*no_columns
3702         if( (i+no_rows*no_columns) .gt. (n-1)) then
3703            gsn_panel(wks,plot_(i:n-1),(/no_rows,no_columns/),resP)
3704         else
3705           gsn_panel(wks,plot_(i:i+no_rows*no_columns-1),(/no_rows,no_columns/),resP)
3706         end if
3707      end do
3708   end if
3709
3710   print(" ")
3711   print("Output to: " + file_out +"."+ format_out)
3712   print(" ")
3713
3714end
Note: See TracBrowser for help on using the repository browser.