Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions parcels/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -231,20 +225,13 @@ 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)

# 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

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_fieldset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading