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

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