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

Last change on this file since 286 was 267, checked in by weinreis, 15 years ago

NCL scripts profiles cross_sections ncl_preference and UserGuide? modified

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