Class: Atmospheric::Export::Iso25331975::GroupThreeAttrs

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Includes:
AltitudeConvertableModel
Defined in:
lib/atmospheric/export/iso_25331975/group_three_attrs.rb

Instance Method Summary collapse

Methods included from AltitudeConvertableModel

included, #realize_altitudes, #set_altitude, #set_geometric_altitude, #set_geopotential_altitude

Methods included from Utils

#ft_to_m, #m_to_ft, #round_to_sig_figs, #values_in_m_ft

Instance Method Details

#calculate(gp_h_m, name, precision: :reduced) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/atmospheric/export/iso_25331975/group_three_attrs.rb', line 54

def calculate(gp_h_m, name, precision: :reduced)
  isa = precision == :high ? Isa::HighPrecision.instance : Isa::NormalPrecision.instance

  case name
  when :pressure_scale_height
    v = isa.pressure_scale_height_from_geopotential(gp_h_m)
    UnitValueFloat.new(
      value: precision == :reduced ? v.round(1) : v,
      unitsml: "m"
    )
  when :specific_weight
    v = isa.specific_weight_from_geopotential(gp_h_m)
    UnitValueFloat.new(
      value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
      unitsml: "N*m^-3"
    )
  when :air_number_density
    v = isa.air_number_density_from_geopotential(gp_h_m)
    UnitValueFloat.new(
      value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
      unitsml: "m^-3"
    )
  when :mean_speed
    v = isa.mean_air_particle_speed_from_geopotential(gp_h_m)
    UnitValueFloat.new(
      value: precision == :reduced ? v.round(2) : v,
      unitsml: "m*s^-1"
    )
  when :frequency
    v = isa.air_particle_collision_frequency_from_geopotential(gp_h_m)
    UnitValueFloat.new(
      value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
      unitsml: "s^-1"
    )
  when :mean_free_path
    v = isa.mean_free_path_of_air_particles_from_geopotential(gp_h_m)
    UnitValueFloat.new(
      value: precision == :reduced ? round_to_sig_figs(v, 5) : v,
      unitsml: "m"
    )
  else
    raise ArgumentError, "Unknown attribute: #{name}"
  end
end

#realize_values_from_geopotential(gp_h_m, precision: :reduced) ⇒ Object

In meters only



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/atmospheric/export/iso_25331975/group_three_attrs.rb', line 28

def realize_values_from_geopotential(gp_h_m, precision: :reduced)
  self.pressure_scale_heights = [
    calculate(gp_h_m, :pressure_scale_height, precision: precision)
  ]

  self.specific_weights = [
    calculate(gp_h_m, :specific_weight, precision: precision)
  ]

  self.air_number_densities = [
    calculate(gp_h_m, :air_number_density, precision: precision)
  ]

  self.mean_speeds = [
    calculate(gp_h_m, :mean_speed, precision: precision)
  ]

  self.frequencies = [
    calculate(gp_h_m, :frequency, precision: precision)
  ]

  self.mean_free_paths = [
    calculate(gp_h_m, :mean_free_path, precision: precision)
  ]
end