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

Last change on this file since 342 was 342, checked in by heinze, 15 years ago

Plots of profiles appear in the order specified by the variable var.

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