source: palm/trunk/SCRIPTS/NCL/timeseries.ncl @ 176

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

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

File size: 51.0 KB
Line 
1load "$NCARG_ROOT/lib/ncarg/nclex/gsun/gsn_code.ncl"
2load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
3load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
4load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
5
6begin
7 
8   ; ***************************************************
9   ; read parameter_list
10   ; ***************************************************
11   
12   if (isfilepresent("~/.ncl_preferences")) then
13      parameter = asciiread("~/.ncl_preferences",129,"string")
14      delete(parameter@_FillValue)
15   else
16      if (isfilepresent("~/palm/current_version/trunk/SRIPTS/NCL/.ncl_preferences")) then
17         parameter = asciiread("~/palm/current_version/trunk/SRIPTS/NCL/.ncl_preferences",129,"string")
18         delete(parameter@_FillValue)
19      else
20         print(" ")
21         print("'.ncl_preferences' is not present in '~/palm/current_version/trunk/SRIPTS/NCL/'")
22         print(" ")
23         exit
24      end if
25   end if
26
27   ; ***************************************************
28   ; set up default parameter values and strings if not assigned in prompt or parameter list
29   ; ***************************************************
30 
31   if ( .not. isvar("file_1") ) then                     
32      if (parameter(7) .EQ. "File in") then
33         print(" ")
34         print("Please provide 1st input file 'file_1=' either in prompt or parameter_list")
35         print(" ")
36         exit
37      else
38         file_in = parameter(7)
39      end if   
40   else
41      file_in = file_1   
42   end if
43   if (.not. isfilepresent(file_in)) then
44      print(" ")
45      print("Your 1st input file: '"+file_in+"' does not exist")
46      print(" ")
47      exit
48   end if
49
50   if ( .not. isvar("format_out") ) then               
51      format_out = "x11"
52      if (parameter(9) .NE. "x11") then
53         format_out = parameter(9) 
54         if (format_out .NE. "x11" .AND. format_out .NE. "pdf" .AND. format_out .NE. "eps" .AND. format_out .NE. "ps" .AND. format_out .NE. "epsi" .AND. format_out .NE. "ncgm")then
55            print(" ")
56            print("Your 'format_out = "+format_out+"' is invalid and set to'x11'")
57            print(" ")
58         end if 
59      end if
60   else
61      if (format_out .NE. "x11" .AND. format_out .NE. "pdf" .AND. format_out .NE. "eps" .AND. format_out .NE. "ps" .AND. format_out .NE. "epsi" .AND. format_out .NE. "ncgm")then
62         print(" ")
63         print("Your 'format_out = "+format_out+"' is invalid and set to'x11'")
64         print(" ")
65      end if   
66   end if
67
68   if ( .not. isvar("file_out") ) then                  ; path+name of output file
69      file_out = "test"
70      if (parameter(11) .NE. "test") then
71         file_out = parameter(11) 
72      end if     
73   end if
74
75   if ( .not. isvar("no_columns") ) then                ; number of plots in one row
76      no_columns = 1
77      if (parameter(17) .NE. "1") then
78         no_columns = stringtointeger(parameter(17)) 
79      end if
80   end if
81
82   if ( .not. isvar("no_lines") ) then                  ; number of plot-lines on one sheet
83      no_lines = 2
84      if (parameter(19) .NE. "2") then
85         no_lines = stringtointeger(parameter(19)) 
86      end if
87   end if 
88
89   if ( .not. isvar("var") ) then                       ; variable name
90      check = True
91   end if
92
93   if ( .not. isvar("over") ) then                      ; switches overlaying plots on
94      over = 0
95      if (stringtointeger(parameter(37)) .NE. 0) then
96         over = stringtointeger(parameter(37))
97         if (stringtointeger(parameter(37)) .NE. 1) then
98            print(" ")
99            print("Your 'over'= "+over+" is invalid and set to 0")
100            print(" ")
101            over = 0
102         end if   
103      end if
104   else
105      if (over .NE. 0 .AND. over .NE. 1)then
106         print(" ")
107         print("Your 'over'= "+over+" is invalid and set to 0")
108         print(" ")
109         over = 0
110      end if
111   end if
112
113   ; ***************************************************
114   ; open input file
115   ; ***************************************************
116
117   f  = addfile(file_in , "r" )
118
119   vNam  = getfilevarnames(f)
120   print(" ")
121   print("Variable on netCDF file: " + vNam)
122   print(" ")
123   dim = dimsizes(vNam)
124   if (dim .EQ. 0) then
125      print(" ")
126      print("There are no data on file")
127      print(" ")
128   end if
129
130   t_all = f->time
131   nt  = dimsizes(t_all)
132   delta_t=t_all(nt-1)/nt
133
134   ; ****************************************************       
135   ; start of time step and different types of mistakes that could be done
136   ; ****************************************************
137
138   if ( .not. isvar("start_time_step") ) then           
139      start_time_step=t_all(0)/3600
140      if (parameter(13) .NE. "t(0)") then
141         if (stringtodouble(parameter(13)) .GE. t_all(nt-1)/3600)
142            print(" ")
143            print("'start_time_step' = "+ parameter(13) +"h is equal or greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
144            print(" ")
145            print("Please select another 'start_time_step'")
146            print(" ")
147            exit
148         end if
149         if (stringtofloat(parameter(13)) .LT. t_all(0)/3600)
150            print(" ")
151            print("'start_time_step' = "+ parameter(13) +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
152            print(" ")
153            print("Please select another 'start_time_step'")
154            print(" ")
155            exit
156         end if
157         start_time_step=stringtodouble(parameter(13))
158      end if
159   else
160      if (start_time_step .GE. t_all(nt-1)/3600)
161         print(" ")
162         print("'start_time_step' = "+ start_time_step +"h is equal or greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
163         print(" ")
164         print("Please select another 'start_time_step'")
165         print(" ")
166         exit
167      end if
168      if (start_time_step .LT. t_all(0)/3600)
169         print(" ")
170         print("'start_time_step' = "+ start_time_step +"h is lower than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
171         print(" ")
172         print("Please select another 'start_time_step'")
173         print(" ")
174         exit
175      end if
176   end if
177   start_time_step = start_time_step*3600
178   do i=0,nt-2     
179      if (start_time_step .GE. t_all(i)-delta_t/2 .AND. start_time_step .LT. t_all(i)+delta_t/2)then
180         st=i
181         break
182      end if
183   end do
184   if (start_time_step .GE. t_all(nt-1)-delta_t/2 .AND. start_time_step .LT. t_all(nt-1)) then
185      st=nt-2   
186   end if
187     
188   ; ****************************************************
189   ; end of time step and different types of mistakes that could be done
190   ; ****************************************************
191
192   if ( .not. isvar("end_time_step") ) then             
193      end_time_step = t_all(nt-1)/3600
194      if (parameter(15) .NE. "t(end)") then
195         if (stringtodouble(parameter(15)) .LE. t_all(0)/3600)
196            print(" ")
197            print("'end_time_step' = "+parameter(15)+ "h is lower or equal than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
198            print(" ")
199            print("Please select another 'end_time_step'")
200            print(" ")
201            exit
202         end if
203         if (stringtodouble(parameter(15)) .GT. t_all(nt-1)/3600)
204            print(" ")
205            print("'end_time_step' = "+ parameter(15) +"h is greater than last time step = " + t_all(nt-1)+"s = "+t_all(nt-1)/3600+"h")
206            print(" ")
207            print("Please select another 'end_time_step'") 
208            print(" ")
209            exit
210         end if
211         if (stringtodouble(parameter(15)) .LE. start_time_step/3600)
212            print(" ")
213            print("'end_time_step' = "+ parameter(15) +"h is equal or lower than 'start_time_step' = "+parameter(13)+"h")
214            print(" ")
215            print("Please select another 'start_time_step' or 'end_time_step'")
216            print(" ")
217            exit
218         end if
219         end_time_step = stringtodouble(parameter(15))
220      end if   
221   else
222      if (end_time_step .LE. t_all(0)/3600)
223         print(" ")
224         print("'end_time_step' = "+end_time_step+ "h is lower or equal than first time step = " + t_all(0)+"s = "+t_all(0)/3600+"h")
225         print(" ")
226         print("Please select another 'end_time_step'")
227         print(" ")
228         exit
229      end if
230      if (end_time_step .GT. t_all(nt-1)/3600)
231         print(" ")
232         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")
233         print(" ")
234         print("Please select another 'end_time_step'") 
235         print(" ")
236         exit
237      end if
238      if (end_time_step .LE. start_time_step/3600)
239         print(" ")
240         print("'end_time_step' = "+ end_time_step +"h is equal or lower than 'start_time_step' = "+start_time_step+"h")
241         print(" ")
242         print("Please select another 'start_time_step' or 'end_time_step'")
243         print(" ")
244         exit
245      end if
246   end if
247   end_time_step = end_time_step*3600
248   do i=0,nt-1     
249      if (end_time_step .GE. t_all(i)-delta_t/2 .AND. end_time_step .LT. t_all(i)+delta_t/2)then
250         et=i
251         break
252      end if
253   end do
254 
255   delete(start_time_step)
256   start_time_step=round(st,3)
257   delete(end_time_step)
258   end_time_step=round(et,3)
259
260   print(" ")
261   print("Output of time steps from "+t_all(start_time_step)/3600+" h = "+t_all(start_time_step)+" s => index = "+start_time_step)
262   print("                     till "+t_all(end_time_step)/3600+" h = "+t_all(end_time_step)+" s => index = "+end_time_step)
263   print(" ")
264
265   t = f->time(start_time_step:end_time_step)
266
267 
268   ; ***************************************************
269   ; set up recourses
270   ; ***************************************************
271
272   res                         = True
273   res@gsnDraw                 = False
274   res@gsnFrame                = False
275   res@gsnPaperOrientation     = "portrait"
276   res@gsnPaperWidth           = 8.27
277   res@gsnPaperHeight          = 11.69
278   res@gsnPaperMargin          = 0.79
279   res@tmXBMode                = True
280   res@tmYLMode                = True
281   res@txFont                  = "helvetica"
282   res@tiMainFont              = "helvetica"
283   res@tiXAxisFont             = "helvetica"
284   res@tiYAxisFont             = "helvetica"
285   res@tmXBLabelFont           = "helvetica"
286   res@tmYLLabelFont           = "helvetica"
287   res@xyLineColors            = (/237/)
288   
289   res@lgLabelFontHeightF     = .02
290
291   resP                        = True
292   resP@txFont                 = "helvetica"
293   resP@txString               = f@title+" time series "
294   resP@txFuncCode             = "~"
295   resP@txFontHeightF          = 0.015
296
297   res@vpWidthF=4
298
299   txres = True
300
301   ; ***************************************************
302   ; read data and create plots
303   ; ***************************************************
304   
305   wks_ps = gsn_open_wks(format_out,file_out)           
306   gsn_define_colormap(wks_ps,"rainbow+white")
307   plot_ps=new(dim,graphic)
308                                 
309   n=0
310   minE=1.E27
311   maxE=-1.E27
312   minus=1.E27
313   maxus=-1.E27
314   minu=1.E27
315   maxu=-1.E27
316   minz=1.E27
317   maxz=-1.E27
318   minw=1.E27
319   maxw=-1.E27
320   minp=1.E27
321   maxp=-1.E27
322   mins=1.E27
323   maxs=-1.E27
324
325   data   = new((/dim,(end_time_step-start_time_step)+1/),float)
326   unit   = new(dim,string)
327   data_0 = new((end_time_step-start_time_step)+1,float)
328   data_0 = 0.0
329   mini   = new(dim,float)
330   maxi   = new(dim,float)
331   
332   if (over .EQ. 1) then
333      plot_E       = gsn_csm_xy(wks_ps,t,data_0(:),res)
334      plot_Es      = gsn_csm_xy(wks_ps,t,data_0(:),res)
335      plot_us      = gsn_csm_xy(wks_ps,t,data_0(:),res)
336      plot_ws      = gsn_csm_xy(wks_ps,t,data_0(:),res)
337      plot_umax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
338      plot_vmax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
339      plot_wmax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
340      plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data_0(:),res)
341      plot_z_i_pt  = gsn_csm_xy(wks_ps,t,data_0(:),res)
342      plot_wpptp0  = gsn_csm_xy(wks_ps,t,data_0(:),res)
343      plot_wpptp   = gsn_csm_xy(wks_ps,t,data_0(:),res)
344      plot_wpt     = gsn_csm_xy(wks_ps,t,data_0(:),res)
345      plot_pt_0_   = gsn_csm_xy(wks_ps,t,data_0(:),res)
346      plot_pt_zp_  = gsn_csm_xy(wks_ps,t,data_0(:),res)
347      plot_splptx  = gsn_csm_xy(wks_ps,t,data_0(:),res)
348      plot_splpty  = gsn_csm_xy(wks_ps,t,data_0(:),res)
349      plot_splptz  = gsn_csm_xy(wks_ps,t,data_0(:),res)
350   end if
351
352   count_var=0
353   do varn = dim-1,0,1
354
355      if( isStrSubset (vNam(varn), "time") )
356         check = False
357      else
358         check = True
359      end if
360      if( isvar("var") ) then                   
361         check = isStrSubset( var,","+vNam(varn)+"," )
362      end if
363      if (parameter(21) .NE. "variables") then
364         var = parameter(21)
365         check = isStrSubset( var,","+vNam(varn)+"," )
366      end if
367   
368     
369      if(check) then
370         count_var=count_var+1
371
372         data_all = f ->$vNam(varn)$
373         unit(varn) = data_all@units
374               
375         data(varn,:)=data_all(start_time_step:end_time_step)
376         
377         if (over .EQ. 1) then
378
379            mini(varn) = min(data(varn,:))
380            maxi(varn) = max(data(varn,:))
381           
382            if (vNam(varn) .EQ. "E" .OR. vNam(varn) .EQ. "Es") then
383               if (mini(varn) .EQ. maxi(varn)) then
384                  if (min(data(varn,:)) .EQ. 0)then
385                     mini(varn)= mini(varn)-1.
386                     maxi(varn)= maxi(varn)+1.
387                  end if
388                  if (min(data(varn,:)) .LT. 0)then
389                     mini(varn)= mini(varn)-1.+(mini(varn))/2
390                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
391                  end if
392                  if (min(data(varn,:)) .GT. 0)then
393                     mini(varn)= mini(varn)-1.-(mini(varn))/2
394                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
395                  end if
396               end if
397               minE=min((/minE,mini(varn)/))
398               maxE=max((/maxE,maxi(varn)/))
399            end if
400
401            if (vNam(varn) .EQ. "us" .OR. vNam(varn) .EQ. "ws") then
402               if (mini(varn) .EQ. maxi(varn)) then
403                  if (min(data(varn,:)) .EQ. 0)then
404                     mini(varn)= mini(varn)-1.
405                     maxi(varn)= maxi(varn)+1.
406                  end if
407                  if (min(data(varn,:)) .LT. 0)then
408                     mini(varn)= mini(varn)-1.+(mini(varn))/2
409                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
410                  end if
411                  if (min(data(varn,:)) .GT. 0)then
412                     mini(varn)= mini(varn)-1.-(mini(varn))/2
413                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
414                  end if
415               end if
416               minus=min((/minus,mini(varn)/))
417               maxus=max((/maxus,maxi(varn)/))
418            end if
419
420            if (vNam(varn) .EQ. "umax" .OR. vNam(varn) .EQ. "vmax" .OR. vNam(varn) .EQ. "wmax") then
421               if (mini(varn) .EQ. maxi(varn)) then
422                  if (mini(varn) .EQ. 0)then
423                     mini(varn)= mini(varn)-1.
424                     maxi(varn)= maxi(varn)+1.
425                  end if
426                  if (mini(varn) .LT. 0)then
427                     mini(varn)= mini(varn)-1.+(mini(varn))/2
428                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
429                  end if
430                  if (mini(varn) .GT. 0)then
431                     mini(varn)= mini(varn)-1.-(mini(varn))/2
432                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
433                  end if
434               end if
435               minu=min((/minu,mini(varn)/))
436               maxu=max((/maxu,maxi(varn)/))
437            end if
438
439            if (vNam(varn) .EQ. "z_i_wpt" .OR. vNam(varn) .EQ. "z_i_pt") then
440               if (mini(varn) .EQ. maxi(varn)) then
441                  if (min(data(varn,:)) .EQ. 0)then
442                     mini(varn)= mini(varn)-1.
443                     maxi(varn)= maxi(varn)+1.
444                  end if
445                  if (min(data(varn,:)) .LT. 0)then
446                     mini(varn)= mini(varn)-1.+(mini(varn))/2
447                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
448                  end if
449                  if (min(data(varn,:)) .GT. 0)then
450                     mini(varn)= mini(varn)-1.-(mini(varn))/2
451                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
452                  end if
453               end if
454               minz=min((/minz,mini(varn)/))
455               maxz=max((/maxz,maxi(varn)/))
456            end if
457
458            if (vNam(varn) .EQ. "wpptp0" .OR. vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "wpt") then
459               if (mini(varn) .EQ. maxi(varn)) then
460                  if (min(data(varn,:)) .EQ. 0)then
461                     mini(varn)= mini(varn)-1.
462                     maxi(varn)= maxi(varn)+1.
463                  end if
464                  if (min(data(varn,:)) .LT. 0)then
465                     mini(varn)= mini(varn)-1.+(mini(varn))/2
466                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
467                  end if
468                  if (min(data(varn,:)) .GT. 0)then
469                     mini(varn)= mini(varn)-1.-(mini(varn))/2
470                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
471                  end if
472               end if
473               minw=min((/minw,mini(varn)/))
474               maxw=max((/maxw,maxi(varn)/))
475            end if
476
477            if (vNam(varn) .EQ. "pt_0_" .OR. vNam(varn) .EQ. "pt_zp_") then
478               if (mini(varn) .EQ. maxi(varn)) then
479                  if (min(data(varn,:)) .EQ. 0)then
480                     mini(varn)= mini(varn)-1.
481                     maxi(varn)= maxi(varn)+1.
482                  end if
483                  if (min(data(varn,:)) .LT. 0)then
484                     mini(varn)= mini(varn)-1.+(mini(varn))/2
485                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
486                  end if
487                  if (min(data(varn,:)) .GT. 0)then
488                     mini(varn)= mini(varn)-1.-(mini(varn))/2
489                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
490                  end if
491               end if
492               minp=min((/minp,mini(varn)/))
493               maxp=max((/maxp,maxi(varn)/))
494            end if
495
496            if (vNam(varn) .EQ. "splptx" .OR. vNam(varn) .EQ. "splpty" .OR. vNam(varn) .EQ. "splptz") then
497               if (mini(varn) .EQ. maxi(varn)) then
498                  if (min(data(varn,:)) .EQ. 0)then
499                     mini(varn)= mini(varn)-1.
500                     maxi(varn)= maxi(varn)+1.
501                  end if
502                  if (min(data(varn,:)) .LT. 0)then
503                     mini(varn)= mini(varn)-1.+(mini(varn))/2
504                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
505                  end if
506                  if (min(data(varn,:)) .GT. 0)then
507                     mini(varn)= mini(varn)-1.-(mini(varn))/2
508                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
509                  end if
510               end if
511               mins=min((/mins,mini(varn)/))
512               maxs=max((/maxs,maxi(varn)/))
513            end if
514           
515         end if
516      end if
517   end do
518
519   if (count_var .EQ. 0) then
520      print(" ")
521      print("The variables 'var=°"+var+"°' do not exist on your input file")
522      print(" ")
523      exit
524   end if
525
526   do varn = dim-1,0,1
527     
528      if( isStrSubset (vNam(varn), "time") )
529         check = False
530      else
531         check = True
532      end if     
533      if( isvar("var") ) then                   
534         check = isStrSubset( var,","+vNam(varn)+"," )
535      end if
536      if (parameter(21) .NE. "variables") then
537         var = parameter(21)
538         check = isStrSubset( var,","+vNam(varn)+"," )
539      end if
540 
541      if(check) then
542
543        if (isStrSubset(vNam(varn),"_0" ))then
544            print(" ")
545            print("If you have Outputs of statistic regions you cannot overlay variables; 'over' is set to 0")
546            print(" ")
547            over = 0
548         end if
549
550        if (over .EQ. 1) then
551 
552            res@gsnLeftString       = "overlayed plot"
553            res@gsnRightString      = unit(varn)
554            res@tiXAxisString        = " time [s] "
555            res@tiYAxisString        = " "
556            res@tiXAxisFontHeightF   = 0.07
557            res@txFontHeightF        = 0.07
558            res@tiYAxisFontHeightF   = 0.07           
559
560            if (vNam(varn) .EQ. "E")
561               E=0
562               res@xyLineColors     = (/237/)
563               res@xyLineLabelFontHeightF = 0.05
564               res@xyLineLabelFontColor   = 237
565               res@trYMaxF           = minE
566               res@trYMinF           = maxE
567               plot_E = gsn_csm_xy(wks_ps,t,data(varn,:),res)
568            end if
569            if (vNam(varn) .EQ. "Es")
570               Es=0
571               res@xyLineColors            = (/144/)
572               res@xyLineLabelFontHeightF = 0.05
573               res@xyLineLabelFontColor   = 144
574               plot_Es = gsn_csm_xy(wks_ps,t,data(varn,:),res)
575            end if
576             
577            if (vNam(varn) .EQ. "us")
578               us=0
579               res@xyLineColors            = (/237/)
580               res@xyLineLabelFontHeightF = 0.05
581               res@xyLineLabelFontColor   = 237
582               res@trYMaxF           = minus
583               res@trYMinF           = maxus
584               plot_us = gsn_csm_xy(wks_ps,t,data(varn,:),res)
585            end if             
586            if (vNam(varn) .EQ. "ws")
587               ws=0
588               res@xyLineColors            = (/144/)
589               res@xyLineLabelFontHeightF = 0.05
590               res@xyLineLabelFontColor   = 144
591               plot_ws = gsn_csm_xy(wks_ps,t,data(varn,:),res)
592            end if
593             
594            if (vNam(varn) .EQ. "umax")
595               u=0
596               res@xyLineColors            = (/237/)
597               res@xyLineLabelFontHeightF = 0.05
598               res@xyLineLabelFontColor   = 237
599               res@trYMaxF           = minu
600               res@trYMinF           = maxu
601               plot_umax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
602            end if
603            if (vNam(varn) .EQ. "vmax")
604               v=0
605               res@xyLineColors            = (/144/)
606               res@xyLineLabelFontHeightF = 0.05
607               res@xyLineLabelFontColor   = 144
608               plot_vmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
609            end if
610            if (vNam(varn) .EQ. "wmax")
611               w=0
612               res@xyLineColors            = (/80/)
613               res@xyLineLabelFontHeightF = 0.05
614               res@xyLineLabelFontColor   = 80
615               plot_wmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
616            end if
617   
618            if (vNam(varn) .EQ. "z_i_wpt")
619               zw=0
620               res@xyLineColors            = (/237/)
621               res@xyLineLabelFontHeightF = 0.05
622               res@xyLineLabelFontColor   = 237
623               res@trYMaxF           = minz
624               res@trYMinF           = maxz
625               plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
626            end if
627            if (vNam(varn) .EQ. "z_i_pt")
628               z=0
629               res@xyLineColors            = (/144/) 
630               res@xyLineLabelFontHeightF = 0.05
631               res@xyLineLabelFontColor   = 144
632               plot_z_i_pt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
633            end if
634
635            if (vNam(varn) .EQ. "wpptp0")
636               w0=0
637               res@xyLineColors            = (/237/)
638               res@xyLineLabelFontHeightF = 0.05
639               res@xyLineLabelFontColor   = 237
640               res@trYMaxF           = minw
641               res@trYMinF           = maxw
642               plot_wpptp0 = gsn_csm_xy(wks_ps,t,data(varn,:),res)
643            end if
644            if (vNam(varn) .EQ. "wpptp")
645               wp=0
646               res@xyLineColors            = (/144/)
647               res@xyLineLabelFontHeightF = 0.05
648               res@xyLineLabelFontColor   = 144
649               plot_wpptp = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
650            end if
651            if (vNam(varn) .EQ. "wpt")
652               wt=0
653               res@xyLineColors            = (/80/)
654               res@xyLineLabelFontHeightF = 0.05
655               res@xyLineLabelFontColor   = 80
656               plot_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
657            end if
658
659            if (vNam(varn) .EQ. "pt_0_")
660               p=0
661               res@xyLineColors            = (/237/)
662               res@xyLineLabelFontHeightF = 0.05
663               res@xyLineLabelFontColor   = 237
664               res@trYMaxF           = minp
665               res@trYMinF           = maxp
666               plot_pt_0_ = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
667            end if
668            if (vNam(varn) .EQ. "pt_zp_")
669               pz=0
670               res@xyLineColors            = (/144/)
671               res@xyLineLabelFontHeightF = 0.05
672               res@xyLineLabelFontColor   = 144
673               plot_pt_zp_ = gsn_csm_xy(wks_ps,t,data(varn,:),res)
674            end if
675
676            if (vNam(varn) .EQ. "splptx")
677               x=0
678               res@xyLineColors            = (/237/)
679               res@xyLineLabelFontHeightF = 0.05
680               res@xyLineLabelFontColor   = 237
681               res@trYMaxF           = mins
682               res@trYMinF           = maxs
683               plot_splptx = gsn_csm_xy(wks_ps,t,data(varn,:),res)   
684            end if
685            if (vNam(varn) .EQ. "splpty")
686               y=0
687               res@xyLineColors            = (/144/)
688               res@xyLineLabelFontHeightF = 0.05
689               res@xyLineLabelFontColor   = 144
690               plot_splpty = gsn_csm_xy(wks_ps,t,data(varn,:),res)
691            end if
692            if (vNam(varn) .EQ. "splptz")
693               z=0
694               res@xyLineColors            = (/80/)
695               res@xyLineLabelFontHeightF = 0.05
696               res@xyLineLabelFontColor   = 80
697               plot_splptz = gsn_csm_xy(wks_ps,t,data(varn,:),res)         
698            end if
699
700         end if
701      end if
702   end do
703   
704   do varn = dim-1,0,1
705 
706      if( isStrSubset (vNam(varn), "time") )
707         check = False
708      else
709         check = True
710      end if   
711      if( isvar("var") ) then                   
712         check = isStrSubset( var,","+vNam(varn)+"," )
713      end if
714      if (parameter(21) .NE. "variables") then
715         var = parameter(21)
716         check = isStrSubset( var,","+vNam(varn)+"," )
717      end if
718   
719      if(check) then
720       
721         if (over .EQ. 1) then       
722       
723            if (vNam(varn) .EQ. "E" .AND. Es .NE. 1) then
724               E=1   
725               overlay(plot_E,plot_Es)
726               n=n+1
727               plot_ps(n) = plot_E   
728
729               ; ***************************************************
730               ; legend for combined plot
731               ; ***************************************************
732     
733               lgres                    = True
734               lgMonoDashIndex          = False
735               lgres@lgLabelFont        = "helvetica"   
736               lgres@lgLabelFontHeightF = .1           
737               lgres@vpWidthF           = 0.4           
738               lgres@vpHeightF          = 0.4         
739               lgres@lgDashIndexes      = (/0,0,0/)
740               lgres@lgLineColors       = (/237,144,80/)
741               lbid = gsn_create_legend(wks_ps,2,(/"E","Es"/),lgres)       
742
743               amres = True
744               amres@amParallelPosF   = 0.6                 
745               amres@amOrthogonalPosF = -0.2           
746               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)           
747            end if
748            if (vNam(varn) .EQ. "Es" .AND. E .NE. 1) then
749               Es=1
750               overlay(plot_E,plot_Es)
751               n=n+1
752               plot_ps(n) = plot_E 
753
754               ; ***************************************************
755               ; legend for combined plot
756               ; ***************************************************
757     
758               lgres                    = True
759               lgMonoDashIndex          = False
760               lgres@lgLabelFont        = "helvetica"   
761               lgres@lgLabelFontHeightF = .1           
762               lgres@vpWidthF           = 0.4           
763               lgres@vpHeightF          = 0.4         
764               lgres@lgDashIndexes      = (/0,0,0/)
765               lgres@lgLineColors       = (/237,144,80/)
766               lbid = gsn_create_legend(wks_ps,2,(/"E","Es"/),lgres)       
767
768               amres = True
769               amres@amParallelPosF   = 0.6                 
770               amres@amOrthogonalPosF = -0.2           
771               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)         
772            end if
773
774            if (vNam(varn) .EQ. "us" .AND. ws .NE. 1) then
775               us=1
776               overlay(plot_us,plot_ws)
777               n=n+1
778               plot_ps(n) = plot_us
779
780               ; ***************************************************
781               ; legend for combined plot
782               ; ***************************************************
783     
784               lgres                    = True
785               lgMonoDashIndex          = False
786               lgres@lgLabelFont        = "helvetica"   
787               lgres@lgLabelFontHeightF = .1           
788               lgres@vpWidthF           = 0.4           
789               lgres@vpHeightF          = 0.4         
790               lgres@lgDashIndexes      = (/0,0,0/)
791               lgres@lgLineColors       = (/237,144,80/)
792               lbid = gsn_create_legend(wks_ps,2,(/"us","ws"/),lgres)       
793
794               amres = True
795               amres@amParallelPosF   = 0.6                 
796               amres@amOrthogonalPosF = -0.2           
797               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
798            end if
799            if (vNam(varn) .EQ. "ws" .AND. us .NE. 1) then
800               ws=1
801               overlay(plot_us,plot_ws)
802               n=n+1
803               plot_ps(n) = plot_us
804
805               ; ***************************************************
806               ; legend for combined plot
807               ; ***************************************************
808     
809               lgres                    = True
810               lgMonoDashIndex          = False
811               lgres@lgLabelFont        = "helvetica"   
812               lgres@lgLabelFontHeightF = .1           
813               lgres@vpWidthF           = 0.4           
814               lgres@vpHeightF          = 0.4         
815               lgres@lgDashIndexes      = (/0,0,0/)
816               lgres@lgLineColors       = (/237,144,80/)
817               lbid = gsn_create_legend(wks_ps,2,(/"us","ws"/),lgres)       
818
819               amres = True
820               amres@amParallelPosF   = 0.6                 
821               amres@amOrthogonalPosF = -0.2           
822               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
823            end if
824         
825            if (vNam(varn) .EQ. "umax" .AND. v .NE. 1)
826               if (w .NE. 1) then
827                  u=1         
828                  overlay(plot_umax,plot_vmax)
829                  overlay(plot_umax,plot_wmax)
830                  n=n+1
831                  plot_ps(n) = plot_umax
832
833                  ; ***************************************************
834                  ; legend for combined plot
835                  ; ***************************************************
836     
837                  lgres                    = True
838                  lgMonoDashIndex          = False
839                  lgres@lgLabelFont        = "helvetica"   
840                  lgres@lgLabelFontHeightF = .1           
841                  lgres@vpWidthF           = 0.4           
842                  lgres@vpHeightF          = 0.4         
843                  lgres@lgDashIndexes      = (/0,0,0/)
844                  lgres@lgLineColors       = (/237,144,80/)
845                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
846
847                  amres = True
848                  amres@amParallelPosF   = 0.6             
849                  amres@amOrthogonalPosF = -0.2           
850                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
851               end if
852            end if
853            if (vNam(varn) .EQ. "vmax" .AND. u .NE. 1)
854               if (w .NE. 1) then
855                  v=1 
856                  overlay(plot_umax,plot_vmax)
857                  overlay(plot_umax,plot_wmax)
858                  n=n+1
859                  plot_ps(n) = plot_umax
860
861                  ; ***************************************************
862                  ; legend for combined plot
863                  ; ***************************************************
864     
865                  lgres                    = True
866                  lgMonoDashIndex          = False
867                  lgres@lgLabelFont        = "helvetica"   
868                  lgres@lgLabelFontHeightF = .1         
869                  lgres@vpWidthF           = 0.4           
870                  lgres@vpHeightF          = 0.4         
871                  lgres@lgDashIndexes      = (/0,0,0/)
872                  lgres@lgLineColors       = (/237,144,80/)
873                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
874
875                  amres = True
876                  amres@amParallelPosF   = 0.6             
877                  amres@amOrthogonalPosF = -0.2           
878                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
879               end if
880            end if
881            if (vNam(varn) .EQ. "wmax" .AND. v .NE. 1)
882               if(u .NE. 1) then 
883                  w=1       
884                  overlay(plot_umax,plot_vmax)
885                  overlay(plot_umax,plot_wmax)
886                  n=n+1
887                  plot_ps(n) = plot_umax
888
889                  ; ***************************************************
890                  ; legend for combined plot
891                  ; ***************************************************
892     
893                  lgres                    = True
894                  lgMonoDashIndex          = False
895                  lgres@lgLabelFont        = "helvetica"   
896                  lgres@lgLabelFontHeightF = .1           
897                  lgres@vpWidthF           = 0.4           
898                  lgres@vpHeightF          = 0.4         
899                  lgres@lgDashIndexes      = (/0,0,0/)
900                  lgres@lgLineColors       = (/237,144,80/)
901                  lbid = gsn_create_legend(wks_ps,3,(/"umax","vmax","wmax"/),lgres)       
902
903                  amres = True
904                  amres@amParallelPosF   = 0.6             
905                  amres@amOrthogonalPosF = -0.2           
906                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
907               end if
908            end if
909           
910            if (vNam(varn) .EQ. "z_i_wpt" .AND. z .NE. 1) then
911               zw=1       
912               overlay(plot_z_i_wpt,plot_z_i_pt)
913               n=n+1
914               plot_ps(n) = plot_z_i_wpt
915       
916               ; ***************************************************
917               ; legend for combined plot
918               ; ***************************************************
919     
920               lgres                    = True
921               lgMonoDashIndex          = False
922               lgres@lgLabelFont        = "helvetica"   
923               lgres@lgLabelFontHeightF = .1           
924               lgres@vpWidthF           = 0.4           
925               lgres@vpHeightF          = 0.4         
926               lgres@lgDashIndexes      = (/0,0,0/)
927               lgres@lgLineColors       = (/237,144,80/)
928               lbid = gsn_create_legend(wks_ps,2,(/"z_i_wpt","z_i_pt"/),lgres)       
929
930               amres = True
931               amres@amParallelPosF   = 0.6                 
932               amres@amOrthogonalPosF = -0.2           
933               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)         
934            end if
935            if (vNam(varn) .EQ. "z_i_pt" .AND. zw .NE. 1) then
936               z=1     
937               overlay(plot_z_i_wpt,plot_z_i_pt)
938               n=n+1
939               plot_ps(n) = plot_z_i_wpt
940
941               ; ***************************************************
942               ; legend for combined plot
943               ; ***************************************************
944     
945               lgres                    = True
946               lgMonoDashIndex          = False
947               lgres@lgLabelFont        = "helvetica"   
948               lgres@lgLabelFontHeightF = .1           
949               lgres@vpWidthF           = 0.4           
950               lgres@vpHeightF          = 0.4         
951               lgres@lgDashIndexes      = (/0,0,0/)
952               lgres@lgLineColors       = (/237,144,80/)
953               lbid = gsn_create_legend(wks_ps,2,(/"z_i_wpt","z_i_pt"/),lgres)       
954
955               amres = True
956               amres@amParallelPosF   = 0.6                 
957               amres@amOrthogonalPosF = -0.2           
958               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)           
959            end if   
960         
961            if (vNam(varn) .EQ. "wpptp0" .AND. wp .NE. 1)
962               if (wt .NE. 1) then
963                  w0=1
964                  overlay(plot_wpptp0,plot_wpptp)
965                  overlay(plot_wpptp0,plot_wpt)
966                  n=n+1
967                  plot_ps(n) = plot_wpptp0
968
969                  ; ***************************************************
970                  ; legend for combined plot
971                  ; ***************************************************
972     
973                  lgres                    = True
974                  lgMonoDashIndex          = False
975                  lgres@lgLabelFont        = "helvetica"   
976                  lgres@lgLabelFontHeightF = .1           
977                  lgres@vpWidthF           = 0.4           
978                  lgres@vpHeightF          = 0.4         
979                  lgres@lgDashIndexes      = (/0,0,0/)
980                  lgres@lgLineColors       = (/237,144,80/)
981                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
982
983                  amres = True
984                  amres@amParallelPosF   = 0.6             
985                  amres@amOrthogonalPosF = -0.2           
986                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
987               end if           
988            end if
989            if (vNam(varn) .EQ. "wpptp" .AND. w0 .NE. 1)
990               if (wt .NE. 1) then
991                 wp=1
992                 overlay(plot_wpptp0,plot_wpptp)
993                 overlay(plot_wpptp0,plot_wpt)
994                 n=n+1
995                 plot_ps(n) = plot_wpptp0
996                 
997                 ; ***************************************************
998                  ; legend for combined plot
999                  ; ***************************************************
1000     
1001                  lgres                    = True
1002                  lgMonoDashIndex          = False
1003                  lgres@lgLabelFont        = "helvetica"   
1004                  lgres@lgLabelFontHeightF = .1           
1005                  lgres@vpWidthF           = 0.4           
1006                  lgres@vpHeightF          = 0.4         
1007                  lgres@lgDashIndexes      = (/0,0,0/)
1008                  lgres@lgLineColors       = (/237,144,80/)
1009                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1010
1011                  amres = True
1012                  amres@amParallelPosF   = 0.6             
1013                  amres@amOrthogonalPosF = -0.2           
1014                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres) 
1015               end if           
1016            end if
1017            if (vNam(varn) .EQ. "wpt" .AND. wp .NE. 1)
1018               if (w0 .NE. 1) then
1019                  wt=1
1020                  overlay(plot_wpptp0,plot_wpptp)
1021                  overlay(plot_wpptp0,plot_wpt)
1022                  n=n+1
1023                  plot_ps(n) = plot_wpptp0
1024
1025                  ; ***************************************************
1026                  ; legend for combined plot
1027                  ; ***************************************************
1028     
1029                  lgres                    = True
1030                  lgMonoDashIndex          = False
1031                  lgres@lgLabelFont        = "helvetica"   
1032                  lgres@lgLabelFontHeightF = .1           
1033                  lgres@vpWidthF           = 0.4           
1034                  lgres@vpHeightF          = 0.4         
1035                  lgres@lgDashIndexes      = (/0,0,0/)
1036                  lgres@lgLineColors       = (/237,144,80/)
1037                  lbid = gsn_create_legend(wks_ps,3,(/"wpptp0","wpptp","wpt"/),lgres)       
1038
1039                  amres = True
1040                  amres@amParallelPosF   = 0.6             
1041                  amres@amOrthogonalPosF = -0.2           
1042                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
1043               end if
1044            end if
1045
1046            if (vNam(varn) .EQ. "pt_0_" .AND. pz .NE. 1) then
1047               p=1     
1048               overlay(plot_pt_0_,plot_pt_zp_)
1049               n=n+1
1050               plot_ps(n) = plot_pt_0_ 
1051     
1052               ; ***************************************************
1053               ; legend for combined plot
1054               ; ***************************************************
1055     
1056               lgres                    = True
1057               lgMonoDashIndex          = False
1058               lgres@lgLabelFont        = "helvetica"   
1059               lgres@lgLabelFontHeightF = .1           
1060               lgres@vpWidthF           = 0.4           
1061               lgres@vpHeightF          = 0.4         
1062               lgres@lgDashIndexes      = (/0,0,0/)
1063               lgres@lgLineColors       = (/237,144,80/)
1064               lbid = gsn_create_legend(wks_ps,2,(/"pt_0_","pt_zp_"/),lgres)       
1065
1066               amres = True
1067               amres@amParallelPosF   = 0.6                 
1068               amres@amOrthogonalPosF = -0.2           
1069               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
1070            end if
1071            if (vNam(varn) .EQ. "pt_zp_" .AND. p .NE. 1) then
1072               pz=1       
1073               overlay(plot_pt_0_,plot_pt_zp_)
1074               n=n+1
1075               plot_ps(n) = plot_pt_0_   
1076
1077               ; ***************************************************
1078               ; legend for combined plot
1079               ; ***************************************************
1080     
1081               lgres                    = True
1082               lgMonoDashIndex          = False
1083               lgres@lgLabelFont        = "helvetica"   
1084               lgres@lgLabelFontHeightF = .1           
1085               lgres@vpWidthF           = 0.4           
1086               lgres@vpHeightF          = 0.4         
1087               lgres@lgDashIndexes      = (/0,0,0/)
1088               lgres@lgLineColors       = (/237,144,80/)
1089               lbid = gsn_create_legend(wks_ps,2,(/"pt_0_","pt_zp_"/),lgres)       
1090
1091               amres = True
1092               amres@amParallelPosF   = 0.6                 
1093               amres@amOrthogonalPosF = -0.2           
1094               annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
1095            end if
1096           
1097            if (vNam(varn) .EQ. "splptx" .AND. y .NE. 1)
1098               if (z .NE.1 ) then
1099                  x=1     
1100                  overlay(plot_splptx,plot_splpty)
1101                  overlay(plot_splptx,plot_splptz)
1102                  n=n+1
1103                  plot_ps(n) = plot_splptx   
1104
1105                  ; ***************************************************
1106                  ; legend for combined plot
1107                  ; ***************************************************
1108     
1109                  lgres                    = True
1110                  lgMonoDashIndex          = False
1111                  lgres@lgLabelFont        = "helvetica"   
1112                  lgres@lgLabelFontHeightF = .1           
1113                  lgres@vpWidthF           = 0.4           
1114                  lgres@vpHeightF          = 0.4         
1115                  lgres@lgDashIndexes      = (/0,0,0/)
1116                  lgres@lgLineColors       = (/237,144,80/)
1117                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1118
1119                  amres = True
1120                  amres@amParallelPosF   = 0.6             
1121                  amres@amOrthogonalPosF = -0.2           
1122                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
1123               end if
1124            end if
1125            if (vNam(varn) .EQ. "splpty" .AND. x .NE. 1)
1126               if(z .NE.1 ) then
1127                  y=1         
1128                  overlay(plot_splptx,plot_splpty)
1129                  overlay(plot_splptx,plot_splptz)
1130                  n=n+1
1131                  plot_ps(n) = plot_splptx
1132
1133                  ; ***************************************************
1134                  ; legend for combined plot
1135                  ; ***************************************************
1136     
1137                  lgres                    = True
1138                  lgMonoDashIndex          = False
1139                  lgres@lgLabelFont        = "helvetica"   
1140                  lgres@lgLabelFontHeightF = .1           
1141                  lgres@vpWidthF           = 0.4           
1142                  lgres@vpHeightF          = 0.4         
1143                  lgres@lgDashIndexes      = (/0,0,0/)
1144                  lgres@lgLineColors       = (/237,144,80/)
1145                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1146
1147                  amres = True
1148                  amres@amParallelPosF   = 0.6             
1149                  amres@amOrthogonalPosF = -0.2           
1150                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
1151               end if           
1152            end if
1153            if (vNam(varn) .EQ. "splptz" .AND. y .NE. 1)
1154               if(x .NE.1 ) then
1155                  z=1         
1156                  overlay(plot_splptx,plot_splpty)
1157                  overlay(plot_splptx,plot_splptz)
1158                  n=n+1
1159                  plot_ps(n) = plot_splptx 
1160
1161                  ; ***************************************************
1162                  ; legend for combined plot
1163                  ; ***************************************************
1164     
1165                  lgres                    = True
1166                  lgMonoDashIndex          = False
1167                  lgres@lgLabelFont        = "helvetica"   
1168                  lgres@lgLabelFontHeightF = .1           
1169                  lgres@vpWidthF           = 0.4           
1170                  lgres@vpHeightF          = 0.4         
1171                  lgres@lgDashIndexes      = (/0,0,0/)
1172                  lgres@lgLineColors       = (/237,144,80/)
1173                  lbid = gsn_create_legend(wks_ps,3,(/"splptx","splpty","splptz"/),lgres)       
1174
1175                  amres = True
1176                  amres@amParallelPosF   = 0.6             
1177                  amres@amOrthogonalPosF = -0.2           
1178                  annoid1 = gsn_add_annotation(plot_ps(n),lbid,amres)
1179               end if       
1180            end if
1181
1182            if(vNam(varn) .NE. "splptz" .AND. vNam(varn) .NE. "splpty" .AND. vNam(varn) .NE. "splptx" .AND. vNam(varn) .NE. "pt_zp_" .AND. vNam(varn) .NE. "pt_0_" .AND. vNam(varn) .NE. "wpt" .AND. vNam(varn) .NE. "wpptp" .AND. vNam(varn) .NE. "wpptp0" .AND. vNam(varn) .NE. "z_i_pt" .AND. vNam(varn) .NE. "z_i_wpt" .AND. vNam(varn) .NE. "wmax" .AND. vNam(varn) .NE. "vmax" .AND. vNam(varn) .NE. "umax" .AND. vNam(varn) .NE. "ws" .AND.  vNam(varn) .NE. "us" .AND. vNam(varn) .NE. "Es" .AND. vNam(varn) .NE. "E") then
1183               n=n+1
1184               res@xyLineColors   = (/237/)
1185               res@xyLabelMode    = False
1186               res@gsnLeftString  = vNam(varn)
1187               res@gsnRightString = unit(varn)
1188               res@trYMaxF        = min(data(varn,:))
1189               res@trYMinF        = max(data(varn,:))
1190               if (min(data(varn,:)) .EQ. max(data(varn,:))) then
1191                  if (min(data(varn,:)) .EQ. 0)then
1192                     res@trYMaxF = min(data(varn,:))-1.
1193                     res@trYMinF = max(data(varn,:))+1.
1194                  end if
1195                  if (min(data(varn,:)) .LT. 0)then
1196                     res@trYMaxF = min(data(varn,:))+(min(data(varn,:)))/2
1197                     res@trYMinF = max(data(varn,:))-(max(data(varn,:)))/2
1198                  end if
1199                  if (min(data(varn,:)) .GT. 0)then
1200                     res@trYMaxF = min(data(varn,:))-(min(data(varn,:)))/2
1201                     res@trYMinF = max(data(varn,:))+(max(data(varn,:)))/2
1202                  end if
1203               end if
1204               plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
1205            end if
1206       
1207         else
1208           
1209            print("plot of " + vNam(varn))
1210           
1211            n=n+1
1212            res@xyLineColors            = (/237/)
1213            res@gsnLeftString       = vNam(varn)
1214            res@gsnRightString      = unit(varn)
1215            res@tiXAxisString        = " time [s] "
1216            res@tiYAxisString        = " "
1217            res@tiXAxisFontHeightF   = 0.07
1218            res@txFontHeightF        = 0.07
1219            res@tiYAxisFontHeightF   = 0.07
1220            res@trYMaxF        = min(data(varn,:))
1221            res@trYMinF        = max(data(varn,:))
1222            if (min(data(varn,:)) .EQ. max(data(varn,:))) then
1223               if (min(data(varn,:)) .EQ. 0)then
1224                     res@trYMaxF = min(data(varn,:))-1.
1225                     res@trYMinF = max(data(varn,:))+1.
1226                  end if
1227                  if (min(data(varn,:)) .LT. 0)then
1228                     res@trYMaxF = min(data(varn,:))+(min(data(varn,:)))/2
1229                     res@trYMinF = max(data(varn,:))-(max(data(varn,:)))/2
1230                  end if
1231                  if (min(data(varn,:)) .GT. 0)then
1232                     res@trYMaxF = min(data(varn,:))-(min(data(varn,:)))/2
1233                     res@trYMinF = max(data(varn,:))+(max(data(varn,:)))/2
1234                  end if
1235            end if
1236            plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res)
1237           
1238         end if     
1239      end if
1240   end do
1241 
1242   ; ***************************************************
1243   ; merge plots onto one page
1244   ; ***************************************************
1245 
1246   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
1247      gsn_panel(wks_ps,plot_ps(1:n),(/n,1/),resP)
1248   else
1249      do np = 1,n,no_lines*no_columns   
1250         if ( np + no_lines*no_columns .gt. n) then   
1251            gsn_panel(wks_ps, plot_ps(np:n),(/no_lines,no_columns/),resP)
1252         else
1253            gsn_panel(wks_ps, plot_ps(np:np+no_lines*no_columns-1),(/no_lines,no_columns/),resP)
1254         end if
1255      end do
1256   end if
1257
1258   print(" ")
1259   print("Output to: " + file_out +"."+ format_out)
1260   print(" ")
1261 
1262end
Note: See TracBrowser for help on using the repository browser.