diff --git a/parcels/field.py b/parcels/field.py index 0bdffa7ee7..56baa6cd08 100644 --- a/parcels/field.py +++ b/parcels/field.py @@ -691,8 +691,6 @@ def _reshape(self, data): # Ensure that field data is the right data type if not isinstance(data, (np.ndarray)): data = np.array(data) - if self.grid._lat_flipped: - data = np.flip(data, axis=-2) if self.grid.xdim == 1 or self.grid.ydim == 1: data = np.squeeze(data) # First remove all length-1 dimensions in data, so that we can add them below diff --git a/parcels/grid.py b/parcels/grid.py index 11f67c6af1..90e7652e82 100644 --- a/parcels/grid.py +++ b/parcels/grid.py @@ -1,5 +1,4 @@ import functools -import warnings from enum import IntEnum import numpy as np @@ -7,7 +6,6 @@ from parcels._typing import Mesh, UpdateStatus, assert_valid_mesh from parcels.tools.converters import TimeConverter -from parcels.tools.warnings import FieldSetWarning __all__ = [ "CurvilinearSGrid", @@ -68,7 +66,6 @@ def __init__( assert_valid_mesh(mesh) self._mesh = mesh self._zonal_periodic = False - self._lat_flipped = False self._defer_load = False self._lonlat_minmax = np.array( [np.nanmin(lon), np.nanmax(lon), np.nanmin(lat), np.nanmax(lat)], dtype=np.float32 @@ -251,16 +248,6 @@ def __init__(self, lon, lat, time, time_origin, mesh: Mesh): super().__init__(lon, lat, time, time_origin, mesh) self.tdim = self.time.size - if self.ydim > 1 and self.lat[-1] < self.lat[0]: - self._lat = np.flip(self.lat, axis=0) - self._lat_flipped = True - warnings.warn( - "Flipping lat data from North-South to South-North. " - "Note that this may lead to wrong sign for meridional velocity, so tread very carefully", - FieldSetWarning, - stacklevel=2, - ) - @property def xdim(self): return self.lon.size @@ -379,8 +366,6 @@ def __init__( ), "depth dimension has the wrong format. It should be [zdim, ydim, xdim]" if not self.depth.dtype == np.float32: self._depth = self.depth.astype(np.float32) - if self._lat_flipped: - self._depth = np.flip(self.depth, axis=-2) @property def zdim(self): diff --git a/tests/test_fieldset_sampling.py b/tests/test_fieldset_sampling.py index 8d1636a45b..23e952ab91 100644 --- a/tests/test_fieldset_sampling.py +++ b/tests/test_fieldset_sampling.py @@ -382,15 +382,11 @@ def test_partialslip_nearland_vertical(boundaryslip): assert np.allclose([p.lat for p in pset], 0.1) -@pytest.mark.parametrize("lat_flip", [False, True]) -def test_fieldset_sample_particle(lat_flip): +def test_fieldset_sample_particle(): """Sample the fieldset using an array of particles.""" npart = 120 lon = np.linspace(-180, 180, 200, dtype=np.float32) - if lat_flip: - lat = np.linspace(90, -90, 100, dtype=np.float32) - else: - lat = np.linspace(-90, 90, 100, dtype=np.float32) + lat = np.linspace(-90, 90, 100, dtype=np.float32) V, U = np.meshgrid(lon, lat) data = {"U": U, "V": V} dimensions = {"lon": lon, "lat": lat} diff --git a/tests/tools/test_warnings.py b/tests/tools/test_warnings.py index 4e8e14d13e..1e6266638f 100644 --- a/tests/tools/test_warnings.py +++ b/tests/tools/test_warnings.py @@ -17,16 +17,6 @@ from tests.utils import TEST_DATA -def test_fieldset_warning_latflipped(): - # flipping lats warning - lat = [0, 1, 5, -5] - lon = [0, 1, 5, 10] - u = [[1, 1, 1, 1] for _ in range(4)] - v = [[1, 1, 1, 1] for _ in range(4)] - with pytest.warns(FieldSetWarning, match="Flipping lat data from North-South to South-North.*"): - FieldSet.from_data(data={"U": u, "V": v}, dimensions={"lon": lon, "lat": lat}) - - def test_fieldset_warning_pop(): filenames = str(TEST_DATA / "POPtestdata_time.nc") variables = {"U": "U", "V": "V", "W": "W", "T": "T"}