-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
2,348 additions
and
1,247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
platform: [ubuntu-latest, macos-latest] | ||
python-version: ["3.11"] | ||
python-version: ["3.12"] | ||
|
||
runs-on: ${{ matrix.platform }} | ||
|
||
|
@@ -33,8 +33,6 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Get conda | ||
uses: conda-incubator/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Default mappings for gas names, dimensions and variables used in RRTMGP. | ||
This module contains dictionaries that map standard names to dataset-specific names | ||
for gases, dimensions and variables used in radiative transfer calculations. | ||
""" | ||
|
||
from typing import Dict, Final | ||
|
||
# Mapping of standard gas names to RRTMGP-specific names | ||
DEFAULT_GAS_MAPPING: Final[Dict[str, str]] = { | ||
"h2o": "water_vapor", | ||
"co2": "carbon_dioxide_GM", | ||
"o3": "ozone", | ||
"n2o": "nitrous_oxide_GM", | ||
"co": "carbon_monoxide_GM", | ||
"ch4": "methane_GM", | ||
"o2": "oxygen_GM", | ||
"n2": "nitrogen_GM", | ||
"ccl4": "carbon_tetrachloride_GM", | ||
"cfc11": "cfc11_GM", | ||
"cfc12": "cfc12_GM", | ||
"cfc22": "hcfc22_GM", | ||
"hfc143a": "hfc143a_GM", | ||
"hfc125": "hfc125_GM", | ||
"hfc23": "hfc23_GM", | ||
"hfc32": "hfc32_GM", | ||
"hfc134a": "hfc134a_GM", | ||
"cf4": "cf4_GM", | ||
"no2": "no2", | ||
} | ||
|
||
# Mapping of standard dimension names to dataset-specific names | ||
DEFAULT_DIM_MAPPING: Final[Dict[str, str]] = { | ||
"site": "site", | ||
"layer": "layer", | ||
"level": "level", | ||
} | ||
|
||
# Mapping of standard variable names to dataset-specific names | ||
DEFAULT_VAR_MAPPING: Final[Dict[str, str]] = { | ||
"pres_layer": "pres_layer", | ||
"pres_level": "pres_level", | ||
"temp_layer": "temp_layer", | ||
"temp_level": "temp_level", | ||
"surface_temperature": "surface_temperature", | ||
"solar_zenith_angle": "solar_zenith_angle", | ||
"surface_albedo": "surface_albedo", | ||
"surface_albedo_dir": "surface_albedo_dir", | ||
"surface_albedo_dif": "surface_albedo_dif", | ||
"surface_emissivity": "surface_emissivity", | ||
"surface_emissivity_jacobian": "surface_emissivity_jacobian", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,49 @@ | ||
HELMERT1 = 9.80665 | ||
HELMERT2 = 0.02586 | ||
M_DRY = 0.028964 | ||
M_H2O = 0.018016 | ||
AVOGAD = 6.02214076e23 | ||
"""Physical and mathematical constants used in radiative transfer calculations. | ||
This module contains various physical and mathematical constants needed for | ||
radiative transfer calculations, including gravitational parameters, molecular | ||
masses, and Gaussian quadrature weights and points. | ||
""" | ||
|
||
from typing import Dict, Final | ||
|
||
import numpy as np | ||
from numpy.typing import NDArray | ||
|
||
# Gravitational parameters from Helmert's equation (m/s^2) | ||
HELMERT1: Final[float] = 9.80665 # Standard gravity at sea level | ||
HELMERT2: Final[float] = 0.02586 # Gravity variation with latitude | ||
|
||
# Molecular masses (kg/mol) | ||
M_DRY: Final[float] = 0.028964 # Dry air | ||
M_H2O: Final[float] = 0.018016 # Water vapor | ||
|
||
# Avogadro's number (molecules/mol) | ||
AVOGAD: Final[float] = 6.02214076e23 | ||
|
||
# Solar constants for orbit calculations | ||
SOLAR_CONSTANTS: Final[Dict[str, float]] = { | ||
"A_OFFSET": 0.1495954, # Semi-major axis offset (AU) | ||
"B_OFFSET": 0.00066696, # Orbital eccentricity factor | ||
} | ||
|
||
# Gaussian quadrature constants for radiative transfer | ||
GAUSS_DS: NDArray[np.float64] = np.reciprocal( | ||
np.array( | ||
[ | ||
[0.6096748751, np.inf, np.inf, np.inf], | ||
[0.2509907356, 0.7908473988, np.inf, np.inf], | ||
[0.1024922169, 0.4417960320, 0.8633751621, np.inf], | ||
[0.0454586727, 0.2322334416, 0.5740198775, 0.9030775973], | ||
] | ||
) | ||
) | ||
|
||
GAUSS_WTS: NDArray[np.float64] = np.array( | ||
[ | ||
[1.0, 0.0, 0.0, 0.0], | ||
[0.2300253764, 0.7699746236, 0.0, 0.0], | ||
[0.0437820218, 0.3875796738, 0.5686383044, 0.0], | ||
[0.0092068785, 0.1285704278, 0.4323381850, 0.4298845087], | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from enum import Enum, StrEnum | ||
|
||
|
||
class GasOpticsFiles(StrEnum): | ||
"""Enumeration of default RRTMGP gas optics data files. | ||
This enum defines the available pre-configured gas optics data files that can be used | ||
with RRTMGP. The files contain absorption coefficients and other optical properties | ||
needed for radiative transfer calculations. | ||
Attributes: | ||
LW_G128: Longwave gas optics file with 128 g-points | ||
LW_G256: Longwave gas optics file with 256 g-points | ||
SW_G112: Shortwave gas optics file with 112 g-points | ||
SW_G224: Shortwave gas optics file with 224 g-points | ||
""" | ||
|
||
LW_G128 = "rrtmgp-gas-lw-g128.nc" | ||
LW_G256 = "rrtmgp-gas-lw-g256.nc" | ||
SW_G112 = "rrtmgp-gas-sw-g112.nc" | ||
SW_G224 = "rrtmgp-gas-sw-g224.nc" | ||
|
||
|
||
class ProblemTypes(StrEnum): | ||
"""Enumeration of available radiation calculation types. | ||
This enum defines the different types of radiation calculations that can be performed, | ||
including both longwave and shortwave calculations with different solution methods. | ||
Attributes: | ||
LW_ABSORPTION: Longwave absorption-only calculation | ||
LW_2STREAM: Longwave two-stream approximation calculation | ||
SW_DIRECT: Shortwave direct beam calculation | ||
SW_2STREAM: Shortwave two-stream approximation calculation | ||
""" | ||
|
||
LW_ABSORPTION = "Longwave absorption" | ||
LW_2STREAM = "Longwave 2-stream" | ||
SW_DIRECT = "Shortwave direct" | ||
SW_2STREAM = "Shortwave 2-stream" |
Oops, something went wrong.