Class: DataOutput::RegionOutput
- Inherits:
-
BaseOutput
- Object
- BaseOutput
- DataOutput::RegionOutput
- Defined in:
- lib/output/data_output/region_output.rb
Overview
Output class to visualize the interpolation of a region
Instance Attribute Summary collapse
-
#domain_x ⇒ DataDomain
readonly
private
Representing the section in the x-dimension.
-
#domain_y ⇒ DataDomain
readonly
private
Representing the section in the y-dimension.
Attributes inherited from BaseOutput
#data_set, #legend, #with_extreme_values
Instance Method Summary collapse
-
#create_data_domain(label, coordinate, interval, delta) ⇒ DataDomain
private
method to create the special MetaData::DataDomains for the x- and y-dimension.
-
#initialize(data, coordinates, data_series, values) ⇒ RegionOutput
constructor
singleton method to generate the output for the given region.
-
#print_meta_information ⇒ Object
private
prints the meta information consisting of dataset name and informations of the different dimensions.
-
#print_output_head(coordinates, values) ⇒ Object
private
method to print the output head.
Methods inherited from BaseOutput
#determine_output_type_and_print_value, #print_data, #print_data_and_get_extrema, #print_domain_information, #print_extreme_information, #print_extreme_values_for, #set_attributes
Constructor Details
#initialize(data, coordinates, data_series, values) ⇒ RegionOutput
singleton method to generate the output for the given region
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/output/data_output/region_output.rb', line 19 def initialize(data, coordinates, data_series, values) set_attributes(data, values[:extreme_values]) @legend = ColorLegend::ColorData.new(data_series.min_value, data_series.max_value) @domain_x = create_data_domain('X', coordinates[:x], values[:inter_x], values[:delta_x]) @domain_y = create_data_domain('Y', coordinates[:y], values[:inter_y], values[:delta_y]) print_output_head(coordinates, values) print_data(values[:legend], @domain_x, @domain_y) end |
Instance Attribute Details
#domain_x ⇒ DataDomain (readonly, private)
Returns representing the section in the x-dimension.
34 35 36 |
# File 'lib/output/data_output/region_output.rb', line 34 def domain_x @domain_x end |
#domain_y ⇒ DataDomain (readonly, private)
Returns representing the section in the y-dimension.
36 37 38 |
# File 'lib/output/data_output/region_output.rb', line 36 def domain_y @domain_y end |
Instance Method Details
#create_data_domain(label, coordinate, interval, delta) ⇒ DataDomain (private)
method to create the special MetaData::DataDomains for the x- and y-dimension
47 48 49 50 51 52 |
# File 'lib/output/data_output/region_output.rb', line 47 def create_data_domain(label, coordinate, interval, delta) lower = (coordinate - interval).round(3) upper = (coordinate + interval).round(3) MetaData::DataDomain.new(label, lower, upper, delta) end |
#print_meta_information ⇒ Object (private)
prints the meta information consisting of dataset name and informations of the different dimensions
65 66 67 68 69 70 |
# File 'lib/output/data_output/region_output.rb', line 65 def puts "\nRegional interpolation with domain properties:" print_domain_information(@domain_x, "\nX") print_domain_information(@domain_y, 'Y') end |
#print_output_head(coordinates, values) ⇒ Object (private)
method to print the output head
57 58 59 60 61 |
# File 'lib/output/data_output/region_output.rb', line 57 def print_output_head(coordinates, values) puts "Printing interpolated region around (%.2f, %.2f) for data set %d" % [coordinates[:x], coordinates[:y], values[:index] + 1] puts "\n" end |