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

Last change on this file since 2297 was 2297, checked in by scharf, 7 years ago

bugfixes

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