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

Last change on this file since 526 was 526, checked in by heinze, 14 years ago

Adjustment of the NCL scripts and palmplot to allow for the use of special characters in NetCDF variable names

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