-
Notifications
You must be signed in to change notification settings - Fork 3
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
13 changed files
with
896 additions
and
474 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
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 |
---|---|---|
@@ -1,9 +1,48 @@ | ||
HELMERT1 = 9.80665 | ||
HELMERT2 = 0.02586 | ||
M_DRY = 0.028964 | ||
M_H2O = 0.018016 | ||
AVOGAD = 6.02214076e23 | ||
SOLAR_CONSTANTS = { | ||
"A_OFFSET": 0.1495954, | ||
"B_OFFSET": 0.00066696, | ||
"""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 |
---|---|---|
@@ -1,17 +1,40 @@ | ||
from enum import Enum | ||
from enum import Enum, StrEnum | ||
|
||
|
||
class GasOpticsFiles(Enum): | ||
"""Enumeration of default RRTMGP gas optics data files.""" | ||
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(Enum): | ||
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" | ||
LW_2STREAM = "Longwave 2-stream" | ||
SW_DIRECT = "Shortwave direct" | ||
SW_2STREAM = "Shortwave 2-stream" |
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
Oops, something went wrong.