GUIBRUSHR.General_Constants.Classes.TemperatureProfile module¶
Temperature Profile Generator Module
This module provides various methods for generating temperature profiles for atmospheric modeling. It supports multiple profile types including isothermal, Guillot, Madhu, personalized linear, and four-node spline interpolation profiles.
The module includes uncertainty propagation capabilities for all profile types, allowing for error estimation through parameter perturbation.
- GUIBRUSHR.General_Constants.Classes.TemperatureProfile.bernstein_poly(i: int, n: int, t: ndarray) ndarray[source]¶
Calculate the Bernstein polynomial of degree n and index i.
- Parameters:
i (int) – Index of the Bernstein polynomial
n (int) – Degree of the polynomial
t (np.ndarray) – Array of points at which to evaluate the polynomial
- Returns:
Values of the Bernstein polynomial at points t
- Return type:
np.ndarray
- GUIBRUSHR.General_Constants.Classes.TemperatureProfile.bezier_curve(points, nTimes: int = 1000) tuple[ndarray, ndarray][source]¶
Generate a Bezier curve from a set of control points.
- Parameters:
points (list) – List of [x,y] control points defining the curve
nTimes (int, optional) – Number of points to generate along the curve. Defaults to 1000.
- Returns:
Arrays of x and y coordinates along the curve
- Return type:
tuple[np.ndarray, np.ndarray]
- class GUIBRUSHR.General_Constants.Classes.TemperatureProfile.TemperatureProfile(pressures: ndarray, parameters: dict, gravity: float, error: bool = False, rng: Generator | None = None)[source]¶
Bases:
objectA class for generating various types of temperature profiles for atmospheric modeling.
This class supports multiple profile types including isothermal, Guillot, Madhu, personalized linear, and four-node spline interpolation profiles. It includes built-in uncertainty propagation capabilities.
- pressures¶
Array of pressure levels
- Type:
np.ndarray
- parameters¶
Dictionary of parameter objects with values and errors
- Type:
dict
- gravity¶
Gravitational acceleration
- Type:
float
- error¶
Whether to compute error profiles
- Type:
bool
- rng¶
Random number generator for error propagation
- Type:
np.random.Generator
- __init__(pressures: ndarray, parameters: dict, gravity: float, error: bool = False, rng: Generator | None = None)[source]¶
Initialize the TemperatureProfile generator.
- Parameters:
pressures (np.ndarray) – Array of pressure levels
parameters (dict) – Dictionary of parameter objects with values and errors
gravity (float) – Gravitational acceleration
error (bool, optional) – Whether to compute error profiles. Defaults to False.
rng (np.random.Generator, optional) – Random number generator. If None, creates a new one.
- return_rnd_for_error(name: str, amount: int = 100) ndarray[source]¶
Generate random samples for a parameter within its error bounds.
- Parameters:
name (str) – Name of the parameter to sample
amount (int, optional) – Number of samples to generate. Defaults to 100.
- Returns:
Array of random samples within parameter’s error bounds
- Return type:
np.ndarray
- Raises:
KeyError – If parameter name is not found in self.parameters
- isot() tuple[ndarray, None][source]¶
Compute an isothermal temperature profile.
The isothermal model returns a constant temperature for all pressure levels, with no associated uncertainty.
- Returns:
temperature: Array of the isothermal temperature (T0) at each pressure
None: No error profile is computed for the isothermal model
- Return type:
tuple[np.ndarray, None]
- Raises:
KeyError – If T0 parameter is not found in parameters dictionary
- guillot() tuple[ndarray, ndarray | None][source]¶
Compute the temperature profile using the Guillot model.
This method computes the nominal temperature profile using the Guillot model. If error propagation is enabled (self.error is True), it also computes an ensemble of temperature profiles using random perturbations of the input parameters.
- Returns:
temperature: Nominal temperature profile
error_temperatures: If self.error is True, array of shape (len(pressures), num_samples) containing perturbed profiles. Otherwise None.
- Return type:
tuple[np.ndarray, np.ndarray | None]
- Raises:
KeyError – If required parameters (kappa_IR, gamma_g, T_int, T0) are not found
- madhu() tuple[ndarray, ndarray | None][source]¶
Compute the temperature profile using the Madhu model.
This method calculates the nominal temperature profile using the Madhu model with the following parameters: - p1, p2, p3: Pressure control points - alpha1, alpha2: Temperature gradient parameters - T0: Base temperature
If error propagation is enabled, it computes an ensemble of profiles by sampling parameters within their error bounds.
- Returns:
temperature: Nominal temperature profile
error_temperatures: If self.error is True, array of shape (len(pressures), 100) containing perturbed profiles. Otherwise None.
- Return type:
tuple[np.ndarray, np.ndarray | None]
- Raises:
KeyError – If required parameters are not found in parameters dictionary
- personalized() tuple[ndarray, ndarray | None][source]¶
Compute a personalized temperature profile based on pressure thresholds.
The profile is computed as a linear function of log10(pressure) between two pressure thresholds (P_low and P_high) with corresponding temperatures (T_low and T_high). The temperature is: - T_low for pressures > 10^P_low - T_high for pressures < 10^P_high - Linearly interpolated in between
- Returns:
temperature: Nominal temperature profile
error_temperatures: If self.error is True, array of shape (len(pressures), 100) containing perturbed profiles. Otherwise None.
- Return type:
tuple[np.ndarray, np.ndarray | None]
- Raises:
KeyError – If required parameters are not found in parameters dictionary
- FourNodeSpline() tuple[ndarray, ndarray | None][source]¶
Compute the temperature profile using a four-node Bezier spline interpolation.
The profile is created by interpolating between four node points using a Bezier curve: - Temperature nodes: [T3_node, T2_node, T1_node, T0_node] - Pressure nodes: [log10(max(pressure)), P2_node, P1_node, log10(min(pressure))]
The interpolation is performed in log-pressure space.
- Returns:
temperature: Nominal temperature profile
error_temperatures: If self.error is True, array of shape (len(pressures), 100) containing perturbed profiles. Otherwise None.
- Return type:
tuple[np.ndarray, np.ndarray | None]
- Raises:
KeyError – If required parameters are not found in parameters dictionary