From 4a1849e1b05321e5f58a6c70720df49f2192ffdf Mon Sep 17 00:00:00 2001 From: Martin Paces Date: Thu, 23 Mar 2023 18:32:49 +0100 Subject: [PATCH] Making MIO scaling by the (1 + N*F10.7) factor optional. --- eoxmagmod/eoxmagmod/magnetic_model/model_mio.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/eoxmagmod/eoxmagmod/magnetic_model/model_mio.py b/eoxmagmod/eoxmagmod/magnetic_model/model_mio.py index 9c6df1f..d7d22ee 100644 --- a/eoxmagmod/eoxmagmod/magnetic_model/model_mio.py +++ b/eoxmagmod/eoxmagmod/magnetic_model/model_mio.py @@ -169,10 +169,14 @@ def _subset(data, mask): ) # MIO scaling factor - mio_scale = 1.0 + self.wolf_ratio * asarray(options.pop('f107')) + mask = True + mio_scale = options.pop('f107', None) + if mio_scale is not None: + mio_scale = 1.0 + self.wolf_ratio * asarray(mio_scale) + mask = ~isnan(mio_scale) start, end = self.validity - mask = (time >= start) & (time <= end) & ~isnan(mio_scale) + mask = (time >= start) & (time <= end) & mask result = full(location.shape, nan) result[mask, :] = self._eval( self._eval_fourier2d, self.coefficients, @@ -182,9 +186,11 @@ def _subset(data, mask): lon_sol=_subset(options.pop('lon_sol', None), mask), **options, ) - if mio_scale.ndim > 0: - mio_scale = reshape_array(location.shape, mio_scale) - result *= mio_scale + + if mio_scale is not None: + if mio_scale.ndim > 0: + mio_scale = reshape_array(location.shape, mio_scale) + result *= mio_scale return result