metanorma / atmospheric

International Standard Atmosphere / ICAO Standard Atmosphere (ISA) from ICAO 7488 / ISO 2533
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

= Atmospheric for Ruby (International Standard Atmosphere / ICAO Standard Atmosphere (ISA))

== Purpose

This repository provides Ruby code for calculating values defined in the following documents:

Which are technically identical documents but different in presentation and units (the ICAO document includes ft in addition to m).

== Usage

=== Formulas and calculations

[source,ruby]

require 'atmospheric' instance = Atmospheric::Isa.method_name

method_name is one of the following


The available methods are:

== Generating ISO 2533 tables

=== ISO 2533:1975

All tables in the 1975 edition are arranged in these steps in meters:

.ISO 2533:1975 table range: step 50 from -2k, 100 from 32k, 200 from 51k to 80k

(-2000..31999).step(50) + (32000..50999).step(100) + (51000..80000).step(200)

Tables 5 to 7 all have height information of the following keys in the hash:

All YAML tables generated contain these two keys which group altitude values as the ISO 2533 tables are rendered in both types of altitudes:

==== Table 5

Title: "Temperature (T and t), Pressure (p), Density (p) and Acceleration of free fall (g) in terms of geometrical altitude (h) and geopotential altitude (H)"

Provides the following values in addition to geopotential and geometric height:

[source,ruby]

Atmospheric::Export::Iso25331975.table_5 #=> Hash Atmospheric::Export::Iso25331975.table_5_yaml #=> YAML

==== Table 6

Title: "Relations of p'pn, p/pn and bar(p/pn), Speed of sound (a), Dynamic viscosity (p), Kinematic viscosity (v) and Thermal conductivity (lambda) in terms of geometrical altitude (h), and geopotential altitude (H)"

Provides the following values in addition to geopotential and geometric height:

[source,ruby]

Atmospheric::Export::Iso25331975.table_6 #=> Hash Atmospheric::Export::Iso25331975.table_6_yaml #=> YAML

==== Table 7

Title: "_Pressure scale height (Hp) Specific weight (gamma), Air number density (n), Mean air-particle speed (v), Air-particle collision frequency (omega) and Mean free path of air particles (l) in terms of geometrical altitude (h) and geopotential altitude (H)"

[source,ruby]

Atmospheric::Export::Iso25331975.table_7 #=> Hash Atmospheric::Export::Iso25331975.table_7_yaml #=> YAML

=== ISO 2533 ADD 1:1985

Addendum 1 adds "Hypsometrical tables".

==== Table 1 (hPa)

Title: "Geopotential altitude as a function of barometric pressure for 5 <= p < 20 hPa at intervals of 0.01 hPa"

For the range of (5.0..19.99).step(0.01) in hPa.

Provides:

[source,ruby]

Atmospheric::Export::Iso25331985.table_1 #=> Hash Atmospheric::Export::Iso25331985.table_1_yaml #=> YAML

==== Table 2 (hPa)

Title: "Geopotential altitude as a function of barometric pressure for 20 <= p < 1200 hPa at intervals of 0.1 hPa"

Same as Table 1 but for the range of (20.0..1199.9).step(0.1) in hPa.

[source,ruby]

Atmospheric::Export::Iso25331985.table_2 #=> Hash Atmospheric::Export::Iso25331985.table_2_yaml #=> YAML

==== Table 3 (mmHg)

Title: "Geopotential altitude as a function of barometric pressure for 4 <= p < 10 mmHg at intervals of 0.01 mmHg"

Same as Table 1 but for the range of (4.0..9.99).step(0.01) and results in mmhg.

Provides:

[source,ruby]

Atmospheric::Export::Iso25331985.table_3 #=> Hash Atmospheric::Export::Iso25331985.table_3_yaml #=> YAML

==== Table 4 (mmHg)

Title: "Geopotential altitude as a function of barometric pressure for 10 <= p < 900 mmHg at intervals of 0.1 mmHg"

Same as Table 3 but for the range of (10.0..899.9).step(0.1) and results in mmhg.

[source,ruby]

Atmospheric::Export::Iso25331985.table_4 #=> Hash Atmospheric::Export::Iso25331985.table_4_yaml #=> YAML

==== Table 5 (hPa) and Table 6 (mmHg)

The difference is Table 5 is in hPa while Table 6 is in mmHg.

Title: "Barometric pressure, in hectopascals, as a function of geopotential altitude for -1000 <= H < +4600 m at intervals of 1m"

Provides:

Range of (-1000..4599).step(1).

[source,ruby]

Atmospheric::Export::Iso25331985.table_56 #=> Hash Atmospheric::Export::Iso25331985.table_56_yaml #=> YAML

=== ISO 2533 ADD 2:1997

Addendum 2 is exactly like ISO 2533:1975 with the tables but extended the tables:

.ISO 2533 ADD 2:1997 Tables 1 to 3 have height range in meters

(-5000..2000).step(50)

.ISO 2533 ADD 2:1997 Tables 4 to 6 have height range in feet

(-16500..-13999).step(250) + (-14000..104999).step(200) + (105000..262500).step(500)

==== Table 1 (-5km to 2km)

Title: "Temperature (T and t), pressure (p), density (p) and acceleration of free fall (g) in terms of geometrical altitude (h) and geopotential altitude (H) -- Altitudes in metres"

Exactly same as ISO 2533:1975 Table 5, but with a different height range.

In addition, pressure at mmHg is no longer produced, but the implementation still provides it for completeness.

[source,ruby]

Atmospheric::Export::Iso25331997.table_1 #=> Hash Atmospheric::Export::Iso25331997.table_1_yaml #=> YAML

==== Table 2 (-5km to 2km)

Title: "Relations of p'pn, p/pn and bar(p/pn), Speed of sound (a), Dynamic viscosity (p), Kinematic viscosity (v) and Thermal conductivity (lambda) in terms of geometrical altitude (h), and geopotential altitude (H) -- Altitudes in metres"

Exactly same as ISO 2533:1975 Table 6, but with a different height range.

[source,ruby]

Atmospheric::Export::Iso25331997.table_2 #=> Hash Atmospheric::Export::Iso25331997.table_2_yaml #=> YAML

==== Table 3 (-5km to 2km)

Title: "_Pressure scale height (Hp) Specific weight (gamma), Air number density (n), Mean air-particle speed (v), Air-particle collision frequency (omega) and Mean free path of air particles (l) in terms of geometrical altitude (h) and geopotential altitude (H) -- Altitudes in metres"

Exactly same as ISO 2533:1975 Table 7, but with a different height range.

[source,ruby]

Atmospheric::Export::Iso25331997.table_3 #=> Hash Atmospheric::Export::Iso25331997.table_3_yaml #=> YAML

==== Table 4 (-16.5kft to 262.5kft)

Title: "Temperature (T and t), pressure (p), density (p) and acceleration of free fall (g) in terms of geometrical altitude (h) and geopotential altitude (H) -- Altitudes in feet"

Exactly same as ISO 2533:1975 Table 5, but in feet and different range.

Pressure at mmHg is not produced, but the implementation still provides it for completeness.

[source,ruby]

Atmospheric::Export::Iso25331997.table_4 #=> Hash Atmospheric::Export::Iso25331997.table_4_yaml #=> YAML

==== Table 5 (-16.5kft to 262.5kft)

Title: "Relations of p'pn, p/pn and bar(p/pn), Speed of sound (a), Dynamic viscosity (p), Kinematic viscosity (v) and Thermal conductivity (lambda) in terms of geometrical altitude (h), and geopotential altitude (H) -- Altitudes in feet"

Exactly same as ISO 2533:1975 Table 6, but in feet and different range.

[source,ruby]

Atmospheric::Export::Iso25331997.table_5 #=> Hash Atmospheric::Export::Iso25331997.table_5_yaml #=> YAML

==== Table 6 (-16.5kft to 262.5kft)

Title: "_Pressure scale height (Hp) Specific weight (gamma), Air number density (n), Mean air-particle speed (v), Air-particle collision frequency (omega) and Mean free path of air particles (l) in terms of geometrical altitude (h) and geopotential altitude (H) -- Altitudes in feet"

Exactly same as ISO 2533:1975 Table 7, but in feet and different range.

[source,ruby]

Atmospheric::Export::Iso25331997.table_6 #=> Hash Atmospheric::Export::Iso25331997.table_6_yaml #=> YAML

=== ISO NP 2533:2024

==== General

ISO 2533 is now proposed to be revised for a 2024/2025 version, 49 years since the last edition (1975) and 27 years since it was last updated (1997).

ISO NP 2533:2024 will likely include all content in the previously published Addenda, including:

This document will also align to the values provided in https://store.icao.int/en/manual-of-the-icao-standard-atmosphere-extended-to-80-kilometres-262500-feet-doc-7488[ICAO Doc 7488/3].

All tables in the new edition are arranged in these steps.

.ISO 2533:2024 atmosphere values (m): step 50 from -5k, 100 from 32k, 200 from 51k to 80k

(-5000..31950).step(50) + (32000..50900).step(100) + (51000..80000).step(200)

.ISO 2533:2024 atmosphere values (ft): step 250 from -16500, 200 from -14000, 500 from 105000 to 262500

(-16500..-13750).step(250) + (-14000..104800).step(200) + (105000..262500).step(500)

Tables 5 to 10 all have height information of the following keys in the hash:

All YAML tables generated contain these two keys which group altitude values as the ISO 2533 tables are rendered in both types of altitudes:

==== Table 5 (meters)

NOTE: This corresponds to ISO 2533:1975 Table 5 combined with ISO 2533:1975/ADD 1:1997 Table 1.

Title: "Temperature (T and t), Pressure (p), Density (p) and Acceleration of free fall (g) in terms of geometrical altitude (h) and geopotential altitude (H)"

Provides the following values in addition to geopotential and geometric height:

[source,ruby]

Atmospheric::Export::Iso25332024.table_5 #=> Hash Atmospheric::Export::Iso25332024.table_5_yaml #=> YAML

==== Table 6 (meters)

NOTE: This corresponds to ISO 2533:1975 Table 6 combined with ISO 2533:1975/ADD 1:1997 Table 2.

Title: "Relations of p'pn, p/pn and bar(p/pn), Speed of sound (a), Dynamic viscosity (p), Kinematic viscosity (v) and Thermal conductivity (lambda) in terms of geometrical altitude (h), and geopotential altitude (H)"

Provides the following values in addition to geopotential and geometric height:

[source,ruby]

Atmospheric::Export::Iso25332024.table_6 #=> Hash Atmospheric::Export::Iso25332024.table_6_yaml #=> YAML

==== Table 7 (meters)

NOTE: This corresponds to ISO 2533:1975 Table 7 combined with ISO 2533:1975/ADD 1:1997 Table 3.

Title: "_Pressure scale height (Hp) Specific weight (gamma), Air number density (n), Mean air-particle speed (v), Air-particle collision frequency (omega) and Mean free path of air particles (l) in terms of geometrical altitude (h) and geopotential altitude (H)"

[source,ruby]

Atmospheric::Export::Iso25332024.table_7 #=> Hash Atmospheric::Export::Iso25332024.table_7_yaml #=> YAML

==== Table 8 (-16.5kft to 262.5kft)

NOTE: This corresponds to ISO 2533:1975/ADD 2:1997 Table 4.

Title: "Temperature (T and t), pressure (p), density (p) and acceleration of free fall (g) in terms of geometrical altitude (h) and geopotential altitude (H) -- Altitudes in feet"

Exactly same as ISO 2533:1975 Table 5, but in feet and different range.

Pressure at mmHg is not produced, but the implementation still provides it for completeness.

[source,ruby]

Atmospheric::Export::Iso25332024.table_8 #=> Hash Atmospheric::Export::Iso25332024.table_8_yaml #=> YAML

==== Table 9 (-16.5kft to 262.5kft)

NOTE: This corresponds to ISO 2533:1975/ADD 2:1997 Table 5.

Title: "Relations of p'pn, p/pn and bar(p/pn), Speed of sound (a), Dynamic viscosity (p), Kinematic viscosity (v) and Thermal conductivity (lambda) in terms of geometrical altitude (h), and geopotential altitude (H) -- Altitudes in feet"

Exactly same as ISO 2533:1975 Table 6, but in feet and different range.

[source,ruby]

Atmospheric::Export::Iso25332024.table_9 #=> Hash Atmospheric::Export::Iso25332024.table_9_yaml #=> YAML

==== Table 10 (-16.5kft to 262.5kft)

NOTE: This corresponds to ISO 2533:1975/ADD 2:1997 Table 6.

Title: "_Pressure scale height (Hp) Specific weight (gamma), Air number density (n), Mean air-particle speed (v), Air-particle collision frequency (omega) and Mean free path of air particles (l) in terms of geometrical altitude (h) and geopotential altitude (H) -- Altitudes in feet"

Exactly same as ISO 2533:1975 Table 7, but in feet and different range.

[source,ruby]

Atmospheric::Export::Iso25332024.table_10 #=> Hash Atmospheric::Export::Iso25332024.table_10_yaml #=> YAML

==== Table 11 (hPa)

NOTE: This corresponds to ISO 2533:1975/ADD 1:1985 Table 1 combined with Table 2.

Title: "_Geometric and geopotential altitude as a function of barometric pressure for 5 <= p < 20 hPa at intervals of 0.01 hPa and 20 <= p < 1200 hPa at intervals of 0.1 hPa__"

For the range of (5.0..19.99).step(0.01) + (20.0..1199.9).step(0.1) in hPa.

Provides:

[source,ruby]

Atmospheric::Export::Iso25332024.table_11 #=> Hash Atmospheric::Export::Iso25332024.table_11_yaml #=> YAML

==== Table 12 (hPa)

NOTE: This corresponds to ISO 2533:1975/ADD 1:1985 Table 5 but in geometric altitude.

Title: "Barometric pressure, in hectopascals, as a function of geometric altitude for -1000 <= H < +4600 m at intervals of 1m"

Provides:

Range of (-1000..4599).step(1).

[source,ruby]

Atmospheric::Export::Iso25332024.table_12 #=> Hash Atmospheric::Export::Iso25332024.table_12_yaml #=> YAML

==== Table 13 (hPa)

NOTE: This corresponds to ISO 2533:1975/ADD 1:1985 Table 5, in geopotential altitude.

Title: "Barometric pressure, in hectopascals, as a function of geopotential altitude for -1000 <= H < +4600 m at intervals of 1m"

Provides:

Range of (-1000..4599).step(1).

[source,ruby]

Atmospheric::Export::Iso25332024.table_13 #=> Hash Atmospheric::Export::Iso25332024.table_13_yaml #=> YAML

== Testing

[source,sh]

$ rspec

Tests are encoded in spec/fixtures/tests.yml in the following format:

[source,yml]

Each of these values are associated with a cell in the tables of the source documents.

The only defining value in a tests is H (geopotential altitude). It is used to generate all the other values.

== License

Copyright Ribose.

== TODO