Auxiliary functions
Collection of auxiliary functions used in emission calculations.
- reemission.auxiliary.air_density(mean_temp: float) float[source]
- Calculate air density. - This function calculates the air density in kg/m\(^3\) using the equation A.1 from Praire2021. - Parameters:
- mean_temp (float) – Mean temperature in degrees Celsius of the four warmest months in a year. 
- Returns:
- Air density, kg/m\(^3\). 
- Return type:
- float 
 
- reemission.auxiliary.cd_factor(wind_speed: float) float[source]
- Calculate the CD coefficient. - This function calculates the CD coefficient using equation A.6 from Praire2021. - Parameters:
- wind_speed (float) – Reservoir mean wind speed, m/s. 
- Returns:
- CD coefficient, –. 
- Return type:
- float 
 
- reemission.auxiliary.rollout_nested_list(nested_list: List[Any], out_list: List | None = None) List[Any][source]
- Flatten a nested list. - This function takes a nested list and returns a flattened version of that list. - Parameters:
- nested_list (List[Any]) – A list containing other lists and/or non-list elements. 
- out_list (Optional[List], optional) – An empty list to store the flattened output. 
 
- Returns:
- A flattened version of the nested_list. 
- Return type:
- List[Any] 
 - Example - nested_list = [1, [2, 3], 4, [[5, 6], 7]] flattened_list = rollout_nested_list(nested_list) print(flattened_list) # prints [1, 2, 3, 4, 5, 6, 7]
- reemission.auxiliary.scale_windspeed(wind_speed: float, wind_height: float, new_height: float, max_iter: int = 100, tol: float = 0.0001) float[source]
- Scale wind speed to a new height using iterative method. - This function calculates wind speed at a new height using an iterative approach, because the drag coefficient depends on the new wind speed. - Parameters:
- wind_speed (float) – Known wind speed, m/s. 
- wind_height (float) – Known wind height, m. 
- new_height (float) – Target height for which wind speed is calculated, m. 
- max_iter (int) – Maximum number of iterations. 
- tol (float) – Tolerance for convergence. 
 
- Returns:
- Estimated wind speed at new_height, m/s. 
- Return type:
- float 
 
- reemission.auxiliary.scale_windspeed_noniter(wind_speed: float, wind_height: float, new_height: float) float[source]
- Scale wind speed to a new height. - This function calculates the wind speed at a desired height based on the original wind speed at a known height. - Parameters:
- wind_speed (float) – Known wind speed, m/s. 
- wind_height (float) – Known wind height, m. 
- new_height (float) – New height for which wind speed is calculated, m. 
 
 - Note - Default wind height is 50m. - Returns:
- Wind speed at new_height, m/s. 
- Return type:
- float 
 
- reemission.auxiliary.water_density(temp: float) float[source]
- Calculate water density as a function of temperature. - This function calculates the water density in kg/m\(^3\) as a function of temperature in degrees Celsius using the equation A.3 from Praire2021. - Parameters:
- temp (float) – Temperature in degrees Celsius. 
- Returns:
- Water density, kg/m\(^3\). 
- Return type:
- float