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

Last change on this file since 218 was 218, checked in by letzel, 16 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
RevLine 
[154]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"
[190]4
5;***************************************************
6; load ncl_preferences.ncl
7;***************************************************
[194]8
9function which_script()
10local script
11begin
12   script="profiles"
13   return(script)
14end
[190]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   
[154]29begin
30
[190]31   ;***************************************************
32   ; set up default parameter values and strings
33   ;***************************************************
34
[218]35   if (no_files .LT. 1 .OR. no_files .GT. 6) then
[190]36      print(" ")
[218]37      print("Assign 'no_files' between 1 and 6") 
[190]38      print(" ")
39      exit
[175]40   end if
[190]41   
[218]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   
[190]47   if (file_1 .EQ. "File in") then
48      print(" ")
[218]49      print("Declare 1st input file 'file_1=' in 'ncl_preferences.ncl' or prompt")
[190]50      print(" ")
51      exit
[175]52   else
53      file_in(0) = file_1   
[218]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
[175]62      print(" ")
[218]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
[175]68      print(" ")
[218]69      print("'end_f_1' must be one of the cyclic numbers (at least 0) of your input file(s)")
70      print(" ") 
[175]71      exit
[218]72   end if           
73   start_f(0) = start_f_1
74   end_f(0) = end_f_1   
75     
[190]76   if (prof3d .EQ. -1)then
77      print(" ")
[218]78      print("Set 'prof3d' to 0 or 1")
[190]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 
[175]90   if (no_files .GT. 1) then
[190]91      if (file_2 .EQ. "File in") then
92         print(" ")
[218]93         print("Declare 2nd input file 'file_2=' in 'ncl_preferences.ncl' or prompt")
[190]94         print(" ")
95         exit
[175]96      else
[190]97         file_in(1) = file_2   
[218]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     
[175]104      end if
[218]105      if (start_f_2 .EQ. -1)then
[175]106         print(" ")
[218]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
[175]112         print(" ")
[218]113         print("'end_f_2' must be one of the cyclic numbers (at least 0) of your input file(s)")
114         print(" ") 
[175]115         exit
[218]116      end if     
117      start_f(1) = start_f_2
118      end_f(1) = end_f_2   
119   end if   
[190]120   
[175]121   if (no_files .GT. 2) then
[190]122      if (file_3 .EQ. "File in") then
123         print(" ")
[218]124         print("Declare 3rd input file 'file_3=' in 'ncl_preferences.ncl' or prompt")
[190]125         print(" ")
126         exit
[175]127      else
[190]128         file_in(2) = file_3   
[218]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     
[175]135      end if
[218]136      if (start_f_3 .EQ. -1)then
[175]137         print(" ")
[218]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
[175]143         print(" ")
[218]144         print("'end_f_3' must be one of the cyclic numbers (at least 0) of your input file(s)")
145         print(" ") 
[175]146         exit
[218]147      end if     
148      start_f(2) = start_f_3
149      end_f(2) = end_f_3 
[175]150   end if
[190]151   
[175]152   if (no_files .GT. 3) then
[190]153      if (file_4 .EQ. "File in") then
154         print(" ")
[218]155         print("Declare 4th input file 'file_4=' in 'ncl_preferences.ncl' or prompt")
[190]156         print(" ")
157         exit
[175]158      else
[190]159         file_in(3) = file_4   
[218]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     
[175]166      end if
[218]167      if (start_f_4 .EQ. -1)then
[175]168         print(" ")
[218]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
[175]174         print(" ")
[218]175         print("'end_f_4' must be one of the cyclic numbers (at least 0) of your input file(s)")
176         print(" ") 
[175]177         exit
[218]178      end if     
179      start_f(3) = start_f_4
180      end_f(3) = end_f_4
[175]181   end if
[190]182   
[175]183   if (no_files .GT. 4) then
[190]184      if (file_5 .EQ. "File in") then
185         print(" ")
[218]186         print("Declare 5th input file 'file_5=' in 'ncl_preferences.ncl' or prompt")
[190]187         print(" ")
188         exit
[175]189      else
[190]190         file_in(4) = file_5   
[218]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     
[175]197      end if
[218]198      if (start_f_5 .EQ. -1)then
[175]199         print(" ")
[218]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
[175]205         print(" ")
[218]206         print("'end_f_5' must be one of the cyclic numbers (at least 0) of your input file(s)")
207         print(" ") 
[175]208         exit
[218]209      end if     
210      start_f(4) = start_f_5
211      end_f(4) = end_f_5   
[175]212   end if
[218]213   
[175]214   if (no_files .GT. 5) then
[190]215      if (file_6 .EQ. "File in") then
216         print(" ")
[218]217         print("Declare 6th input file 'file_6=' in 'ncl_preferences.ncl' or prompt")
[190]218         print(" ")
219         exit
[175]220      else
[190]221         file_in(5) = file_6   
[218]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     
[175]228      end if
[218]229      if (start_f_6 .EQ. -1)then
[175]230         print(" ")
[218]231         print("'start_f_6' must be one of the cyclic numbers (at least 0) of your input file(s)")
232         print(" ") 
[175]233         exit
[218]234      end if
235      if (end_f_6 .EQ. -1)then
[190]236         print(" ")
[218]237         print("'end_f_6' must be one of the cyclic numbers (at least 0) of your input file(s)")
238         print(" ") 
[175]239         exit
[218]240      end if     
241      start_f(5) = start_f_6
242      end_f(5) = end_f_6   
[175]243   end if
[218]244
[190]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 
[175]252
[190]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
[154]258   end if
[190]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(" ")
[154]264   end if
[190]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
[154]271   end if
[190]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(" ")
[218]280      print("Set 'number_comb' to 2 or 3 or combine to 0")
[190]281      print(" ")
282      exit
[154]283   end if
[190]284   if (combine .EQ. 1)then
285      if (number_comb .EQ. -1) then
286         print(" ")
[218]287         print("Set 'number_comb' to 2 or 3 or combine to 0")
[175]288         print(" ")
[190]289         exit
[175]290      end if
[190]291      if (number_comb .NE. 2 .AND. number_comb .NE. 3) then
292         print(" ")
[218]293         print("Set 'number_comb' to 2 or 3 or combine to 0")
[175]294         print(" ")
295         exit
296      end if
[190]297   end if 
298   if (combine .EQ. 1 .AND. c_var .EQ. "c_variables") then
299      print(" ")
[218]300      print("Select variables for overlaying ('c_var') or set combine to 0")
[190]301      print(" ")
302      exit
[174]303   end if
[175]304
[218]305   if (log_z .NE. 0 .AND. log_z .NE. 1)then
[190]306      print(" ")
[218]307      print("'log_z'= "+log_z+" is invalid and set to 0")
[190]308      print(" ")
[218]309      log_z = 0
[190]310   end if   
311 
[218]312   if (norm_z .EQ. 0) then
[190]313      print(" ")
[218]314      print("Normalising with 0 is not allowed, 'norm_z' is set to 1.0")
[190]315      print(" ")
[218]316      norm_z = 1.0
[175]317   end if
318
[190]319   ;***************************************************
[154]320   ; open input file
[190]321   ;***************************************************
[154]322
[175]323   do nof=0,no_files-1
[174]324
[218]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")
[175]372   
[218]373   vNam = getfilevarnames(f_att)
374
[175]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(" ")
[190]381         print("There are 'no_files'="+no_files+" input files but they do not contain the same variables")
[175]382         print(" ")
383         exit
384      else
385         do i=0,dim0-1
386            if (vNam0(i) .NE. vNam(i))then
387               print(" ")
[190]388               print("There are 'no_files'="+no_files+" input files but they do not contain the same variables")
[175]389               print(" ")
390               exit
391            end if
392         end do
393      end if
394   end if
395   nof=nof+1
[154]396   print(" ")
[190]397   print("Variables in input file "+nof+":")
398   print("- "+ vNam)
[154]399   print(" ")
[175]400   nof=nof-1
[161]401   dim = dimsizes(vNam)
[175]402   dim0=dim
[174]403 
[161]404   if (dim .EQ. 0) then
405      print(" ")
[218]406      print("There is no data on file")
[161]407      print(" ")
408   end if
409
[175]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
[174]423   if (prof3d .EQ. 0) then
[175]424 
[161]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
[175]430      if (vNam(varn) .EQ. "u" .OR. isStrSubset(vNam(varn), "u_"))then
[218]431         z_u = f_att->$vNam(varn+1)$
[161]432         break
433      else
[190]434         if (vNam(varn) .EQ. "v" .OR. isStrSubset(vNam(varn), "v_"))then 
[218]435            z_u = f_att->$vNam(varn+1)$
[161]436            break
437         else
[174]438            if(vNam(varn) .EQ. "pt" .OR. isStrSubset(vNam(varn), "pt_"))then
[218]439               z_u = f_att->$vNam(varn+1)$
[161]440               break
441            else
[174]442               if(vNam(varn) .EQ. "vpt" .OR. isStrSubset(vNam(varn), "vpt_"))then
443                  z_u = f->$vNam(varn+1)$
[161]444                  break
445               else
[174]446                  if(vNam(varn) .EQ. "lpt" .OR. isStrSubset(vNam(varn), "lpt_"))then
[218]447                     z_u = f_att->$vNam(varn+1)$
[161]448                     break
449                  else   
[174]450                     if(vNam(varn) .EQ. "q" .OR. isStrSubset(vNam(varn), "q_") )then
[218]451                        z_u = f_att->$vNam(varn+1)$
[161]452                        break
453                     else
[174]454                        if(vNam(varn) .EQ. "qv" .OR. isStrSubset(vNam(varn), "qv_"))then
[218]455                           z_u = f_att->$vNam(varn+1)$
[161]456                           break
457                        else
[174]458                           if(vNam(varn) .EQ. "ql" .OR. isStrSubset(vNam(varn), "ql_"))then
[218]459                              z_u = f_att->$vNam(varn+1)$
[161]460                              break
461                           else
[174]462                              if(vNam(varn) .EQ. "rho" .OR. isStrSubset(vNam(varn), "rho_"))then
[218]463                                 z_u = f_att->$vNam(varn+1)$
[161]464                                 break
465                              else
[174]466                                 if(vNam(varn) .EQ. "s" .OR. isStrSubset(vNam(varn), "s_") )then
[218]467                                    z_u = f_att->$vNam(varn+1)$
[161]468                                    break
469                                 else
[174]470                                    if(vNam(varn) .EQ. "sa" .OR. isStrSubset(vNam(varn), "sa_"))then
[218]471                                       z_u = f_att->$vNam(varn+1)$
[161]472                                       break
473                                    else
[174]474                                       if(vNam(varn) .EQ. "e" .OR. isStrSubset(vNam(varn), "e_"))then
[218]475                                          z_u = f_att->$vNam(varn+1)$
[161]476                                          break
477                                       else
[174]478                                          if(vNam(varn) .EQ. "es" .OR. isStrSubset(vNam(varn), "es_"))then
[218]479                                             z_u = f_att->$vNam(varn+1)$
[161]480                                             break
481                                          else
[174]482                                             if(vNam(varn) .EQ. "km" .OR. isStrSubset(vNam(varn), "km_"))then
[218]483                                                z_u = f_att->$vNam(varn+1)$
[161]484                                                break
485                                             else
[174]486                                                if(vNam(varn) .EQ. "kh" .OR. isStrSubset(vNam(varn), "kh_"))then
[218]487                                                   z_u = f_att->$vNam(varn+1)$
[161]488                                                   break
489                                                else
[174]490                                                   if(vNam(varn) .EQ. "l" .OR. isStrSubset(vNam(varn), "l_"))then
[218]491                                                      z_u = f_att->$vNam(varn+1)$
[161]492                                                      break
493                                                   else
[174]494                                                      if(vNam(varn) .EQ. "us2" .OR. isStrSubset(vNam(varn), "us2_"))then
[218]495                                                         z_u = f_att->$vNam(varn+1)$
[161]496                                                         break
497                                                      else
[174]498                                                         if(vNam(varn) .EQ. "vs2" .OR. isStrSubset(vNam(varn), "vs2_") )then
[218]499                                                            z_u = f_att->$vNam(varn+1)$
[161]500                                                            break
501                                                         else
[174]502                                                            if(vNam(varn) .EQ. "pts2" .OR. isStrSubset(vNam(varn), "pts2_"))then
[218]503                                                               z_u = f_att->$vNam(varn+1)$
[161]504                                                               break
505                                                            else
[174]506                                                               if(vNam(varn) .EQ. "wsususodz" .OR. isStrSubset(vNam(varn), "wsususodz_"))then
[218]507                                                                  z_u = f_att->$vNam(varn+1)$
[161]508                                                                  break
509                                                               else
[174]510                                                                  if(vNam(varn) .EQ. "wspsodz" .OR. isStrSubset(vNam(varn), "wspsodz_"))then
[218]511                                                                     z_u = f_att->$vNam(varn+1)$
[161]512                                                                     break
513                                                                  else
[174]514                                                                     if(vNam(varn) .EQ. "wpeodz" .OR. isStrSubset(vNam(varn), "wpeodz_"))then
[218]515                                                                        z_u = f_att->$vNam(varn+1)$
[161]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
[175]547      if (vNam(varn) .EQ. "w" .OR. isStrSubset(vNam(varn), "w_"))then
[218]548         z_w = f_att->$vNam(varn+1)$
[161]549         break
550      else
[174]551         if (vNam(varn) .EQ. "wpup" .OR. isStrSubset(vNam(varn), "wpup_"))then
[218]552            z_w = f_att->$vNam(varn+1)$
[161]553            break
554         else
[174]555            if(vNam(varn) .EQ. "wsus" .OR. isStrSubset(vNam(varn), "wsus_"))then
[218]556               z_w = f_att->$vNam(varn+1)$
[161]557               break
558            else
[174]559               if(vNam(varn) .EQ. "wu" .OR. isStrSubset(vNam(varn), "wu_"))then
[218]560                  z_w = f_att->$vNam(varn+1)$
[161]561                  break
562               else
[174]563                  if(vNam(varn) .EQ. "wpvp" .OR. isStrSubset(vNam(varn), "wpvp_"))then
[218]564                     z_w = f_att->$vNam(varn+1)$
[161]565                     break
566                  else   
[174]567                     if(vNam(varn) .EQ. "wsvs" .OR. isStrSubset(vNam(varn), "wsvs_"))then
[218]568                        z_w = f_att->$vNam(varn+1)$
[161]569                        break
570                     else
[174]571                        if(vNam(varn) .EQ. "wv" .OR. isStrSubset(vNam(varn), "wv_"))then
[218]572                           z_w = f_att->$vNam(varn+1)$
[161]573                           break
574                        else
[174]575                           if(vNam(varn) .EQ. "wptpp" .OR. isStrSubset(vNam(varn), "wptpp_"))then
[218]576                              z_w = f_att->$vNam(varn+1)$
[161]577                              break
578                           else
[174]579                              if(vNam(varn) .EQ. "wspts" .OR. isStrSubset(vNam(varn), "wspts_"))then
[218]580                                 z_w = f_att->$vNam(varn+1)$
[161]581                                 break
582                              else
[174]583                                 if(vNam(varn) .EQ. "wpt" .OR. isStrSubset(vNam(varn), "wpz_"))then
[218]584                                    z_w = f_att->$vNam(varn+1)$
[161]585                                    break
586                                 else
[174]587                                    if(vNam(varn) .EQ. "wsptsBC" .OR. isStrSubset(vNam(varn), "wsptsBC_"))then
[218]588                                       z_w = f_att->$vNam(varn+1)$
[161]589                                       break
590                                    else
[174]591                                       if(vNam(varn) .EQ. "wptBC" .OR. isStrSubset(vNam(varn), "wptBC_"))then
[218]592                                          z_w = f_att->$vNam(varn+1)$
[161]593                                          break
594                                       else
[174]595                                          if(vNam(varn) .EQ. "wpvptp" .OR. isStrSubset(vNam(varn), "wpvptp_"))then
[218]596                                             z_w = f_att->$vNam(varn+1)$
[161]597                                             break
598                                          else
[174]599                                             if(vNam(varn) .EQ. "wsvpts" .OR. isStrSubset(vNam(varn), "wsvpts_"))then
[218]600                                                z_w = f_att->$vNam(varn+1)$
[161]601                                                break
602                                             else
[174]603                                                if(vNam(varn) .EQ. "wvpt" .OR. isStrSubset(vNam(varn), "wvpt_"))then
[218]604                                                   z_w = f_att->$vNam(varn+1)$
[161]605                                                   break
606                                                else
[174]607                                                   if(vNam(varn) .EQ. "wpqp" .OR. isStrSubset(vNam(varn), "wpqp_"))then
[218]608                                                      z_w = f_att->$vNam(varn+1)$
[161]609                                                      break
610                                                   else
[174]611                                                      if(vNam(varn) .EQ. "wsqs" .OR. isStrSubset(vNam(varn), "wsqs_"))then
[218]612                                                         z_w = f_att->$vNam(varn+1)$
[161]613                                                         break
614                                                      else
[174]615                                                         if(vNam(varn) .EQ. "wq" .OR. isStrSubset(vNam(varn), "wq_"))then
[218]616                                                            z_w = f_att->$vNam(varn+1)$
[161]617                                                            break
618                                                         else
[174]619                                                            if(vNam(varn) .EQ. "wpqvp" .OR. isStrSubset(vNam(varn), "wpqvp_"))then
[218]620                                                               z_w = f_att->$vNam(varn+1)$
[161]621                                                               break
622                                                            else
[174]623                                                               if(vNam(varn) .EQ. "wsqvs" .OR. isStrSubset(vNam(varn), "wsqvs_"))then
[218]624                                                                  z_w = f_att->$vNam(varn+1)$
[161]625                                                                  break
626                                                               else
[174]627                                                                  if(vNam(varn) .EQ. "wqv" .OR. isStrSubset(vNam(varn), "wqv_"))then
[218]628                                                                     z_w = f_att->$vNam(varn+1)$
[161]629                                                                     break
630                                                                  else
[174]631                                                                     if(vNam(varn) .EQ. "wpsp" .OR. isStrSubset(vNam(varn), "wpsp_"))then
[218]632                                                                        z_w = f_att->$vNam(varn+1)$
[161]633                                                                        break
634                                                                     else
[174]635                                                                        if(vNam(varn) .EQ. "wsss" .OR. isStrSubset(vNam(varn), "wsss_"))then
[218]636                                                                           z_w = f_att->$vNam(varn+1)$
[161]637                                                                           break
638                                                                        else
[174]639                                                                           if(vNam(varn) .EQ. "ws" .OR. isStrSubset(vNam(varn), "ws_"))then
[218]640                                                                              z_w = f_att->$vNam(varn+1)$
[161]641                                                                              break
642                                                                           else
[174]643                                                                              if(vNam(varn) .EQ. "wpsap" .OR. isStrSubset(vNam(varn), "wpsap_"))then
[218]644                                                                                 z_w = f_att->$vNam(varn+1)$
[161]645                                                                                 break
646                                                                              else
[174]647                                                                                 if(vNam(varn) .EQ. "wssas" .OR. isStrSubset(vNam(varn), "wssas_") )then
[218]648                                                                                    z_w = f_att->$vNam(varn+1)$
[161]649                                                                                    break
650                                                                                 else
[174]651                                                                                    if(vNam(varn) .EQ. "wsa" .OR. isStrSubset(vNam(varn), "wsa_"))then
[218]652                                                                                       z_w = f_att->$vNam(varn+1)$
[161]653                                                                                       break
654                                                                                    else
[174]655                                                                                       if(vNam(varn) .EQ. "wses" .OR. isStrSubset(vNam(varn), "wses_"))then
[218]656                                                                                          z_w = f_att->$vNam(varn+1)$
[161]657                                                                                          break
658                                                                                       else
[174]659                                                                                          if(vNam(varn) .EQ. "ws2" .OR. isStrSubset(vNam(varn), "ws2_"))then
[218]660                                                                                             z_w = f_att->$vNam(varn+1)$
[161]661                                                                                             break
662                                                                                          else
[174]663                                                                                             if(vNam(varn) .EQ. "ws3" .OR. isStrSubset(vNam(varn), "ws3_"))then
[218]664                                                                                                z_w = f_att->$vNam(varn+1)$
[161]665                                                                                                break
666                                                                                             else
[174]667                                                                                                if(vNam(varn) .EQ. "Sw" .OR. isStrSubset(vNam(varn), "Sw_"))then
[218]668                                                                                                   z_w = f_att->$vNam(varn+1)$
[161]669                                                                                                   break
670                                                                                                else
[174]671                                                                                                   if(vNam(varn) .EQ. "ws2pts".OR. isStrSubset(vNam(varn), "ws2pts_") )then
[218]672                                                                                                      z_w = f_att->$vNam(varn+1)$
[161]673                                                                                                      break
674                                                                                                   else
[174]675                                                                                                      if(vNam(varn) .EQ. "wspts2" .OR. isStrSubset(vNam(varn), "wspts2_"))then
[218]676                                                                                                         z_w = f_att->$vNam(varn+1)$
[161]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
[190]713   
714   if (.not. isvar("z_u") .AND. .not. isvar ("z_w")) then
[175]715      co=0
[161]716      do varn=0,dim-1     
717         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
718            check = False
719         else
[190]720            check = True
721            if (var .NE. "all") then
[161]722               check = isStrSubset( var,","+vNam(varn)+"," )
[190]723            end if         
[161]724         end if
[175]725         if (check)then
726            co=co+1
[218]727            z = f_att->$vNam(varn+1)$
[190]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
[161]735            dimz = dimsizes(z)
736            break
737         end if   
738      end do
[175]739      if (co .EQ. 0) then
740         print(" ")
[190]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")
[175]743         print(" ")
744         exit
745      end if
[161]746   end if
[175]747
[162]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
[174]755
756   else
757
758      do varn = dim-1,0,1
[175]759         if (vNam(varn) .EQ. "zu_3d")then
[218]760            z_u = f_att->zu_3d 
[174]761            dimz  = dimsizes(z_u)         
762         else
[175]763            if (vNam(varn) .EQ. "zw_3d")then
[218]764               z_w = f_att->zw_3d
[174]765               dimz  = dimsizes(z_w)
766            end if
767         end if
[218]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
[174]786      end do
787
788   end if
789   
[190]790   if(.not. isvar("z_u") .AND. .not. isvar("z_w"))then
791      print(" ")
792      print("Program aborts - there are no z-variables available")
[218]793      print("Be sure if 'plot_3d' is set correctly")
[190]794      print(" ")
795      exit
796   end if
797   
[218]798   if (prof3d .EQ. 1)then
799      t_all = f[:]->time
800   else
801      t_all = f[:]->time(1:)
802   end if
[154]803   nt    = dimsizes(t_all)
[162]804   delta_t=t_all(nt-1)/nt
[174]805
[154]806   ; ****************************************************       
807   ; start of time step and different types of mistakes that could be done
808   ; ****************************************************
[175]809   
[190]810   if (start_time_step .EQ. -1.) then           
811      start_time_step=t_all(0)/3600     
[154]812   else
[175]813      if (start_time_step .GT. t_all(nt-1)/3600)then
[154]814         print(" ")
[162]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")
[154]816         print(" ")
[218]817         print("Select another 'start_time_step'")
[162]818         print(" ")
[154]819         exit
820      end if
[175]821      if (start_time_step .LT. t_all(0)/3600)then
[154]822         print(" ")
[174]823         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
[190]824         print(" ")
[154]825         exit
826      end if
827   end if
[175]828
[218]829   do i=0,nt-1   
[190]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
[162]831         st=i
832         break
833      end if
834   end do
[190]835   if (.not. isvar("st"))then
836      print(" ")
837      print("'start_time_step' = "+ start_time_step +"h is invalid")
838      print(" ")
[218]839      print("Select another 'start_time_step'")
[190]840      print(" ")
841      exit
842   end if
[174]843   
[154]844   ; ****************************************************
845   ; end of time step and different types of mistakes that could be done
846   ; ****************************************************
847
[190]848   if (end_time_step .EQ. -1.) then             
849      end_time_step = t_all(nt-1)/3600 
[154]850   else
[175]851      if (end_time_step .GT. t_all(nt-1)/3600)then
[154]852         print(" ")
[162]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")
[154]854         print(" ")
[218]855         print("Select another 'end_time_step'") 
[162]856         print(" ")
[154]857         exit
858      end if
[175]859      if (end_time_step .LT. start_time_step/3600)then
[154]860         print(" ")
[162]861         print("'end_time_step' = "+ end_time_step +"h is lower than 'start_time_step' = "+start_time_step+"h")
[154]862         print(" ")
[218]863         print("Select another 'start_time_step' or 'end_time_step'")
[162]864         print(" ")
[154]865         exit
866      end if
[162]867   end if
[175]868
[174]869   do i=0,nt-1     
[190]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
[162]871         et=i
872         break
[154]873      end if
[162]874   end do
[190]875   if (.not. isvar("et"))then
876      print(" ")
877      print("'end_time_step' = "+ end_time_step +"h is invalid")
878      print(" ")
[218]879      print("Select another 'end_time_step'")
[190]880      print(" ")
881      exit
882   end if
[154]883
[162]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
[175]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
[154]894   ; ****************************************************
895   ; set up legend and colors
896   ; ****************************************************
897   
[161]898   legend_label=new(nt,double)
[154]899   do p=start_time_step,end_time_step
[175]900      if (t_all(p)/3600 .LT. 1) then
[218]901         legend_label(p-start_time_step)=decimalPlaces(t_all(p)/3600,3,True)
[175]902      else
903         legend_label(p-start_time_step)=decimalPlaces(t_all(p)/3600,0,True)
904      end if
[154]905   end do
906   
[162]907   np = end_time_step-start_time_step+1 
[154]908
909   ; ***************************************************
910   ; set up recourses
911   ; ***************************************************
912
[175]913   res                         = True
[154]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
[161]931   res@pmLegendParallelPosF    = 1.15
932   res@pmLegendOrthogonalPosF  = -1.0
[154]933   res@pmLegendWidthF          = 0.12
[175]934   res@pmLegendHeightF         = 0.04*(end_time_step-start_time_step+1)
[218]935   res@lgLabelFontHeightF     = font_size
[190]936   res@lgTitleString      = "Time [h]"
[218]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
[175]943   res@tiXAxisString      = " "
944   if ( black .eq. 0 ) then 
945      res@xyLineColors = ispan(2,237,235/np)
946   end if
[218]947   if (norm_z .EQ. 1)then
[175]948      res@tiYAxisString      = "Height [m]"
949   else   
[218]950      res@tiYAxisString      = "Height / "+norm_z+" [m]"
[175]951   end if
952   
[218]953   if (log_z .EQ. 1) then
[175]954      res@trYLog = True
955   end if
956
[190]957   if (dash .EQ. 0 ) then
[175]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(" ")
[190]965      end if       
[154]966   end if
[218]967   
968   res@tmXBMinorPerMajor = 4
969   res@tmYLMinorPerMajor = 4
[154]970
971   resP                        = True
972   resP@txFont                 = "helvetica"
[218]973   resP@txString               = f_att@title
[154]974   resP@txFuncCode             = "~"
[218]975   resP@txFontHeightF          = 0.015
[154]976
977   ; ***************************************************
[161]978   ; set up graphics for plot
[154]979   ; ***************************************************
[161]980
[154]981   if (combine .EQ. 1) then
[190]982      plot_o = new(number_comb,graphic)   
[161]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)
[154]987   end if
[190]988 
[154]989   wks=gsn_open_wks(format_out,file_out)
990   gsn_define_colormap(wks,"rainbow+white")
[161]991
[154]992   ; ***************************************************
993   ; set up minimum and maximum height
[175]994   ; ***************************************************
[154]995
[218]996   if (log_z .EQ. 1)then
[190]997      if (min_z .EQ. -1)then
[175]998         if (isvar("z_u"))then
999            min_z=z_u(1)
1000         else
1001            min_z=z_w(1)
[190]1002         end if       
[175]1003      else
[190]1004         if (isvar("z_w"))then
1005            if (min_z .GE. max(z_w) ) then
[175]1006               print(" ")
[190]1007               print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_w)+")")
[175]1008               print(" ")
1009               exit
[190]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
[175]1025            end if
[190]1026         else
1027            if (min_z .LT. z_w(1) ) then
[175]1028               print(" ")
[190]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")
[175]1030               print(" ")
1031               exit
[190]1032            end if   
[175]1033         end if
[190]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
[175]1040      else
[190]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
[175]1047            print(" ")
[190]1048            print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_w)+")")
[175]1049            print(" ")
1050            exit
1051         end if
[190]1052      else
1053         if (min_z .EQ. -1)then
1054            min_z=z_u(0)
[175]1055         end if
[190]1056         if (min_z .GE. max(z_u) ) then
[154]1057            print(" ")
[190]1058            print("Minimum of height ('min_z'="+min_z+") is greater than available heights (="+max(z_u)+")")
[154]1059            print(" ")
1060            exit
1061         end if
1062      end if
[190]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
[154]1069   else
[190]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
[154]1077         print(" ")
[190]1078         print("Maximum of height ('max_z'="+max_z+") is greater than available heights (="+max(z_w)+")")
[154]1079         print(" ")
1080         exit
1081      end if
1082   end if
1083
[218]1084   min_z=min_z/norm_z
1085   max_z=max_z/norm_z
[175]1086
[154]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 
[175]1097   
[218]1098   if (log_z .EQ. 1) then
[175]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
[157]1159
[175]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
[161]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
[218]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 
[161]1390   n_o=0
[162]1391   count_var=0
[174]1392
[161]1393   do varn = 0,dim-1
[174]1394
1395      check = True
[161]1396     
[174]1397      if (prof3d .EQ. 0) then
1398         if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
1399            check = False
1400         end if
[154]1401      else
[174]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
[190]1407      if (var .NE. "all") then
[174]1408         check = isStrSubset( var,","+vNam(varn)+"," )
[154]1409      end if
[161]1410
1411      if (combine .EQ. 1) then         
1412         com=isStrSubset(c_var,","+vNam(varn)+"," )     
[175]1413         if (com) then     
[174]1414            if (prof3d .EQ. 0) then
[218]1415               temp = f[:]->$vNam(varn)$(1:,:)
1416               temp_att = f_att->$vNam(varn)$
1417               if (log_z .EQ. 1) then
[175]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
[174]1422            else
[218]1423               if (log_z .EQ. 1) then
[175]1424                  do i=1,dimz-1
1425                     do j=start_time_step,end_time_step
[218]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))
[175]1430                     end do
[174]1431                  end do
[175]1432               else
1433                  do i=0,dimz-1
1434                     do j=start_time_step,end_time_step
[218]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))
[175]1439                     end do
1440                  end do
1441               end if
[174]1442               print(" ")
1443               print("Variable for combine '"+vNam(varn)+"' is read")
1444               print(" ")
1445            end if                 
[218]1446            unit(varn) = temp_att@units
[161]1447            if (n_o .GT. number_comb-1) then
1448               print(" ")
[218]1449               print("Set 'number_comb' to the number of overlaying variables ('c_var' = "+c_var+")")
[161]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
[175]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       
[162]1467         count_var=count_var+1
[174]1468
1469         if (prof3d .EQ. 0) then
[218]1470            temp = f[:]->$vNam(varn)$(1:,:)
1471            temp_att = f_att->$vNam(varn)$
[174]1472         else
[218]1473             if (log_z .EQ. 1) then
[175]1474               do i=1,dimz-1
1475                  do j=start_time_step,end_time_step
[218]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))
[175]1480                  end do
[174]1481               end do
[175]1482            else
1483               do i=0,dimz-1
1484                  do j=start_time_step,end_time_step
[218]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))
[175]1491                  end do
1492               end do
1493            end if
[174]1494            print(" ")
1495            print("Variable '"+vNam(varn)+"' is read")
1496            print(" ")
[218]1497            unit(varn) = temp_att@units
1498            a=getvardims(temp_att)
[174]1499            b=dimsizes(a)
1500         end if
[218]1501
[174]1502         if (prof3d .EQ. 0) then
[218]1503            if (log_z .EQ. 1) then
1504               z = f_att->$vNam(varn+1)$(1:dimz-1)
1505               unit(varn) = temp_att@units
[175]1506               data(varn,:,:) = temp(start_time_step:end_time_step,1:dimz-1)
1507            else
[218]1508               z = f_att->$vNam(varn+1)$
1509               unit(varn) = temp_att@units
[175]1510               data(varn,:,:) = temp(start_time_step:end_time_step,:)
1511            end if
[174]1512         else
[218]1513            do i=0,b-1           
[175]1514               if (isStrSubset( a(i),"zu_3d" ))then
[174]1515                  z_v(varn,:) = z_u
[218]1516                  if (log_z .EQ. 1) then
[175]1517                     z = z_v(varn,1:dimz-1)
1518                  else
1519                     z = z_v(varn,:)
1520                  end if
[174]1521               else
[175]1522                  if (isStrSubset( a(i),"zw_3d" ))then
[174]1523                     z_v(varn,:) = z_w
[218]1524                     if (log_z .EQ. 1) then
[175]1525                        z = z_v(varn,1:dimz-1)
1526                     else
1527                        z = z_v(varn,:)
1528                     end if
[174]1529                  end if                   
1530               end if
1531            end do           
1532         end if
[175]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
[218]1538            z_(n,:)=z/norm_z
[175]1539            z    = z_(n,:)
1540         else
[218]1541            z=z/norm_z
[175]1542         end if
1543   
[161]1544         if (over .EQ. 0) then 
1545            res@gsnLeftString      = vNam(varn)
[218]1546            res@tiXAxisString      = "["+unit(varn)+"]"
1547            res@gsnRightString     = " "
[161]1548            res@trYMinF            = min_z
[162]1549            res@trYMaxF            = max_z
[190]1550            if (xs .EQ. -1) then
1551               res@trXMinF            = min(data(varn,:,:))
[162]1552            else
1553               res@trXMinF            = xs
1554            end if
[190]1555            if (xe .EQ. -1) then
1556               res@trXMaxF            = max(data(varn,:,:))
[162]1557            else
1558               res@trXMaxF            = xe 
[175]1559            end if         
[161]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
[175]1568                  plot_u = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1569               else
1570                  res@gsnLeftString      = vNam(varn)
[218]1571                  res@tiXAxisString      = "["+unit(varn)+"]"
1572                  res@gsnRightString     = " "                 
[190]1573                  if (xs .EQ. -1) then
1574                     res@trXMinF            = miniu
[162]1575                  else
1576                     res@trXMinF            = xs
1577                  end if
[190]1578                  if (xe .EQ. -1) then       
1579                     res@trXMaxF            = maxiu
[162]1580                  else
1581                     res@trXMaxF            = xe 
1582                  end if               
[175]1583                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res) 
[161]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
[175]1591                  plot_v = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1592               else
1593                  res@gsnLeftString      = vNam(varn)
[218]1594                  res@tiXAxisString      = "["+unit(varn)+"]"
1595                  res@gsnRightString     = " "                 
[190]1596                  if (xs .EQ. -1) then
1597                     res@trXMinF            = miniv
[162]1598                  else
1599                     res@trXMinF            = xs
1600                  end if
[190]1601                  if (xe .EQ. -1) then
1602                     res@trXMaxF            = maxiv
[162]1603                  else
1604                     res@trXMaxF            = xe 
1605                  end if               
[175]1606                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1614                  plot_w = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1615               else
1616                  res@gsnLeftString      = vNam(varn)
[218]1617                  res@tiXAxisString      = "["+unit(varn)+"]"
1618                  res@gsnRightString     = " "
[190]1619                  if (xs .EQ. -1) then
1620                     res@trXMinF            = miniw
[162]1621                  else
1622                     res@trXMinF            = xs
1623                  end if
[190]1624                  if (xe .EQ. -1) then
1625                     res@trXMaxF            = maxiw
[162]1626                  else
1627                     res@trXMaxF            = xe 
1628                  end if           
[175]1629                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1630               end if   
1631            end if
[154]1632
[161]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
[175]1638                  plot_pt = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1639               else
1640                  res@gsnLeftString      = vNam(varn)
[218]1641                  res@tiXAxisString      = "["+unit(varn)+"]"
1642                  res@gsnRightString     = " "
[190]1643                  if (xs .EQ. -1) then
1644                     res@trXMinF            = minipt
[162]1645                  else
1646                     res@trXMinF            = xs
1647                  end if
[190]1648                  if (xe .EQ. -1) then       
1649                     res@trXMaxF            = maxipt
[162]1650                  else
1651                     res@trXMaxF            = xe 
1652                  end if
[175]1653                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1661                  plot_vpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1662               else
1663                  res@gsnLeftString      = vNam(varn)
[218]1664                  res@tiXAxisString      = "["+unit(varn)+"]"
1665                  res@gsnRightString     = " "
[190]1666                  if (xs .EQ. -1) then
1667                     res@trXMinF            = minivpt
[162]1668                  else
1669                     res@trXMinF            = xs
1670                  end if
[190]1671                  if (xe .EQ. -1) then       
1672                     res@trXMaxF            = maxivpt
[162]1673                  else
1674                     res@trXMaxF            = xe 
[190]1675                  end if
[175]1676                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1684                  plot_lpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1685               else
1686                  res@gsnLeftString      = vNam(varn)
[218]1687                  res@tiXAxisString      = "["+unit(varn)+"]"
1688                  res@gsnRightString     = " "
[190]1689                  if (xs .EQ. -1) then
1690                     res@trXMinF            = minilpt
[162]1691                  else
1692                     res@trXMinF            = xs
1693                  end if
[190]1694                  if (xe .EQ. -1) then       
1695                     res@trXMaxF            = maxilpt
[162]1696                  else
1697                     res@trXMaxF            = xe 
1698                  end if
[175]1699                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1708                  plot_q = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1709               else
1710                  res@gsnLeftString      = vNam(varn)
[218]1711                  res@tiXAxisString      = "["+unit(varn)+"]"
1712                  res@gsnRightString     = " "
[190]1713                  if (xs .EQ. -1) then
1714                     res@trXMinF            = minilq
[162]1715                  else
1716                     res@trXMinF            = xs
1717                  end if
[190]1718                  if (xe .EQ. -1) then       
1719                     res@trXMaxF            = maxilq
[162]1720                  else
1721                     res@trXMaxF            = xe 
1722                  end if
[175]1723                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1731                  plot_qv = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1732               else
1733                  res@gsnLeftString      = vNam(varn)
[218]1734                  res@tiXAxisString      = "["+unit(varn)+"]"
1735                  res@gsnRightString     = " "
[190]1736                  if (xs .EQ. -1) then
1737                     res@trXMinF            = minilqv
[162]1738                  else
1739                     res@trXMinF            = xs
1740                  end if
[190]1741                  if (xe .EQ. -1) then       
1742                     res@trXMaxF            = maxilqv
[162]1743                  else
1744                     res@trXMaxF            = xe 
1745                  end if
[175]1746                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1754                  plot_ql = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1755               else
1756                  res@gsnLeftString      = vNam(varn)
[218]1757                  res@tiXAxisString      = "["+unit(varn)+"]"
1758                  res@gsnRightString     = " "
[190]1759                  if (xs .EQ. -1) then
1760                     res@trXMinF            = miniql
[162]1761                  else
1762                     res@trXMinF            = xs
1763                  end if
[190]1764                  if (xe .EQ. -1) then       
1765                     res@trXMaxF            = maxiql
[162]1766                  else
1767                     res@trXMaxF            = xe 
1768                  end if
[175]1769                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1778                  plot_e = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1779               else
1780                  res@gsnLeftString      = vNam(varn)
[218]1781                  res@tiXAxisString      = "["+unit(varn)+"]"
1782                  res@gsnRightString     = " "
[190]1783                  if (xs .EQ. -1) then
1784                     res@trXMinF            = minie
[162]1785                  else
1786                     res@trXMinF            = xs
1787                  end if
[190]1788                  if (xe .EQ. -1) then       
1789                     res@trXMaxF            = maxie
[162]1790                  else
1791                     res@trXMaxF            = xe 
1792                  end if
[175]1793                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1801                  plot_es = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1802               else
1803                  res@gsnLeftString      = vNam(varn)
[218]1804                  res@tiXAxisString      = "["+unit(varn)+"]"
1805                  res@gsnRightString     = " "
[190]1806                  if (xs .EQ. -1) then
1807                     res@trXMinF            = minies
[162]1808                  else
1809                     res@trXMinF            = xs
1810                  end if
[190]1811                  if (xe .EQ. -1) then       
1812                     res@trXMaxF            = maxies
[162]1813                  else
1814                     res@trXMaxF            = xe 
1815                  end if
[175]1816                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1825                  plot_km = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1826               else
1827                  res@gsnLeftString      = vNam(varn)
[218]1828                  res@tiXAxisString      = "["+unit(varn)+"]"
1829                  res@gsnRightString     = " "
[190]1830                  if (xs .EQ. -1) then
1831                     res@trXMinF            = minikm
[162]1832                  else
1833                     res@trXMinF            = xs
1834                  end if
[190]1835                  if (xe .EQ. -1) then       
1836                     res@trXMaxF            = maxikm
[162]1837                  else
1838                     res@trXMaxF            = xe 
1839                  end if
[175]1840                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1848                  plot_kh = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1849               else
1850                  res@gsnLeftString      = vNam(varn)
[218]1851                  res@tiXAxisString      = "["+unit(varn)+"]"
1852                  res@gsnRightString     = " "
[190]1853                  if (xs .EQ. -1) then
1854                     res@trXMinF            = minikh
[162]1855                  else
1856                     res@trXMinF            = xs
1857                  end if
[190]1858                  if (xe .EQ. -1) then       
1859                     res@trXMaxF            = maxikh
[162]1860                  else
1861                     res@trXMaxF            = xe 
1862                  end if
[175]1863                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1872                  plot_wpup = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1873               else
1874                  res@gsnLeftString      = vNam(varn)
[218]1875                  res@tiXAxisString      = "["+unit(varn)+"]"
1876                  res@gsnRightString     = " "
[190]1877                  if (xs .EQ. -1) then
1878                     res@trXMinF            = miniwpup
[162]1879                  else
1880                     res@trXMinF            = xs
1881                  end if
[190]1882                  if (xe .EQ. -1) then       
1883                     res@trXMaxF            = maxiwpup
[162]1884                  else
1885                     res@trXMaxF            = xe 
1886                  end if
[175]1887                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1895                  plot_wsus = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1896               else
1897                  res@gsnLeftString      = vNam(varn)
[218]1898                  res@tiXAxisString      = "["+unit(varn)+"]"
1899                  res@gsnRightString     = " "
[190]1900                  if (xs .EQ. -1) then
1901                     res@trXMinF            = miniwsus
[162]1902                  else
1903                     res@trXMinF            = xs
1904                  end if
[190]1905                  if (xe .EQ. -1) then       
1906                     res@trXMaxF            = maxiwsus
[162]1907                  else
1908                     res@trXMaxF            = xe 
1909                  end if
[175]1910                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1918                  plot_wu = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1919               else
1920                  res@gsnLeftString      = vNam(varn)
[218]1921                  res@tiXAxisString      = "["+unit(varn)+"]"
1922                  res@gsnRightString     = " "
[190]1923                  if (xs .EQ. -1) then
1924                     res@trXMinF            = miniwu
[162]1925                  else
1926                     res@trXMinF            = xs
1927                  end if
[190]1928                  if (xe .EQ. -1) then       
1929                     res@trXMaxF            = maxiwu
[162]1930                  else
1931                     res@trXMaxF            = xe 
1932                  end if
[175]1933                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1942                  plot_wpvp = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1943               else
1944                  res@gsnLeftString      = vNam(varn)
[218]1945                  res@tiXAxisString      = "["+unit(varn)+"]"
1946                  res@gsnRightString     = " "
[190]1947                  if (xs .EQ. -1) then
1948                     res@trXMinF            = miniwpvp
[162]1949                  else
1950                     res@trXMinF            = xs
1951                  end if
[190]1952                  if (xe .EQ. -1) then       
1953                     res@trXMaxF            = maxiwpvp
[162]1954                  else
1955                     res@trXMaxF            = xe 
1956                  end if
[175]1957                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1965                  plot_wsvs = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1966               else
1967                  res@gsnLeftString      = vNam(varn)
[218]1968                  res@tiXAxisString      = "["+unit(varn)+"]"
1969                  res@gsnRightString     = " "
[190]1970                  if (xs .EQ. -1) then
1971                     res@trXMinF            = miniwsvs
[162]1972                  else
1973                     res@trXMinF            = xs
1974                  end if
[190]1975                  if (xe .EQ. -1) then       
1976                     res@trXMaxF            = maxiwsvs
[162]1977                  else
1978                     res@trXMaxF            = xe 
1979                  end if
[175]1980                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]1988                  plot_wv = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]1989               else
1990                  res@gsnLeftString      = vNam(varn)
[218]1991                  res@tiXAxisString      = "["+unit(varn)+"]"
1992                  res@gsnRightString     = " "
[190]1993                  if (xs .EQ. -1) then
1994                     res@trXMinF            = miniwv
[162]1995                  else
1996                     res@trXMinF            = xs
1997                  end if
[190]1998                  if (xe .EQ. -1) then       
1999                     res@trXMaxF            = maxiwv
[162]2000                  else
2001                     res@trXMaxF            = xe 
2002                  end if
[175]2003                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2012                  plot_wpptp = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2013               else
2014                  res@gsnLeftString      = vNam(varn)
[218]2015                  res@tiXAxisString      = "["+unit(varn)+"]"
2016                  res@gsnRightString     = " "
[190]2017                  if (xs .EQ. -1) then
2018                     res@trXMinF            = miniwpptp
[162]2019                  else
2020                     res@trXMinF            = xs
2021                  end if
[190]2022                  if (xe .EQ. -1) then       
2023                     res@trXMaxF            = maxiwpptp
[162]2024                  else
2025                     res@trXMaxF            = xe 
2026                  end if
[175]2027                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2035                  plot_wspts = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2036               else
2037                  res@gsnLeftString      = vNam(varn)
[218]2038                  res@tiXAxisString      = "["+unit(varn)+"]"
2039                  res@gsnRightString     = " "
[190]2040                  if (xs .EQ. -1) then
2041                     res@trXMinF            = miniwspts
[162]2042                  else
2043                     res@trXMinF            = xs
2044                  end if
[190]2045                  if (xe .EQ. -1) then       
2046                     res@trXMaxF            = maxiwspts
[162]2047                  else
2048                     res@trXMaxF            = xe 
2049                  end if
[175]2050                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2058                  plot_wpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2059               else
2060                  res@gsnLeftString      = vNam(varn)
[218]2061                  res@tiXAxisString      = "["+unit(varn)+"]"
2062                  res@gsnRightString     = " "
[190]2063                  if (xs .EQ. -1) then
2064                     res@trXMinF            = miniwpt
[162]2065                  else
2066                     res@trXMinF            = xs
2067                  end if
[190]2068                  if (xe .EQ. -1) then       
2069                     res@trXMaxF            = maxiwpt
[162]2070                  else
2071                     res@trXMaxF            = xe 
2072                  end if
[175]2073                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2082                  plot_wsptsBC = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2083               else
2084                  res@gsnLeftString      = vNam(varn)
[218]2085                  res@tiXAxisString      = "["+unit(varn)+"]"
2086                  res@gsnRightString     = " "
[190]2087                  if (xs .EQ. -1) then
2088                     res@trXMinF            = miniwsptsBC
[162]2089                  else
2090                     res@trXMinF            = xs
2091                  end if
[190]2092                  if (xe .EQ. -1) then       
2093                     res@trXMaxF            = maxiwsptsBC
[162]2094                  else
2095                     res@trXMaxF            = xe 
[190]2096                  end if
[175]2097                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2105                  plot_wptBC = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2106               else
2107                  res@gsnLeftString      = vNam(varn)
[218]2108                  res@tiXAxisString      = "["+unit(varn)+"]"
2109                  res@gsnRightString     = " "
[190]2110                  if (xs .EQ. -1) then
2111                     res@trXMinF            = miniwptBC
[162]2112                  else
2113                     res@trXMinF            = xs
2114                  end if
[190]2115                  if (xe .EQ. -1) then       
2116                     res@trXMaxF            = maxiwptBC
[162]2117                  else
2118                     res@trXMaxF            = xe 
2119                  end if
[175]2120                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2129                  plot_wpvptp = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2130               else
2131                  res@gsnLeftString      = vNam(varn)
[218]2132                  res@tiXAxisString      = "["+unit(varn)+"]"
2133                  res@gsnRightString     = " "
[190]2134                  if (xs .EQ. -1) then
2135                     res@trXMinF            = miniwpvptp
[162]2136                  else
2137                     res@trXMinF            = xs
2138                  end if
[190]2139                  if (xe .EQ. -1) then       
2140                     res@trXMaxF            = maxiwpvptp
[162]2141                  else
2142                     res@trXMaxF            = xe 
[190]2143                  end if
[175]2144                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2152                  plot_wsvpts = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2153               else
2154                  res@gsnLeftString      = vNam(varn)
[218]2155                  res@tiXAxisString      = "["+unit(varn)+"]"
2156                  res@gsnRightString     = " "
[190]2157                  if (xs .EQ. -1) then
2158                     res@trXMinF            = miniwsvpts
[162]2159                  else
2160                     res@trXMinF            = xs
2161                  end if
[190]2162                  if (xe .EQ. -1) then       
2163                     res@trXMaxF            = maxiwsvpts
[162]2164                  else
2165                     res@trXMaxF            = xe 
[190]2166                  end if
[175]2167                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2175                  plot_wvpt = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2176               else
2177                  res@gsnLeftString      = vNam(varn)
[218]2178                  res@tiXAxisString      = "["+unit(varn)+"]"
2179                  res@gsnRightString     = " "
[190]2180                  if (xs .EQ. -1) then
2181                     res@trXMinF            = miniwvpt
[162]2182                  else
2183                     res@trXMinF            = xs
2184                  end if
[190]2185                  if (xe .EQ. -1) then       
2186                     res@trXMaxF            = maxiwvpt
[162]2187                  else
2188                     res@trXMaxF            = xe 
2189                  end if
[175]2190                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2199                  plot_wpqp = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2200               else
2201                  res@gsnLeftString      = vNam(varn)
[218]2202                  res@tiXAxisString      = "["+unit(varn)+"]"
2203                  res@gsnRightString     = " "
[190]2204                  if (xs .EQ. -1) then
2205                     res@trXMinF            = miniwpqp
[162]2206                  else
2207                     res@trXMinF            = xs
2208                  end if
[190]2209                  if (xe .EQ. -1) then       
2210                     res@trXMaxF            = maxiwpqp
[162]2211                  else
2212                     res@trXMaxF            = xe 
2213                  end if
[175]2214                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2222                  plot_wsqs = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2223               else
2224                  res@gsnLeftString      = vNam(varn)
[218]2225                  res@tiXAxisString      = "["+unit(varn)+"]"
2226                  res@gsnRightString     = " "
[190]2227                  if (xs .EQ. -1) then
2228                     res@trXMinF            = miniwsqs
[162]2229                  else
2230                     res@trXMinF            = xs
2231                  end if
[190]2232                  if (xe .EQ. -1) then       
2233                     res@trXMaxF            = maxiwsqs
[162]2234                  else
2235                     res@trXMaxF            = xe 
2236                  end if
[175]2237                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2245                  plot_wq = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2246               else
2247                  res@gsnLeftString      = vNam(varn)
[218]2248                  res@tiXAxisString      = "["+unit(varn)+"]"
2249                  res@gsnRightString     = " "
[190]2250                  if (xs .EQ. -1) then
2251                     res@trXMinF            = miniwq
[162]2252                  else
2253                     res@trXMinF            = xs
2254                  end if
[190]2255                  if (xe .EQ. -1) then       
2256                     res@trXMaxF            = maxiwq
[162]2257                  else
2258                     res@trXMaxF            = xe 
[190]2259                  end if
[175]2260                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2269                  plot_wpqvp = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2270               else
2271                  res@gsnLeftString      = vNam(varn)
[218]2272                  res@tiXAxisString      = "["+unit(varn)+"]"
2273                  res@gsnRightString     = " "
[190]2274                  if (xs .EQ. -1) then
2275                     res@trXMinF            = miniwpqvp
[162]2276                  else
2277                     res@trXMinF            = xs
2278                  end if
[190]2279                  if (xe .EQ. -1) then       
2280                     res@trXMaxF            = maxiwpqvp
[162]2281                  else
2282                     res@trXMaxF            = xe 
[190]2283                  end if
[175]2284                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2292                  plot_wsqvs = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2293               else
2294                  res@gsnLeftString      = vNam(varn)
[218]2295                  res@tiXAxisString      = "["+unit(varn)+"]"
2296                  res@gsnRightString     = " "
[190]2297                  if (xs .EQ. -1) then
2298                     res@trXMinF            = miniwsqvs
[162]2299                  else
2300                     res@trXMinF            = xs
2301                  end if
[190]2302                  if (xe .EQ. -1) then       
2303                     res@trXMaxF            = maxiwsqvs
[162]2304                  else
2305                     res@trXMaxF            = xe 
2306                  end if
[175]2307                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2315                  plot_wqv = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2316               else
2317                  res@gsnLeftString      = vNam(varn)
[218]2318                  res@tiXAxisString      = "["+unit(varn)+"]"
2319                  res@gsnRightString     = " "
[190]2320                  if (xs .EQ. -1) then
2321                     res@trXMinF            = miniwqv
[162]2322                  else
2323                     res@trXMinF            = xs
2324                  end if
[190]2325                  if (xe .EQ. -1) then       
2326                     res@trXMaxF            = maxiwqv
[162]2327                  else
2328                     res@trXMaxF            = xe 
2329                  end if
[175]2330                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2339                  plot_wpsp = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2340               else
2341                  res@gsnLeftString      = vNam(varn)
[218]2342                  res@tiXAxisString      = "["+unit(varn)+"]"
2343                  res@gsnRightString     = " "
[190]2344                  if (xs .EQ. -1) then
2345                     res@trXMinF            = miniwpsp
[162]2346                  else
2347                     res@trXMinF            = xs
2348                  end if
[190]2349                  if (xe .EQ. -1) then       
2350                     res@trXMaxF            = maxiwpsp
[162]2351                  else
2352                     res@trXMaxF            = xe 
2353                  end if
[175]2354                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2362                  plot_wsss = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2363               else
2364                  res@gsnLeftString      = vNam(varn)
[218]2365                  res@tiXAxisString      = "["+unit(varn)+"]"
2366                  res@gsnRightString     = " "
[190]2367                  if (xs .EQ. -1) then
2368                     res@trXMinF            = miniwsss
[162]2369                  else
2370                     res@trXMinF            = xs
2371                  end if
[190]2372                  if (xe .EQ. -1) then       
2373                     res@trXMaxF            = maxiwsss
[162]2374                  else
2375                     res@trXMaxF            = xe 
2376                  end if
[175]2377                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2385                  plot_ws = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2386               else
2387                  res@gsnLeftString      = vNam(varn)
[218]2388                  res@tiXAxisString      = "["+unit(varn)+"]"
2389                  res@gsnRightString     = " "
[190]2390                  if (xs .EQ. -1) then
2391                     res@trXMinF            = miniws
[162]2392                  else
2393                     res@trXMinF            = xs
2394                  end if
[190]2395                  if (xe .EQ. -1) then       
2396                     res@trXMaxF            = maxiws
[162]2397                  else
2398                     res@trXMaxF            = xe 
2399                  end if
[175]2400                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2409                  plot_wpsap = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2410               else
2411                  res@gsnLeftString      = vNam(varn)
[218]2412                  res@tiXAxisString      = "["+unit(varn)+"]"
2413                  res@gsnRightString     = " "
[190]2414                  if (xs .EQ. -1) then
2415                     res@trXMinF            = miniwpsap
[162]2416                  else
2417                     res@trXMinF            = xs
2418                  end if
[190]2419                  if (xe .EQ. -1) then       
2420                     res@trXMaxF            = maxiwpsap
[162]2421                  else
2422                     res@trXMaxF            = xe 
[190]2423                  end if
[175]2424                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2432                  plot_wssas = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2433               else
2434                  res@gsnLeftString      = vNam(varn)
[218]2435                  res@tiXAxisString      = "["+unit(varn)+"]"
2436                  res@gsnRightString     = " "
[190]2437                  if (xs .EQ. -1) then
2438                     res@trXMinF            = miniwssas
[162]2439                  else
2440                     res@trXMinF            = xs
2441                  end if
[190]2442                  if (xe .EQ. -1) then       
2443                     res@trXMaxF            = maxiwssas
[162]2444                  else
2445                     res@trXMaxF            = xe 
[190]2446                  end if
[175]2447                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2455                  plot_wsa = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2456               else
2457                  res@gsnLeftString      = vNam(varn)
[218]2458                  res@tiXAxisString      = "["+unit(varn)+"]"
2459                  res@gsnRightString     = " "
[190]2460                  if (xs .EQ. -1) then
2461                     res@trXMinF            = miniwsa
[162]2462                  else
2463                     res@trXMinF            = xs
2464                  end if
[190]2465                  if (xe .EQ. -1) then       
2466                     res@trXMaxF            = maxiwsa
[162]2467                  else
2468                     res@trXMaxF            = xe 
[190]2469                  end if
[175]2470                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2479                  plot_us2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2480               else
2481                  res@gsnLeftString      = vNam(varn)
[218]2482                  res@tiXAxisString      = "["+unit(varn)+"]"
2483                  res@gsnRightString     = " "
[190]2484                  if (xs .EQ. -1) then
2485                     res@trXMinF            = minius2
[162]2486                  else
2487                     res@trXMinF            = xs
2488                  end if
[190]2489                  if (xe .EQ. -1) then       
2490                     res@trXMaxF            = maxius2
[162]2491                  else
2492                     res@trXMaxF            = xe 
[190]2493                  end if
[175]2494                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2502                  plot_vs2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2503               else
2504                  res@gsnLeftString      = vNam(varn)
[218]2505                  res@tiXAxisString      = "["+unit(varn)+"]"
2506                  res@gsnRightString     = " "
[190]2507                  if (xs .EQ. -1) then
2508                     res@trXMinF            = minivs2
[162]2509                  else
2510                     res@trXMinF            = xs
2511                  end if
[190]2512                  if (xe .EQ. -1) then       
2513                     res@trXMaxF            = maxivs2
[162]2514                  else
2515                     res@trXMaxF            = xe 
[190]2516                  end if
[175]2517                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2525                  plot_ws2 = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2526               else
2527                  res@gsnLeftString      = vNam(varn)
[218]2528                  res@tiXAxisString      = "["+unit(varn)+"]"
2529                  res@gsnRightString     = " "
[190]2530                  if (xs .EQ. -1) then
2531                     res@trXMinF            = miniws2
[162]2532                  else
2533                     res@trXMinF            = xs
2534                  end if
[190]2535                  if (xe .EQ. -1) then       
2536                     res@trXMaxF            = maxiws2
[162]2537                  else
2538                     res@trXMaxF            = xe 
[190]2539                  end if
[175]2540                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2549                  plot_wsususodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2550               else
2551                  res@gsnLeftString      = vNam(varn)
[218]2552                  res@tiXAxisString      = "["+unit(varn)+"]"
2553                  res@gsnRightString     = " "
[190]2554                  if (xs .EQ. -1) then
2555                     res@trXMinF            = miniwsususodz
[162]2556                  else
2557                     res@trXMinF            = xs
2558                  end if
[190]2559                  if (xe .EQ. -1) then       
2560                     res@trXMaxF            = maxiwsususodz
[162]2561                  else
2562                     res@trXMaxF            = xe 
[190]2563                  end if
[175]2564                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2572                  plot_wspsodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2573               else
2574                  res@gsnLeftString      = vNam(varn)
[218]2575                  res@tiXAxisString      = "["+unit(varn)+"]"
2576                  res@gsnRightString     = " "
[190]2577                  if (xs .EQ. -1) then
2578                     res@trXMinF            = miniwspsodz
[162]2579                  else
2580                     res@trXMinF            = xs
2581                  end if
[190]2582                  if (xe .EQ. -1) then       
2583                     res@trXMaxF            = maxiwspsodz
[162]2584                  else
2585                     res@trXMaxF            = xe 
[190]2586                  end if
[175]2587                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]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
[175]2595                  plot_wpeodz = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2596               else
2597                  res@gsnLeftString      = vNam(varn)
[218]2598                  res@tiXAxisString      = "["+unit(varn)+"]"
2599                  res@gsnRightString     = " "
[190]2600                  if (xs .EQ. -1) then
2601                     res@trXMinF            = miniwpeodz
[162]2602                  else
2603                     res@trXMinF            = xs
2604                  end if
[190]2605                  if (xe .EQ. -1) then       
2606                     res@trXMaxF            = maxiwpeodz
[162]2607                  else
2608                     res@trXMaxF            = xe 
[190]2609                  end if
[175]2610                  plot(n) = gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2611               end if
2612            end if
[175]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
[161]2620         if (over .EQ. 0) then
2621            n=n+1 
[174]2622         end if 
2623         if (prof3d .EQ. 0)then   
2624            varn=varn+1
2625         end if
2626         delete(temp)
2627      end if         
[154]2628   end do
[175]2629   if (no_files .GT. 1) then
2630      delete(vNam)
[218]2631      delete(files)
[175]2632   end if
[218]2633   
[175]2634   end do
[218]2635   ;#########ENDE DO LOOP FOR no_files GT 1#############
2636   
[162]2637   if (count_var .EQ. 0) then
2638      print(" ")
[190]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")
[175]2641      print(" ")
2642      exit
2643   end if
2644   
2645   if (no_files .GT. 1) then
[218]2646      multi_legend=new(6,string)
2647      string_len=new(6,integer)
[175]2648      multi_dash=new(no_files,string)
[190]2649      multi_legend(0)="  "+name_legend_1
[175]2650      string_len(0)=strlen(multi_legend(0))
[190]2651      multi_legend(1)="  "+name_legend_2
[175]2652      string_len(1)=strlen(multi_legend(1))
[190]2653      multi_legend(2)="  "+name_legend_3
[175]2654      string_len(2)=strlen(multi_legend(2))
[190]2655      multi_legend(3)="  "+name_legend_4
[175]2656      string_len(3)=strlen(multi_legend(3))
[190]2657      multi_legend(4)="  "+name_legend_5
[175]2658      string_len(4)=strlen(multi_legend(4))
[190]2659      multi_legend(5)="  "+name_legend_6
[175]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"   
[218]2682         lgres@lgLabelFontHeightF = font_size_legend           
[175]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(" ")
[218]2703      print("Select a variable 'var=' or use the default value")
[162]2704      print(" ")
2705      print("Your selection '"+var+"' does not exist on the input file")
2706      print(" ")
2707      exit
2708   end if
2709
[161]2710   if (over .EQ. 1 ) then
[154]2711
[161]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   
[174]2763         
2764         check = True
[161]2765     
[174]2766         if (prof3d .EQ. 0) then
2767            if ( isStrSubset( vNam(varn), "time") .OR. isStrSubset( vNam(varn), "NORM")) then
2768               check = False
2769            end if
[161]2770         else
[174]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
[190]2776         if (var .NE. "all") then     
[174]2777            check = isStrSubset( var,","+vNam(varn)+"," )
2778         end if     
[161]2779
[175]2780         if (check)then
[174]2781
2782            if (prof3d .EQ. 0) then
[218]2783               if (log_z .EQ. 1) then
[175]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
[218]2792                     if (log_z .EQ. 1) then
[175]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
[218]2800                        if (log_z .EQ. 1) then
[175]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           
[174]2808            end if
2809
[218]2810            z=z/norm_z
[175]2811
[162]2812            res@gsnLeftString      = vNam(varn)
[218]2813            res@tiXAxisString      = "["+unit(varn)+"]"
2814            res@gsnRightString     = " "
[161]2815            res@trYMinF            = min_z
2816            res@trYMaxF            = max_z 
[190]2817            if (xs .EQ. -1) then
2818               res@trXMinF = min(data(varn,:,:))
[162]2819            else
2820               res@trXMinF = xs
2821            end if
[190]2822            if (xe .EQ. -1) then
2823               res@trXMaxF = max(data(varn,:,:))
[162]2824            else
2825               res@trXMaxF = xe 
2826            end if
[161]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"
[218]2832                  res@tiXAxisString      = "["+unit(varn)+"]"
2833                  res@gsnRightString     = " "
[190]2834                  if (xs .EQ. -1) then
2835                     res@trXMinF = min((/miniu,miniv,miniw/))
[162]2836                  else
2837                     res@trXMinF = xs
2838                  end if
[190]2839                  if (xe .EQ. -1) then
2840                     res@trXMaxF = max((/maxiu,maxiv,maxiw/))
[162]2841                  else
2842                     res@trXMaxF = xe 
[175]2843                  end if 
2844                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2845
2846                  ; ***************************************************
2847                  ; legend for combined plot
2848                  ; ***************************************************
2849     
2850                  lgres                    = True
2851                  lgMonoDashIndex          = False
2852                  lgres@lgLabelFont        = "helvetica"   
[218]2853                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]2866                  if (prof3d .EQ. 0)then
2867                     varn=varn+1
2868                  end if
[161]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"
[218]2876                  res@tiXAxisString      = "["+unit(varn)+"]"
2877                  res@gsnRightString     = " "
[190]2878                  if (xs .EQ. -1) then
2879                     res@trXMinF = min((/minipt,minivpt,minilpt/))
[162]2880                  else
2881                     res@trXMinF = xs
2882                  end if
[190]2883                  if (xe .EQ. -1) then
2884                     res@trXMaxF = max((/maxipt,maxivpt,maxilpt/))
[162]2885                  else
2886                     res@trXMaxF = xe 
2887                  end if
[161]2888
[175]2889                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2890
2891                  ; ***************************************************
2892                  ; legend for combined plot
2893                  ; ***************************************************
2894     
2895                  lgres                    = True
2896                  lgMonoDashIndex          = False
2897                  lgres@lgLabelFont        = "helvetica"   
[218]2898                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]2911                  if (prof3d .EQ. 0)then
2912                     varn=varn+1
2913                  end if
[161]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"
[218]2920                  res@tiXAxisString      = "["+unit(varn)+"]"
2921                  res@gsnRightString     = " "
[190]2922                  if (xs .EQ. -1) then
2923                     res@trXMinF = min((/miniq,miniqv,miniql/))
[162]2924                  else
2925                     res@trXMinF = xs
2926                  end if
[190]2927                  if (xe .EQ. -1) then
2928                     res@trXMaxF = max((/maxiq,maxiqv,maxiql/))
[162]2929                  else
2930                     res@trXMaxF = xe 
[190]2931                  end if
[161]2932
[175]2933                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2934
2935                  ; ***************************************************
2936                  ; legend for combined plot
2937                  ; ***************************************************
2938     
2939                  lgres                    = True
2940                  lgMonoDashIndex          = False
2941                  lgres@lgLabelFont        = "helvetica"   
[218]2942                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]2955                  if (prof3d .EQ. 0)then
2956                     varn=varn+1
2957                  end if
[161]2958                  continue   
2959               end if
[162]2960            end if   
2961           
[161]2962            if (vNam(varn) .EQ. "e" .OR. vNam(varn) .EQ. "es") then
2963               if (e .EQ. 0) then
2964                  res@gsnLeftString      = "e and es"
[218]2965                  res@tiXAxisString      = "["+unit(varn)+"]"
2966                  res@gsnRightString     = " "
[190]2967                  if (xs .EQ. -1) then
2968                     res@trXMinF = min((/minie,minies/))
[162]2969                  else
2970                     res@trXMinF = xs
2971                  end if
[190]2972                  if (xe .EQ. -1) then
2973                     res@trXMaxF = max((/maxie,maxies/))
[162]2974                  else
2975                     res@trXMaxF = xe 
[190]2976                  end if
2977                 
[175]2978                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]2979
2980                  ; ***************************************************
2981                  ; legend for combined plot
2982                  ; ***************************************************
2983     
2984                  lgres                    = True
2985                  lgMonoDashIndex          = False
2986                  lgres@lgLabelFont        = "helvetica"   
[218]2987                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3000                  if (prof3d .EQ. 0)then
3001                     varn=varn+1
3002                  end if
[161]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"
[218]3009                  res@tiXAxisString      = "["+unit(varn)+"]"
3010                  res@gsnRightString     = " "
[190]3011                  if (xs .EQ. -1) then
3012                     res@trXMinF = min((/minikm,minikh/))
[162]3013                  else
3014                     res@trXMinF = xs
3015                  end if
[190]3016                  if (xe .EQ. -1) then
3017                     res@trXMaxF = max((/maxikm,maxikh/))
[162]3018                  else
3019                     res@trXMaxF = xe 
[190]3020                  end if
[161]3021
[175]3022                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3023
3024                  ; ***************************************************
3025                  ; legend for combined plot
3026                  ; ***************************************************
3027     
3028                  lgres                    = True
3029                  lgMonoDashIndex          = False
3030                  lgres@lgLabelFont        = "helvetica"   
[218]3031                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3044                  if (prof3d .EQ. 0)then
3045                     varn=varn+1
3046                  end if
[161]3047                  continue   
3048               end if
3049            end if           
[162]3050           
[161]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"
[218]3054                  res@tiXAxisString      = "["+unit(varn)+"]"
3055                  res@gsnRightString     = " "
[190]3056                  if (xs .EQ. -1) then
3057                     res@trXMinF = min((/miniwpup,miniwsus,miniwu/))
[162]3058                  else
3059                     res@trXMinF = xs
3060                  end if
[190]3061                  if (xe .EQ. -1) then
3062                     res@trXMaxF = max((/maxiwpup,maxiwsus,maxiwu/))
[162]3063                  else
3064                     res@trXMaxF = xe 
[190]3065                  end if 
[161]3066
[175]3067                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3068
3069                  ; ***************************************************
3070                  ; legend for combined plot
3071                  ; ***************************************************
3072     
3073                  lgres                    = True
3074                  lgMonoDashIndex          = False
3075                  lgres@lgLabelFont        = "helvetica"   
[218]3076                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3089                  if (prof3d .EQ. 0)then
3090                     varn=varn+1
3091                  end if
[161]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"
[218]3098                  res@tiXAxisString      = "["+unit(varn)+"]"
3099                  res@gsnRightString     = " "
[190]3100                  if (xs .EQ. -1) then
3101                     res@trXMinF = min((/miniwpvp,miniwsvs,miniwv/))
[162]3102                  else
3103                     res@trXMinF = xs
3104                  end if
[190]3105                  if (xe .EQ. -1) then
3106                     res@trXMaxF = max((/maxiwpvp,maxiwsvs,maxiwv/))
[162]3107                  else
3108                     res@trXMaxF = xe 
3109                  end if
[190]3110                 
[175]3111                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3112
3113                  ; ***************************************************
3114                  ; legend for combined plot
3115                  ; ***************************************************
3116     
3117                  lgres                    = True
3118                  lgMonoDashIndex          = False
3119                  lgres@lgLabelFont        = "helvetica"   
[218]3120                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3133                  if (prof3d .EQ. 0)then
3134                     varn=varn+1
3135                  end if
[161]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"
[218]3142                  res@tiXAxisString      = "["+unit(varn)+"]"
3143                  res@gsnRightString     = " "
[190]3144                  if (xs .EQ. -1) then
3145                     res@trXMinF = min((/miniwpptp,miniwspts,miniwpt/))
[162]3146                  else
3147                     res@trXMinF = xs
3148                  end if
[190]3149                  if (xe .EQ. -1) then
3150                     res@trXMaxF = max((/maxiwpptp,maxiwspts,maxiwpt/))
[162]3151                  else
3152                     res@trXMaxF = xe 
[190]3153                  end if
[161]3154
[175]3155                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3156
3157                  ; ***************************************************
3158                  ; legend for combined plot
3159                  ; ***************************************************
3160     
3161                  lgres                    = True
3162                  lgMonoDashIndex          = False
3163                  lgres@lgLabelFont        = "helvetica"   
[218]3164                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3177                  if (prof3d .EQ. 0)then
3178                     varn=varn+1
3179                  end if
[161]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"
[218]3186                  res@tiXAxisString      = "["+unit(varn)+"]"
3187                  res@gsnRightString     = " "
[190]3188                  if (xs .EQ. -1) then
3189                     res@trXMinF = min((/miniwsptsBC,miniwptBC/))
[162]3190                  else
3191                     res@trXMinF = xs
3192                  end if
[190]3193                  if (xe .EQ. -1) then
3194                     res@trXMaxF = max((/maxiwsptsBC,maxiwptBC/))
[162]3195                  else
3196                     res@trXMaxF = xe 
[190]3197                  end if
[161]3198
[175]3199                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3200
3201                  ; ***************************************************
3202                  ; legend for combined plot
3203                  ; ***************************************************
3204     
3205                  lgres                    = True
3206                  lgMonoDashIndex          = False
3207                  lgres@lgLabelFont        = "helvetica"   
[218]3208                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3221                  if (prof3d .EQ. 0)then
3222                     varn=varn+1
3223                  end if
[161]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"
[218]3230                  res@tiXAxisString      = "["+unit(varn)+"]"
3231                  res@gsnRightString     = " "
[190]3232                  if (xs .EQ. -1) then
3233                     res@trXMinF = min((/miniwpvptp,miniwsvpts,miniwvpt/))
[162]3234                  else
3235                     res@trXMinF = xs
3236                  end if
[190]3237                  if (xe .EQ. -1) then
3238                     res@trXMaxF = max((/maxiwpvptp,maxiwsvpts,maxiwvpt/))
[162]3239                  else
3240                     res@trXMaxF = xe 
[190]3241                  end if
3242                 
[175]3243                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3244
3245                  ; ***************************************************
3246                  ; legend for combined plot
3247                  ; ***************************************************
3248     
3249                  lgres                    = True
3250                  lgMonoDashIndex          = False
3251                  lgres@lgLabelFont        = "helvetica"   
[218]3252                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3265                  if (prof3d .EQ. 0)then
3266                     varn=varn+1
3267                  end if
[161]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"
[218]3274                  res@tiXAxisString      = "["+unit(varn)+"]"
3275                  res@gsnRightString     = " "
[190]3276                  if (xs .EQ. -1) then
3277                     res@trXMinF = min((/miniwpqp,miniwsqs,miniwq/))
[162]3278                  else
3279                     res@trXMinF = xs
3280                  end if
[190]3281                  if (xe .EQ. -1) then
3282                     res@trXMaxF = max((/maxiwpqp,maxiwsqs,maxiwq/))
[162]3283                  else
3284                     res@trXMaxF = xe 
[190]3285                  end if 
3286                 
[175]3287                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3288
3289                  ; ***************************************************
3290                  ; legend for combined plot
3291                  ; ***************************************************
3292     
3293                  lgres                    = True
3294                  lgMonoDashIndex          = False
3295                  lgres@lgLabelFont        = "helvetica"   
[218]3296                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3309                  if (prof3d .EQ. 0)then
3310                     varn=varn+1
3311                  end if
[161]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"
[218]3318                  res@tiXAxisString      = "["+unit(varn)+"]"
3319                  res@gsnRightString     = " "
[190]3320                  if (xs .EQ. -1) then
3321                     res@trXMinF = min((/miniwpqp,miniwsqvs,miniwqv/))
[162]3322                  else
3323                     res@trXMinF = xs
3324                  end if
[190]3325                  if (xe .EQ. -1) then
3326                     res@trXMaxF = max((/maxiwpqp,maxiwsqvs,maxiwqv/))
[162]3327                  else
3328                     res@trXMaxF = xe 
[190]3329                  end if
3330                 
[175]3331                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3332
3333                  ; ***************************************************
3334                  ; legend for combined plot
3335                  ; ***************************************************
3336     
3337                  lgres                    = True
3338                  lgMonoDashIndex          = False
3339                  lgres@lgLabelFont        = "helvetica"   
[218]3340                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3353                  if (prof3d .EQ. 0)then
3354                     varn=varn+1
3355                  end if
[161]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"
[218]3362                  res@tiXAxisString      = "["+unit(varn)+"]"
3363                  res@gsnRightString     = " "
[190]3364                  if (xs .EQ. -1) then
3365                     res@trXMinF = min((/miniwpsp,miniwsss,miniws/))
[162]3366                  else
3367                     res@trXMinF = xs
3368                  end if
[190]3369                  if (xe .EQ. -1) then
3370                     res@trXMaxF = max((/maxiwpsp,maxiwsss,maxiws/))
[162]3371                  else
3372                     res@trXMaxF = xe 
[190]3373                  end if
[161]3374
[175]3375                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3376
3377                  ; ***************************************************
3378                  ; legend for combined plot
3379                  ; ***************************************************
3380     
3381                  lgres                    = True
3382                  lgMonoDashIndex          = False
3383                  lgres@lgLabelFont        = "helvetica"   
[218]3384                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3397                  if (prof3d .EQ. 0)then
3398                     varn=varn+1
3399                  end if
[161]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"
[218]3406                  res@tiXAxisString      = "["+unit(varn)+"]"
3407                  res@gsnRightString     = " "
[190]3408                  if (xs .EQ. -1) then
3409                     res@trXMinF = min((/miniwpsap,miniwssas,miniwsa/))
[162]3410                  else
3411                     res@trXMinF = xs
3412                  end if
[190]3413                  if (xe .EQ. -1) then
3414                     res@trXMaxF = max((/maxiwpsap,maxiwssas,maxiwsa/))
[162]3415                  else
3416                     res@trXMaxF = xe 
[190]3417                  end if
[161]3418
[175]3419                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3420
3421                  ; ***************************************************
3422                  ; legend for combined plot
3423                  ; ***************************************************
3424     
3425                  lgres                    = True
3426                  lgMonoDashIndex          = False
3427                  lgres@lgLabelFont        = "helvetica"   
[218]3428                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3441                  if (prof3d .EQ. 0)then
3442                     varn=varn+1
3443                  end if
[161]3444                  continue   
3445               end if
3446            end if
[162]3447         
[161]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"
[218]3451                  res@tiXAxisString      = "["+unit(varn)+"]"
3452                  res@gsnRightString     = " "
[190]3453                  if (xs .EQ. -1) then
3454                     res@trXMinF = min((/minius2,minivs2,miniws2/))
[162]3455                  else
3456                     res@trXMinF = xs
3457                  end if
[190]3458                  if (xe .EQ. -1) then
3459                     res@trXMaxF = max((/maxius2,maxivs2,maxiws2/))
3460                  else
[162]3461                     res@trXMaxF = xe 
[190]3462                  end if
3463                 
[175]3464                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3465
3466                  ; ***************************************************
3467                  ; legend for combined plot
3468                  ; ***************************************************
3469     
3470                  lgres                    = True
3471                  lgMonoDashIndex          = False
3472                  lgres@lgLabelFont        = "helvetica"   
[218]3473                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3486                  if (prof3d .EQ. 0)then
3487                     varn=varn+1
3488                  end if
[161]3489                  continue   
3490               end if
3491            end if
[162]3492           
[161]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"
[218]3496                  res@tiXAxisString      = "["+unit(varn)+"]"
3497                  res@gsnRightString     = " "
[190]3498                  if (xs .EQ. -1) then
3499                     res@trXMinF = min((/miniwsususodz,miniwspsodz,miniwpeodz/))
[162]3500                  else
3501                     res@trXMinF = xs
3502                  end if
[190]3503                  if (xe .EQ. -1) then
3504                     res@trXMaxF = max((/maxiwsususodz,maxiwspsodz,maxiwpeodz/))
[162]3505                  else
3506                     res@trXMaxF = xe 
[190]3507                  end if
3508                 
[175]3509                  plot(n) =  gsn_csm_xy(wks,data(varn,:,:),z,res)
[161]3510
3511                  ; ***************************************************
3512                  ; legend for combined plot
3513                  ; ***************************************************
3514     
3515                  lgres                    = True
3516                  lgMonoDashIndex          = False
3517                  lgres@lgLabelFont        = "helvetica"   
[218]3518                  lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[174]3531                  if (prof3d .EQ. 0)then
3532                     varn=varn+1
3533                  end if
[161]3534                  continue   
3535               end if
3536            end if     
[174]3537            n=n+1
3538            if (prof3d .EQ. 0)then
3539               varn=varn+1
3540            end if   
[161]3541         end if
3542      end do
[190]3543   end if
3544   
3545   com_var_avail=new(count_var,string)   
[161]3546
[154]3547   if (combine .EQ. 1) then
[174]3548      co=0     
[161]3549      n_o=0
[174]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
[161]3558         else
[174]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
[190]3564         if (var .NE. "all") then         
[174]3565            check = isStrSubset( var,","+vNam(varn)+"," )
3566         end if     
3567
[175]3568         if (check)then
3569           
3570            if (prof3d .EQ. 0) then
[218]3571               if (log_z .EQ. 1) then
[175]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
[218]3580                     if (log_z .EQ. 1) then
[175]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
[218]3588                        if (log_z .EQ. 1) then
[175]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
[174]3597
[218]3598            z=z/norm_z
[190]3599           
3600            com_var_avail(n_o)=vNam(varn)
3601           
[161]3602            com=isStrSubset( c_var,","+vNam(varn)+"," )
[174]3603       
[175]3604            if (com)then
[174]3605               co = co+1           
[161]3606               if (n_o .EQ. 1) then
[175]3607                  res@xyDashPattern  = 1                                   
[161]3608               else           
3609                  if (n_o .EQ. 2) then
3610                     res@xyDashPattern  = 2
3611                  else
3612                     res@xyDashPattern  = 0
[175]3613                     res@gsnLeftString  = "Combined Plot of "+c_var
[218]3614                     res@tiXAxisString      = "["+unit(varn)+"]"
3615                     res@gsnRightString     = " "
[190]3616                     if (xs .EQ. -1) then
3617                        res@trXMinF = min(mini)
[162]3618                     else
3619                        res@trXMinF = xs
3620                     end if
[190]3621                     if (xe .EQ. -1) then
3622                        res@trXMaxF = max(maxi)
[162]3623                     else
3624                        res@trXMaxF = xe 
3625                     end if
[161]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
[174]3632            end if
3633            if (prof3d .EQ. 0)then
3634               varn=varn+1
3635            end if           
[161]3636         end if
3637      end do
3638   
3639      if(number_comb .EQ. 2)then
[174]3640         if (co .EQ. 2)then
3641            overlay(plot_o(0),plot_o(1))
3642         else
[190]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 
[174]3650         end if
[161]3651      end if
3652      if(number_comb .EQ. 3)then
[174]3653         if (co .EQ. 3)then
3654            overlay(plot_o(0),plot_o(1))
3655            overlay(plot_o(0),plot_o(2))
3656         else
[190]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
[174]3664         end if
[161]3665      end if
[154]3666
[161]3667      ; ***************************************************
3668      ; legend for combined plot
3669      ; ***************************************************
[154]3670     
[161]3671      lgres                    = True
3672      lgMonoDashIndex          = False
3673      lgres@lgDashIndexes      = (/0,1,2/)
3674      lgres@lgLabelFont        = "helvetica"   
[218]3675      lgres@lgLabelFontHeightF = font_size_legend           
[161]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
[154]3688   end if
3689
3690   ; ***************************************************
3691   ; merge plots onto one page
3692   ; ***************************************************
[162]3693
[161]3694   do m=0,n-1
3695      plot_(m)=plot(n-1-m)
[154]3696   end do
3697
[161]3698   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
[175]3699      gsn_panel(wks,plot_,(/n,1/),resP)
[161]3700   else   
[218]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)
[161]3704         else
[218]3705           gsn_panel(wks,plot_(i:i+no_rows*no_columns-1),(/no_rows,no_columns/),resP)
[161]3706         end if
3707      end do
3708   end if
3709
[154]3710   print(" ")
3711   print("Output to: " + file_out +"."+ format_out)
3712   print(" ")
3713
3714end
Note: See TracBrowser for help on using the repository browser.