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

Last change on this file since 161 was 161, checked in by letzel, 16 years ago
  • NCL scripts in trunk/SCRIPTS/NCL updated for vector plots
File size: 32.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",75,"string")
14      delete(parameter@_FillValue)
15   else
16      print(" ")
17      print("Please copy '.ncl_preferences' into your $home dircetory")
18      print(" ")
19      exit
20   end if
21
22   ; ***************************************************
23   ; set up default parameter values and strings if not assigned in prompt or parameter list
24   ; ***************************************************
25 
26   if ( .not. isvar("file_in") ) then                   ; path+name of input file     
27      if (parameter(7) .EQ. "input file") then
28         print(" ")
29         print("Please provide input file 'file_in = ' either in prompt or parameter_list")
30         print(" ")
31         exit
32      else
33         file_in = parameter(7)
34      end if     
35   end if
36   if ( .not. isvar("format_out") ) then                ; format of output file
37      format_out = "x11"
38      if (parameter(9) .NE. "x11") then
39         format_out = parameter(9) 
40      end if
41   end if
42   if ( .not. isvar("file_out") ) then                  ; path+name of output file
43      file_out = "test"
44      if (parameter(11) .NE. "test") then
45         file_out = parameter(11) 
46      end if     
47   end if
48   if ( .not. isvar("no_columns") ) then                ; number of plots in one row
49      no_columns = 1
50      if (parameter(17) .NE. "1") then
51         no_columns = stringtointeger(parameter(17)) 
52      end if
53   end if
54   if ( .not. isvar("no_lines") ) then                  ; number of plot-lines on one sheet
55      no_lines = 2
56      if (parameter(19) .NE. "2") then
57         no_lines = stringtointeger(parameter(19)) 
58      end if
59   end if 
60   if ( .not. isvar("var") ) then                       ; variable name
61      check = True
62   end if
63   if ( .not. isvar("over") ) then                      ; switches overlaying plots on
64      over = 0
65      if (stringtointeger(parameter(73)) .NE. 0) then
66         over = stringtointeger(parameter(73))
67         if (stringtointeger(parameter(73)) .NE. 1) then
68            print(" ")
69            print("Please set 'over' to 0 or 1")
70            print(" ")
71            exit
72         end if   
73      end if
74   end if
75 
76   ; ***************************************************
77   ; open input file
78   ; ***************************************************
79
80   f  = addfile(file_in , "r" )
81
82   vNam  = getfilevarnames(f)
83   print(" ")
84   print("Variable on netCDF file: " + vNam)
85   print(" ")
86   dim = dimsizes(vNam)
87   if (dim .EQ. 0) then
88      print(" ")
89      print("There are no data on file")
90      print(" ")
91   end if
92
93   t_all = f->time
94   nt  = dimsizes(t_all)
95
96   ; ****************************************************       
97   ; start of time step and different types of mistakes that could be done
98   ; ****************************************************
99
100   if ( .not. isvar("start_time_step") ) then           
101      start_time_step = 0
102      if (parameter(13) .NE. "1") then
103         if (parameter(13) .LE. "0")
104            print(" ")
105            print("Begin with time step 1")
106            print(" ")
107            exit
108         end if
109         if (stringtointeger(parameter(13)) .GE. nt)
110            print(" ")
111            print("'start_time_step' = "+ parameter(13) +" is greater than available time steps = " + (nt-1))
112            print(" ")
113            exit
114         end if
115         start_time_step = stringtointeger(parameter(13))-1 
116      end if
117   else
118      if (start_time_step .LE. 0)
119         print(" ")
120         print("Begin with time step 1")
121         print(" ")
122         exit
123      end if
124      if (start_time_step .GE. nt)
125         print(" ")
126         print("'start_time_step' = "+ start_time_step +" is greater than available time steps = " + (nt-1))
127         print(" ")
128         exit
129      end if
130      start_time_step = start_time_step - 1
131   end if
132
133   ; ****************************************************
134   ; end of time step and different types of mistakes that could be done
135   ; ****************************************************
136
137   if ( .not. isvar("end_time_step") ) then             
138      end_time_step = nt-1
139      if (parameter(15) .NE. "nt") then
140         if (parameter(15) .LE. "0")
141            print(" ")
142            print("'end_time_step' = "+parameter(15)+ " is too small; 'end_time_step' should be at least 1 ")
143            print(" ")
144            exit
145         end if
146         if (stringtointeger(parameter(15)) .GE. nt)
147            print(" ")
148            print("'end_time_step' = "+ parameter(15) +" is greater than available time steps = " + (nt-1)) 
149            print(" ")
150            exit
151         end if
152         if (stringtointeger(parameter(15)) .LT. stringtointeger(parameter(13)) )
153            print(" ")
154            print("'end_time_step' = "+ parameter(15) +" is lower than 'start_time_step' = "+parameter(13))
155            print(" ")
156            exit
157         end if
158         end_time_step = stringtointeger(parameter(15))-1
159      end if   
160   else
161      if (end_time_step .LE. 0)
162         print(" ")
163         print("'end_time_step' = "+end_time_step+ " is too small; 'end_time_step' should be at least 1 ")
164         print(" ")
165         exit
166      end if
167      if (end_time_step .GE. nt)
168         print(" ")
169         print("'end_time_step' = "+ end_time_step +" is greater than available time steps = "+(nt-1))
170         print(" ")
171         exit
172      end if
173      if (end_time_step .LT. start_time_step)
174         print(" ")
175         print("'end_time_step' = "+end_time_step +" is lower than 'start_time_step' = "+start_time_step)
176         print(" ")
177         exit
178      end if
179      end_time_step = end_time_step - 1
180   end if 
181
182   t = f->time(start_time_step:end_time_step)
183
184 
185   ; ***************************************************
186   ; set up recourses
187   ; ***************************************************
188
189   res                         = True
190   res@gsnDraw                 = False
191   res@gsnFrame                = False
192   res@gsnPaperOrientation     = "portrait"
193   res@gsnPaperWidth           = 8.27
194   res@gsnPaperHeight          = 11.69
195   res@gsnPaperMargin          = 0.79
196   res@tmXBMode                = True
197   res@tmYLMode                = True
198   res@txFont                  = "helvetica"
199   res@tiMainFont              = "helvetica"
200   res@tiXAxisFont             = "helvetica"
201   res@tiYAxisFont             = "helvetica"
202   res@tmXBLabelFont           = "helvetica"
203   res@tmYLLabelFont           = "helvetica"
204   res@xyLineColors            = (/237/)
205   
206   res@lgLabelFontHeightF     = .02
207
208   resP                        = True
209   resP@txFont                 = "helvetica"
210   resP@txString               = f@title+" time series "
211   resP@txFuncCode             = "~"
212   resP@txFontHeightF          = 0.015
213
214   res@vpWidthF=4
215
216   txres = True
217
218   ; ***************************************************
219   ; read data and create plots
220   ; ***************************************************
221   
222   wks_ps = gsn_open_wks(format_out,file_out)           
223   gsn_define_colormap(wks_ps,"rainbow+white")
224   plot_ps=new(dim,graphic)
225                                 
226   n=0
227   minE=1.E27
228   maxE=-1.E27
229   minus=1.E27
230   maxus=-1.E27
231   minu=1.E27
232   maxu=-1.E27
233   minz=1.E27
234   maxz=-1.E27
235   minw=1.E27
236   maxw=-1.E27
237   minp=1.E27
238   maxp=-1.E27
239   mins=1.E27
240   maxs=-1.E27
241
242   data   = new((/dim,(end_time_step-start_time_step)+1/),float)
243   unit   = new(dim,string)
244   data_0 = new((end_time_step-start_time_step)+1,float)
245   data_0 = 0.0
246   mini   = new(dim,float)
247   maxi   = new(dim,float)
248   
249   if (over .EQ. 1) then
250      plot_E       = gsn_csm_xy(wks_ps,t,data_0(:),res)
251      plot_Es      = gsn_csm_xy(wks_ps,t,data_0(:),res)
252      plot_us      = gsn_csm_xy(wks_ps,t,data_0(:),res)
253      plot_ws      = gsn_csm_xy(wks_ps,t,data_0(:),res)
254      plot_umax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
255      plot_vmax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
256      plot_wmax    = gsn_csm_xy(wks_ps,t,data_0(:),res)
257      plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data_0(:),res)
258      plot_z_i_pt  = gsn_csm_xy(wks_ps,t,data_0(:),res)
259      plot_wpptp0  = gsn_csm_xy(wks_ps,t,data_0(:),res)
260      plot_wpptp   = gsn_csm_xy(wks_ps,t,data_0(:),res)
261      plot_wpt     = gsn_csm_xy(wks_ps,t,data_0(:),res)
262      plot_pt_0_   = gsn_csm_xy(wks_ps,t,data_0(:),res)
263      plot_pt_zp_  = gsn_csm_xy(wks_ps,t,data_0(:),res)
264      plot_splptx  = gsn_csm_xy(wks_ps,t,data_0(:),res)
265      plot_splpty  = gsn_csm_xy(wks_ps,t,data_0(:),res)
266      plot_splptz  = gsn_csm_xy(wks_ps,t,data_0(:),res)
267   end if
268 
269   do varn = dim-1,0,1
270
271      if( isStrSubset (vNam(varn), "time") )
272         check = False
273      else
274         check = True
275      end if
276      if( isvar("var") ) then                   
277         check = isStrSubset( var,","+vNam(varn)+"," )
278      end if
279      if (parameter(21) .NE. "variables") then
280         var = parameter(21)
281         check = isStrSubset( var,","+vNam(varn)+"," )
282      end if
283   
284     
285      if(check) then
286       
287         data_all = f ->$vNam(varn)$
288         unit(varn) = data_all@units
289               
290         data(varn,:)=data_all(start_time_step:end_time_step)
291         
292         if (over .EQ. 1) then
293
294            mini(varn) = min(data(varn,:))
295            maxi(varn) = max(data(varn,:))
296           
297            if (vNam(varn) .EQ. "E" .OR. vNam(varn) .EQ. "Es") then
298               if (mini(varn) .EQ. maxi(varn)) then
299                  if (min(data(varn,:)) .EQ. 0)then
300                     mini(varn)= mini(varn)-1.
301                     maxi(varn)= maxi(varn)+1.
302                  end if
303                  if (min(data(varn,:)) .LT. 0)then
304                     mini(varn)= mini(varn)-1.+(mini(varn))/2
305                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
306                  end if
307                  if (min(data(varn,:)) .GT. 0)then
308                     mini(varn)= mini(varn)-1.-(mini(varn))/2
309                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
310                  end if
311               end if
312               minE=min((/minE,mini(varn)/))
313               maxE=max((/maxE,maxi(varn)/))
314            end if
315
316            if (vNam(varn) .EQ. "us" .OR. vNam(varn) .EQ. "ws") then
317               if (mini(varn) .EQ. maxi(varn)) then
318                  if (min(data(varn,:)) .EQ. 0)then
319                     mini(varn)= mini(varn)-1.
320                     maxi(varn)= maxi(varn)+1.
321                  end if
322                  if (min(data(varn,:)) .LT. 0)then
323                     mini(varn)= mini(varn)-1.+(mini(varn))/2
324                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
325                  end if
326                  if (min(data(varn,:)) .GT. 0)then
327                     mini(varn)= mini(varn)-1.-(mini(varn))/2
328                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
329                  end if
330               end if
331               minus=min((/minus,mini(varn)/))
332               maxus=max((/maxus,maxi(varn)/))
333            end if
334
335            if (vNam(varn) .EQ. "umax" .OR. vNam(varn) .EQ. "vmax" .OR. vNam(varn) .EQ. "wmax") then
336               if (mini(varn) .EQ. maxi(varn)) then
337                  if (mini(varn) .EQ. 0)then
338                     mini(varn)= mini(varn)-1.
339                     maxi(varn)= maxi(varn)+1.
340                  end if
341                  if (mini(varn) .LT. 0)then
342                     mini(varn)= mini(varn)-1.+(mini(varn))/2
343                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
344                  end if
345                  if (mini(varn) .GT. 0)then
346                     mini(varn)= mini(varn)-1.-(mini(varn))/2
347                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
348                  end if
349               end if
350               minu=min((/minu,mini(varn)/))
351               maxu=max((/maxu,maxi(varn)/))
352            end if
353
354            if (vNam(varn) .EQ. "z_i_wpt" .OR. vNam(varn) .EQ. "z_i_pt") then
355               if (mini(varn) .EQ. maxi(varn)) then
356                  if (min(data(varn,:)) .EQ. 0)then
357                     mini(varn)= mini(varn)-1.
358                     maxi(varn)= maxi(varn)+1.
359                  end if
360                  if (min(data(varn,:)) .LT. 0)then
361                     mini(varn)= mini(varn)-1.+(mini(varn))/2
362                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
363                  end if
364                  if (min(data(varn,:)) .GT. 0)then
365                     mini(varn)= mini(varn)-1.-(mini(varn))/2
366                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
367                  end if
368               end if
369               minz=min((/minz,mini(varn)/))
370               maxz=max((/maxz,maxi(varn)/))
371            end if
372
373            if (vNam(varn) .EQ. "wpptp0" .OR. vNam(varn) .EQ. "wpptp" .OR. vNam(varn) .EQ. "wpt") then
374               if (mini(varn) .EQ. maxi(varn)) then
375                  if (min(data(varn,:)) .EQ. 0)then
376                     mini(varn)= mini(varn)-1.
377                     maxi(varn)= maxi(varn)+1.
378                  end if
379                  if (min(data(varn,:)) .LT. 0)then
380                     mini(varn)= mini(varn)-1.+(mini(varn))/2
381                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
382                  end if
383                  if (min(data(varn,:)) .GT. 0)then
384                     mini(varn)= mini(varn)-1.-(mini(varn))/2
385                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
386                  end if
387               end if
388               minw=min((/minw,mini(varn)/))
389               maxw=max((/maxw,maxi(varn)/))
390            end if
391
392            if (vNam(varn) .EQ. "pt_0_" .OR. vNam(varn) .EQ. "pt_zp_") then
393               if (mini(varn) .EQ. maxi(varn)) then
394                  if (min(data(varn,:)) .EQ. 0)then
395                     mini(varn)= mini(varn)-1.
396                     maxi(varn)= maxi(varn)+1.
397                  end if
398                  if (min(data(varn,:)) .LT. 0)then
399                     mini(varn)= mini(varn)-1.+(mini(varn))/2
400                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
401                  end if
402                  if (min(data(varn,:)) .GT. 0)then
403                     mini(varn)= mini(varn)-1.-(mini(varn))/2
404                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
405                  end if
406               end if
407               minp=min((/minp,mini(varn)/))
408               maxp=max((/maxp,maxi(varn)/))
409            end if
410
411            if (vNam(varn) .EQ. "splptx" .OR. vNam(varn) .EQ. "splpty" .OR. vNam(varn) .EQ. "splptz") then
412               if (mini(varn) .EQ. maxi(varn)) then
413                  if (min(data(varn,:)) .EQ. 0)then
414                     mini(varn)= mini(varn)-1.
415                     maxi(varn)= maxi(varn)+1.
416                  end if
417                  if (min(data(varn,:)) .LT. 0)then
418                     mini(varn)= mini(varn)-1.+(mini(varn))/2
419                     maxi(varn)= maxi(varn)+1.-(maxi(varn))/2
420                  end if
421                  if (min(data(varn,:)) .GT. 0)then
422                     mini(varn)= mini(varn)-1.-(mini(varn))/2
423                     maxi(varn)= maxi(varn)+1.+(maxi(varn))/2
424                  end if
425               end if
426               mins=min((/mins,mini(varn)/))
427               maxs=max((/maxs,maxi(varn)/))
428            end if
429           
430         end if
431      end if
432   end do
433
434   do varn = dim-1,0,1
435     
436      if( isStrSubset (vNam(varn), "time") )
437         check = False
438      else
439         check = True
440      end if     
441      if( isvar("var") ) then                   
442         check = isStrSubset( var,","+vNam(varn)+"," )
443      end if
444      if (parameter(21) .NE. "variables") then
445         var = parameter(21)
446         check = isStrSubset( var,","+vNam(varn)+"," )
447      end if
448 
449      if(check) then
450
451        if (over .EQ. 1) then
452 
453            res@gsnLeftString       = "overlayed plot"
454            res@gsnRightString      = unit(varn)
455            res@tiXAxisString        = " time [s] "
456            res@tiYAxisString        = " "
457            res@tiXAxisFontHeightF   = 0.07
458            res@txFontHeightF        = 0.07
459            res@tiYAxisFontHeightF   = 0.07
460            res@xyLabelMode          = "Custom"
461           
462
463            if (vNam(varn) .EQ. "E")
464               E=0
465               res@xyLineColors     = (/237/)
466               res@xyExplicitLabels =  "E"
467               res@xyLineLabelFontHeightF = 0.05
468               res@xyLineLabelFontColor   = 237
469               res@trYMaxF           = minE
470               res@trYMinF           = maxE
471               plot_E = gsn_csm_xy(wks_ps,t,data(varn,:),res)
472            end if
473            if (vNam(varn) .EQ. "Es")
474               Es=0
475               res@xyLineColors            = (/144/)
476               res@xyExplicitLabels =  "Es"
477               res@xyLineLabelFontHeightF = 0.05
478               res@xyLineLabelFontColor   = 144
479               plot_Es = gsn_csm_xy(wks_ps,t,data(varn,:),res)
480            end if
481             
482            if (vNam(varn) .EQ. "us")
483               us=0
484               res@xyLineColors            = (/237/)
485               res@xyExplicitLabels =  "us"
486               res@xyLineLabelFontHeightF = 0.05
487               res@xyLineLabelFontColor   = 237
488               res@trYMaxF           = minus
489               res@trYMinF           = maxus
490               plot_us = gsn_csm_xy(wks_ps,t,data(varn,:),res)
491            end if             
492            if (vNam(varn) .EQ. "ws")
493               ws=0
494               res@xyLineColors            = (/144/)
495               res@xyExplicitLabels =  "ws"
496               res@xyLineLabelFontHeightF = 0.05
497               res@xyLineLabelFontColor   = 144
498               plot_ws = gsn_csm_xy(wks_ps,t,data(varn,:),res)
499            end if
500             
501            if (vNam(varn) .EQ. "umax")
502               u=0
503               res@xyLineColors            = (/237/)
504               res@xyExplicitLabels =  "umax"
505               res@xyLineLabelFontHeightF = 0.05
506               res@xyLineLabelFontColor   = 237
507               res@trYMaxF           = minu
508               res@trYMinF           = maxu
509               plot_umax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
510            end if
511            if (vNam(varn) .EQ. "vmax")
512               v=0
513               res@xyLineColors            = (/144/)
514               res@xyExplicitLabels =  "vmax"
515               res@xyLineLabelFontHeightF = 0.05
516               res@xyLineLabelFontColor   = 144
517               plot_vmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
518            end if
519            if (vNam(varn) .EQ. "wmax")
520               w=0
521               res@xyLineColors            = (/80/)
522               res@xyExplicitLabels =  "wmax"
523               res@xyLineLabelFontHeightF = 0.05
524               res@xyLineLabelFontColor   = 80
525               plot_wmax = gsn_csm_xy(wks_ps,t,data(varn,:),res)
526            end if
527   
528            if (vNam(varn) .EQ. "z_i_wpt")
529               zw=0
530               res@xyLineColors            = (/237/)
531               res@xyExplicitLabels =  "z_i_wpt"
532               res@xyLineLabelFontHeightF = 0.05
533               res@xyLineLabelFontColor   = 237
534               res@trYMaxF           = minz
535               res@trYMinF           = maxz
536               plot_z_i_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
537            end if
538            if (vNam(varn) .EQ. "z_i_pt")
539               z=0
540               res@xyLineColors            = (/144/) 
541               res@xyExplicitLabels =  "z_i_pt"
542               res@xyLineLabelFontHeightF = 0.05
543               res@xyLineLabelFontColor   = 144
544               plot_z_i_pt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
545            end if
546
547            if (vNam(varn) .EQ. "wpptp0")
548               w0=0
549               res@xyLineColors            = (/237/)
550               res@xyExplicitLabels =  "wpptp0"
551               res@xyLineLabelFontHeightF = 0.05
552               res@xyLineLabelFontColor   = 237
553               res@trYMaxF           = minw
554               res@trYMinF           = maxw
555               plot_wpptp0 = gsn_csm_xy(wks_ps,t,data(varn,:),res)
556            end if
557            if (vNam(varn) .EQ. "wpptp")
558               wp=0
559               res@xyLineColors            = (/144/)
560               res@xyExplicitLabels =  "wpptp"
561               res@xyLineLabelFontHeightF = 0.05
562               res@xyLineLabelFontColor   = 144
563               plot_wpptp = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
564            end if
565            if (vNam(varn) .EQ. "wpt")
566               wt=0
567               res@xyLineColors            = (/80/)
568               res@xyExplicitLabels =  "wpt"
569               res@xyLineLabelFontHeightF = 0.05
570               res@xyLineLabelFontColor   = 80
571               plot_wpt = gsn_csm_xy(wks_ps,t,data(varn,:),res)
572            end if
573
574            if (vNam(varn) .EQ. "pt_0_")
575               p=0
576               res@xyLineColors            = (/237/)
577               res@xyExplicitLabels =  "pt_0_"
578               res@xyLineLabelFontHeightF = 0.05
579               res@xyLineLabelFontColor   = 237
580               res@trYMaxF           = minp
581               res@trYMinF           = maxp
582               plot_pt_0_ = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
583            end if
584            if (vNam(varn) .EQ. "pt_zp_")
585               pz=0
586               res@xyLineColors            = (/144/)
587               res@xyExplicitLabels =  "pt_zp_"
588               res@xyLineLabelFontHeightF = 0.05
589               res@xyLineLabelFontColor   = 144
590               plot_pt_zp_ = gsn_csm_xy(wks_ps,t,data(varn,:),res)
591            end if
592
593            if (vNam(varn) .EQ. "splptx")
594               x=0
595               res@xyLineColors            = (/237/)
596               res@xyExplicitLabels =  "splptx"
597               res@xyLineLabelFontHeightF = 0.05
598               res@xyLineLabelFontColor   = 237
599               res@trYMaxF           = mins
600               res@trYMinF           = maxs
601               plot_splptx = gsn_csm_xy(wks_ps,t,data(varn,:),res)   
602            end if
603            if (vNam(varn) .EQ. "splpty")
604               y=0
605               res@xyLineColors            = (/144/)
606               res@xyExplicitLabels =  "splpty"
607               res@xyLineLabelFontHeightF = 0.05
608               res@xyLineLabelFontColor   = 144
609               plot_splpty = gsn_csm_xy(wks_ps,t,data(varn,:),res)
610            end if
611            if (vNam(varn) .EQ. "splptz")
612               z=0
613               res@xyLineColors            = (/80/)
614               res@xyExplicitLabels =  "splptz"
615               res@xyLineLabelFontHeightF = 0.05
616               res@xyLineLabelFontColor   = 80
617               plot_splptz = gsn_csm_xy(wks_ps,t,data(varn,:),res)         
618            end if
619
620         end if
621      end if
622   end do
623   
624   do varn = dim-1,0,1
625 
626      if( isStrSubset (vNam(varn), "time") )
627         check = False
628      else
629         check = True
630      end if   
631      if( isvar("var") ) then                   
632         check = isStrSubset( var,","+vNam(varn)+"," )
633      end if
634      if (parameter(21) .NE. "variables") then
635         var = parameter(21)
636         check = isStrSubset( var,","+vNam(varn)+"," )
637      end if
638   
639      if(check) then
640       
641         if (over .EQ. 1) then       
642       
643            if (vNam(varn) .EQ. "E" .AND. Es .NE. 1) then
644               E=1   
645               overlay(plot_E,plot_Es)
646               n=n+1
647               plot_ps(n) = plot_E               
648            end if
649            if (vNam(varn) .EQ. "Es" .AND. E .NE. 1) then
650               Es=1
651               overlay(plot_E,plot_Es)
652               n=n+1
653               plot_ps(n) = plot_E           
654            end if
655
656            if (vNam(varn) .EQ. "us" .AND. ws .NE. 1) then
657               us=1
658               overlay(plot_us,plot_ws)
659               n=n+1
660               plot_ps(n) = plot_us
661            end if
662            if (vNam(varn) .EQ. "ws" .AND. us .NE. 1) then
663               ws=1
664               overlay(plot_us,plot_ws)
665               n=n+1
666               plot_ps(n) = plot_us
667            end if
668         
669            if (vNam(varn) .EQ. "umax" .AND. v .NE. 1)
670               if (w .NE. 1) then
671                  u=1         
672                  overlay(plot_umax,plot_vmax)
673                  overlay(plot_umax,plot_wmax)
674                  n=n+1
675                  plot_ps(n) = plot_umax
676               end if
677            end if
678            if (vNam(varn) .EQ. "vmax" .AND. u .NE. 1)
679               if (w .NE. 1) then
680                  v=1 
681                  overlay(plot_umax,plot_vmax)
682                  overlay(plot_umax,plot_wmax)
683                  n=n+1
684                  plot_ps(n) = plot_umax
685               end if
686            end if
687            if (vNam(varn) .EQ. "wmax" .AND. v .NE. 1)
688               if(u .NE. 1) then 
689                  w=1       
690                  overlay(plot_umax,plot_vmax)
691                  overlay(plot_umax,plot_wmax)
692                  n=n+1
693                  plot_ps(n) = plot_umax
694               end if
695            end if
696           
697            if (vNam(varn) .EQ. "z_i_wpt" .AND. z .NE. 1) then
698               zw=1       
699               overlay(plot_z_i_wpt,plot_z_i_pt)
700               n=n+1
701               plot_ps(n) = plot_z_i_wpt           
702            end if
703            if (vNam(varn) .EQ. "z_i_pt" .AND. zw .NE. 1) then
704               z=1     
705               overlay(plot_z_i_wpt,plot_z_i_pt)
706               n=n+1
707               plot_ps(n) = plot_z_i_wpt           
708            end if   
709         
710            if (vNam(varn) .EQ. "wpptp0" .AND. wp .NE. 1)
711               if (wt .NE. 1) then
712                  w0=1
713                  overlay(plot_wpptp0,plot_wpptp)
714                  overlay(plot_wpptp0,plot_wpt)
715                  n=n+1
716                  plot_ps(n) = plot_wpptp0
717               end if           
718            end if
719            if (vNam(varn) .EQ. "wpptp" .AND. w0 .NE. 1)
720               if (wt .NE. 1) then
721                 wp=1
722                 overlay(plot_wpptp0,plot_wpptp)
723                 overlay(plot_wpptp0,plot_wpt)
724                 n=n+1
725                 plot_ps(n) = plot_wpptp0 
726               end if           
727            end if
728            if (vNam(varn) .EQ. "wpt" .AND. wp .NE. 1)
729               if (w0 .NE. 1) then
730                  wt=1
731                  overlay(plot_wpptp0,plot_wpptp)
732                  overlay(plot_wpptp0,plot_wpt)
733                  n=n+1
734                  plot_ps(n) = plot_wpptp0             
735               end if
736            end if
737
738            if (vNam(varn) .EQ. "pt_0_" .AND. pz .NE. 1) then
739               p=1     
740               overlay(plot_pt_0_,plot_pt_zp_)
741               n=n+1
742               plot_ps(n) = plot_pt_0_           
743            end if
744            if (vNam(varn) .EQ. "pt_zp_" .AND. p .NE. 1) then
745               pz=1       
746               overlay(plot_pt_0_,plot_pt_zp_)
747               n=n+1
748               plot_ps(n) = plot_pt_0_           
749            end if
750           
751            if (vNam(varn) .EQ. "splptx" .AND. y .NE. 1)
752               if (z .NE.1 ) then
753                  x=1     
754                  overlay(plot_splptx,plot_splpty)
755                  overlay(plot_splptx,plot_splptz)
756                  n=n+1
757                  plot_ps(n) = plot_splptx           
758               end if
759            end if
760            if (vNam(varn) .EQ. "splpty" .AND. x .NE. 1)
761               if(z .NE.1 ) then
762                  y=1         
763                  overlay(plot_splptx,plot_splpty)
764                  overlay(plot_splptx,plot_splptz)
765                  n=n+1
766                  plot_ps(n) = plot_splptx
767               end if           
768            end if
769            if (vNam(varn) .EQ. "splptz" .AND. y .NE. 1)
770               if(x .NE.1 ) then
771                  z=1         
772                  overlay(plot_splptx,plot_splpty)
773                  overlay(plot_splptx,plot_splptz)
774                  n=n+1
775                  plot_ps(n) = plot_splptx   
776               end if       
777            end if
778
779            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
780               n=n+1
781               res@xyLineColors   = (/237/)
782               res@xyLabelMode    = False
783               res@gsnLeftString  = vNam(varn)
784               res@gsnRightString = unit(varn)
785               res@trYMaxF        = min(data(varn,:))
786               res@trYMinF        = max(data(varn,:))
787               if (min(data(varn,:)) .EQ. max(data(varn,:))) then
788                  if (min(data(varn,:)) .EQ. 0)then
789                     res@trYMaxF = min(data(varn,:))-1.
790                     res@trYMinF = max(data(varn,:))+1.
791                  end if
792                  if (min(data(varn,:)) .LT. 0)then
793                     res@trYMaxF = min(data(varn,:))+(min(data(varn,:)))/2
794                     res@trYMinF = max(data(varn,:))-(max(data(varn,:)))/2
795                  end if
796                  if (min(data(varn,:)) .GT. 0)then
797                     res@trYMaxF = min(data(varn,:))-(min(data(varn,:)))/2
798                     res@trYMinF = max(data(varn,:))+(max(data(varn,:)))/2
799                  end if
800               end if
801               plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res) 
802            end if
803       
804         else
805           
806            print("plot of " + vNam(varn))
807           
808            n=n+1
809            res@xyLineColors            = (/237/)
810            res@gsnLeftString       = vNam(varn)
811            res@gsnRightString      = unit(varn)
812            res@tiXAxisString        = " time [s] "
813            res@tiYAxisString        = " "
814            res@tiXAxisFontHeightF   = 0.07
815            res@txFontHeightF        = 0.07
816            res@tiYAxisFontHeightF   = 0.07
817            res@trYMaxF        = min(data(varn,:))
818            res@trYMinF        = max(data(varn,:))
819            if (min(data(varn,:)) .EQ. max(data(varn,:))) then
820               if (min(data(varn,:)) .EQ. 0)then
821                     res@trYMaxF = min(data(varn,:))-1.
822                     res@trYMinF = max(data(varn,:))+1.
823                  end if
824                  if (min(data(varn,:)) .LT. 0)then
825                     res@trYMaxF = min(data(varn,:))+(min(data(varn,:)))/2
826                     res@trYMinF = max(data(varn,:))-(max(data(varn,:)))/2
827                  end if
828                  if (min(data(varn,:)) .GT. 0)then
829                     res@trYMaxF = min(data(varn,:))-(min(data(varn,:)))/2
830                     res@trYMinF = max(data(varn,:))+(max(data(varn,:)))/2
831                  end if
832            end if
833            plot_ps(n) = gsn_csm_xy(wks_ps,t,data(varn,:),res)
834           
835         end if     
836      end if
837   end do
838 
839   ; ***************************************************
840   ; merge plots onto one page
841   ; ***************************************************
842 
843   if (format_out .EQ. "eps" .OR. format_out .EQ. "epsi") then
844      gsn_panel(wks_ps,plot_ps(1:n),(/n,1/),resP)
845   else
846      do np = 1,n,no_lines*no_columns   
847         if ( np + no_lines*no_columns .gt. n) then   
848            gsn_panel(wks_ps, plot_ps(np:n),(/no_lines,no_columns/),resP)
849         else
850            gsn_panel(wks_ps, plot_ps(np:np+no_lines*no_columns-1),(/no_lines,no_columns/),resP)
851         end if
852      end do
853   end if
854
855   print(" ")
856   print("Output to: " + file_out +"."+ format_out)
857   print(" ")
858 
859end
Note: See TracBrowser for help on using the repository browser.