diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..e36aad9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Fixed + +- Switch to using np.arctan2 rather than np.arctan for Probabilistic Advection [#2](https://github.com/dmidk/SolarSTEPS/pull/2), @KristianHMoller + diff --git a/Models/ProbabilisticAdvection.py b/Models/ProbabilisticAdvection.py index ecf667a..87d3875 100644 --- a/Models/ProbabilisticAdvection.py +++ b/Models/ProbabilisticAdvection.py @@ -62,8 +62,10 @@ def ens_forecast(self, else: raise Exception('angle_pert_dist must be either normal or vonmises') - pert_motion_field[0, :, :] = pert_abs * np.cos(np.arctan(y / x) + beta_noise) - pert_motion_field[1, :, :] = pert_abs * np.sin(np.arctan(y / x) + beta_noise) + # Use arctan2 for angle calculation to handle all quadrants correctly + base_angle = np.arctan2(y, x) + pert_motion_field[0, :, :] = pert_abs * np.cos(base_angle + beta_noise) + pert_motion_field[1, :, :] = pert_abs * np.sin(base_angle + beta_noise) yhat_maps = self.extrapolate(self.last_map, pert_motion_field,