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

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

ncl_preferences is renamed .ncl.config.default

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