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

Last change on this file since 183 was 175, checked in by steinfeld, 16 years ago

NCL scripts for spectra added. Bug fix concerning spectra in netcdf.f90

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