:name: ensemble_1D :description: 1D plots for ensemble members :ndims: 2 :nvars: 1 :vizshot_method: ensemble_1D :setting_html: |

<%= text_field("analysis", "ensemble_1D_min", :size => 5, :maxlength => 10) %>
<%= text_field("analysis", "ensemble_1D_max", :size => 5, :maxlength => 10) %>
<%= text_field("analysis", "ensemble_1D_index", :size => 2, :maxlength => 2) %> <% if session[:analysis]['ensemble_1D_style']=='lines' %> <% else %>
:options: - :name: style :default: lines :type: string :parser: ggraph - :name: index :default: 1 :type: int :parser: ggraph - :name: highlight :default: false :type: boolean :parser: ggraph - :name: highlightmember :optional: true :type: array_int :parser: ggraph - :name: index2 :default: 21 :optional: true :type: int :parser: ggraph - :name: min :optional: true :type: float :parser: ggraph - :name: max :optional: true :type: float :parser: ggraph :script: | newfrm = opt.delete(:newfrm) GGraph::ensemble_1D(gphys, newfrm, opt) :ggraph: | gropn_1_if_not_yet unless defined?(@@ensemble_1D_options) @@ensemble_1D_options = Misc::KeywordOptAutoHelp.new( ['title', nil, 'Title of the figure'], ['annotate', true, 'if false, do not put texts on the right margin even when newframe==true'], ['min', nil, 'min'], ['max', nil, 'max'], ['index', 1, 'mark index'], ['type', 2, 'mark type'], ['style', 'lines', 'plot style'], ['highlight', false, 'highlight specific members'], ['highlightmember', [], 'members to highlight'], ['index2', 1, 'mark index for highlight'], ['transpose', false, 'transpose'] ) end opts = @@ensemble_1D_options.interpret(options) gphys = gphys.first2D.copy axnames = gphys.axnames #td = axnames.index("validtime") # AUTO-DETECTION IS DISABLED #md = axnames.index("member") td = 0 # MANUALLY SPECIFY THE AXES md = 1 if td && md.nil? md = td==0 ? 1 : 0 elsif md && td.nil? td = md==0 ? 1 : 0 elsif td.nil? && md.nil? if transpose = opts.delete('transpose') td = 0 md = 1 else td = 1 md = 0 end end t = gphys.coord(td) nm = gphys.coord(md).length data = gphys.data ind = Array.new(2) ind[td] = true if newframe ind[md] = 0 fig(t,data[*ind],{'window'=>[t.min.val,t.max.val, (opts['min'] || data.min.val), (opts['max'] || data.max.val)]}) end data2 = data.val t2 = t.val case opts['style'] when "lines" nm.times{|n| if opts['highlight'] && opts['highlightmember'].include?(n) lineindex = opts['index2'] else lineindex = opts['index'] end ind[md] = n DCL::sgplzu(t2, data2[*ind], 1, lineindex) } when "bar" mean = data2.mean(md) std = data2.stddev(md) DCL::sgplzu(t2, mean, 1, 2) DCL::uverbz(t2, mean-std, mean+std, 1, 1, 0.01) when "box" mean = data2.mean(md) std = data2.stddev(md) max = data2.max(md) min = data2.min(md) DCL::uvbrfz(t2, mean-std, mean+std, 1, 1, 0.01) DCL::uverbz(t2, mean-std, min, 1, 1, 0.01) DCL::uverbz(t2, mean+std, max, 1, 1, 0.01) when "percentile" data2 = data2.transpose(md,td).sort(0) nl = 5 cols = [98999, 95999, 91999, 88999, 84999] dn = nm.to_f/(nl*2-1) nh = (nm-1).to_f/2 nl.times{|n| i = (nh+dn*(nl-n-0.5)).round j = (nh-dn*(nl-n-0.5)).round i = -1 if i >= nm j = 0 if j < 0 d1 = data2[i,true] d2 = data2[j,true] DCL::uvdifz(t2, d1, d2, cols[n], cols[n]) DCL::sgplzu(t2, d1, 1, 1) DCL::sgplzu(t2, d2, 1, 1) } else raise "style (#{opts['style']}) is invalid" end if newframe ind[md] = 0 axes(t,data[*ind]) title( opts['title'] ) annotate(gphys.lost_axes) if opts['annotate'] end