Class: Atmospheris::Iso5878::WindObservation
- Inherits:
-
Object
- Object
- Atmospheris::Iso5878::WindObservation
- Defined in:
- lib/atmospheris/iso5878/wind_observation.rb
Overview
Encapsulates a single altitude-level wind observation with its empirically measured parameters and lazily computed derived statistics.
Empirical inputs: Vx, Vy, sigma_r, Vsa (optional), nu_max (optional) Derived outputs: Vr, theta, Vsc, percentile bounds
Instance Attribute Summary collapse
-
#geopotential_altitude ⇒ Object
readonly
Returns the value of attribute geopotential_altitude.
-
#nu_max ⇒ Object
readonly
Returns the value of attribute nu_max.
-
#sigma_r ⇒ Object
readonly
Returns the value of attribute sigma_r.
-
#vsa ⇒ Object
readonly
Returns the value of attribute vsa.
-
#vx ⇒ Object
readonly
Returns the value of attribute vx.
-
#vy ⇒ Object
readonly
Returns the value of attribute vy.
Instance Method Summary collapse
-
#derived_fields ⇒ WindDerivedFields
Full derived result as a WindDerivedFields struct (legacy API compat).
-
#distribution ⇒ RiceDistribution
The Rice distribution for this observation level.
-
#initialize(geopotential_altitude:, vx:, vy:, sigma_r:, vsa: nil, nu_max: nil, use_absolute_vx: false) ⇒ WindObservation
constructor
A new instance of WindObservation.
-
#percentile_bounds ⇒ Hash{Integer => PercentilePair}
Calculated percentile bounds.
-
#theta ⇒ Float
Direction of the vector mean wind (radians from east).
-
#vr ⇒ Float
Magnitude of the vector mean wind.
-
#vsc ⇒ Float
Calculated scalar mean wind speed (Vsc).
Constructor Details
#initialize(geopotential_altitude:, vx:, vy:, sigma_r:, vsa: nil, nu_max: nil, use_absolute_vx: false) ⇒ WindObservation
Returns a new instance of WindObservation.
30 31 32 33 34 35 36 37 38 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 30 def initialize(geopotential_altitude:, vx:, vy:, sigma_r:, vsa: nil, nu_max: nil, use_absolute_vx: false) @geopotential_altitude = geopotential_altitude.to_f @vx = vx.to_f @vy = vy.to_f @sigma_r = sigma_r.to_f @vsa = vsa @nu_max = nu_max @use_absolute_vx = use_absolute_vx end |
Instance Attribute Details
#geopotential_altitude ⇒ Object (readonly)
Returns the value of attribute geopotential_altitude.
21 22 23 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 21 def geopotential_altitude @geopotential_altitude end |
#nu_max ⇒ Object (readonly)
Returns the value of attribute nu_max.
21 22 23 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 21 def nu_max @nu_max end |
#sigma_r ⇒ Object (readonly)
Returns the value of attribute sigma_r.
21 22 23 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 21 def sigma_r @sigma_r end |
#vsa ⇒ Object (readonly)
Returns the value of attribute vsa.
21 22 23 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 21 def vsa @vsa end |
#vx ⇒ Object (readonly)
Returns the value of attribute vx.
21 22 23 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 21 def vx @vx end |
#vy ⇒ Object (readonly)
Returns the value of attribute vy.
21 22 23 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 21 def vy @vy end |
Instance Method Details
#derived_fields ⇒ WindDerivedFields
Full derived result as a WindDerivedFields struct (legacy API compat).
74 75 76 77 78 79 80 81 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 74 def derived_fields @derived_fields ||= WindDerivedFields.new( vr: vr, sigma: distribution.sigma, vsc: vsc, percentiles: percentile_bounds ) end |
#distribution ⇒ RiceDistribution
The Rice distribution for this observation level. Lazily constructed and cached.
56 57 58 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 56 def distribution @distribution ||= RiceDistribution.new(vr: vr, sigma_r: @sigma_r) end |
#percentile_bounds ⇒ Hash{Integer => PercentilePair}
Calculated percentile bounds.
68 69 70 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 68 def percentile_bounds @percentile_bounds ||= distribution.percentile_bounds end |
#theta ⇒ Float
Direction of the vector mean wind (radians from east).
49 50 51 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 49 def theta @theta ||= Math.atan2(@vy, @vx) end |
#vr ⇒ Float
Magnitude of the vector mean wind. For zones > 20°N, uses |Vx| as specified in ISO 5878 Section 5.4.
43 44 45 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 43 def vr @vr ||= @use_absolute_vx ? @vx.abs : Math.sqrt(@vx**2 + @vy**2) end |
#vsc ⇒ Float
Calculated scalar mean wind speed (Vsc).
62 63 64 |
# File 'lib/atmospheris/iso5878/wind_observation.rb', line 62 def vsc @vsc ||= distribution.mean end |