From bac1aa073d3aeb271dfe224adf264ab2755437e0 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 4 Mar 2025 14:00:45 +0100 Subject: [PATCH 1/2] Remove vmin vmax from tests --- tests/test_fieldset.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_fieldset.py b/tests/test_fieldset.py index e6aeac23f0..7ab1cb5db7 100644 --- a/tests/test_fieldset.py +++ b/tests/test_fieldset.py @@ -58,6 +58,8 @@ def test_fieldset_extra_syntax(): FieldSet.from_data(data, dimensions, unknown_keyword=5) +@pytest.mark.v4remove +@pytest.mark.xfail(reason="vmin and vmax were removed as arguments") def test_fieldset_vmin_vmax(): data, dimensions = generate_fieldset_data(11, 11) fieldset = FieldSet.from_data(data, dimensions, vmin=3, vmax=7) From 2b916734cf3e1258abc4c3e637211d48a85401e1 Mon Sep 17 00:00:00 2001 From: Vecko <36369090+VeckoTheGecko@users.noreply.github.com> Date: Tue, 4 Mar 2025 14:03:27 +0100 Subject: [PATCH 2/2] Remove vmin and vmax from Field --- parcels/field.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/parcels/field.py b/parcels/field.py index 56baa6cd08..5e72745012 100644 --- a/parcels/field.py +++ b/parcels/field.py @@ -129,10 +129,6 @@ class Field: mesh and time_origin information. Can be constructed from any of the Grid objects fieldtype : str Type of Field to be used for UnitConverter (either 'U', 'V', 'Kh_zonal', 'Kh_meridional' or None) - vmin : float - Minimum allowed value on the field. Data below this value are set to zero - vmax : float - Maximum allowed value on the field. Data above this value are set to zero time_origin : parcels.tools.converters.TimeConverter Time origin of the time axis (only if grid is None) interp_method : str @@ -166,8 +162,6 @@ def __init__( mesh: Mesh = "flat", timestamps=None, fieldtype=None, - vmin: float | None = None, - vmax: float | None = None, time_origin: TimeConverter | None = None, interp_method: InterpMethod = "linear", allow_time_extrapolation: bool | None = None, @@ -231,9 +225,6 @@ def __init__( else: self.allow_time_extrapolation = allow_time_extrapolation - self.vmin = vmin - self.vmax = vmax - if not self.grid.defer_load: self.data = self._reshape(self.data) self._loaded_time_indices = range(self.grid.tdim) @@ -241,10 +232,6 @@ def __init__( # Hack around the fact that NaN and ridiculously large values # propagate in SciPy's interpolators self.data[np.isnan(self.data)] = 0.0 - if self.vmin is not None: - self.data[self.data < self.vmin] = 0.0 - if self.vmax is not None: - self.data[self.data > self.vmax] = 0.0 self._scaling_factor = None @@ -924,10 +911,6 @@ def _rescale_and_set_minmax(self, data): data[np.isnan(data)] = 0 if self._scaling_factor: data *= self._scaling_factor - if self.vmin is not None: - data[data < self.vmin] = 0 - if self.vmax is not None: - data[data > self.vmax] = 0 return data def _data_concatenate(self, data, data_to_concat, tindex):