Skip to content

Commit

Permalink
remove lon-slice fieldset
Browse files Browse the repository at this point in the history
It could be replaced with a simpler fieldset without breaking tests
  • Loading branch information
VeckoTheGecko committed Sep 16, 2024
1 parent b666406 commit e57ac50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 2 additions & 2 deletions tests/test_particlefile.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
from parcels.particlefile import _set_calendar
from parcels.tools.converters import _get_cftime_calendars, _get_cftime_datetimes
from tests.common_kernels import DoNothing
from tests.utils import create_fieldset_zeros_lon_slice
from tests.utils import create_fieldset_zeros_simple

ptype = {"scipy": ScipyParticle, "jit": JITParticle}


@pytest.fixture
def fieldset():
return create_fieldset_zeros_lon_slice()
return create_fieldset_zeros_simple()


@pytest.mark.parametrize("mode", ["scipy", "jit"])
Expand Down
12 changes: 0 additions & 12 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ def create_fieldset_global(xdim=200, ydim=100):
return FieldSet.from_data(data, dimensions, mesh="flat", transpose=True)


def create_fieldset_zeros_lon_slice(xdim=40, ydim=100):
"""Zero velocity fieldset, but with a slice in the longitude dimension."""
U = np.zeros((ydim, xdim), dtype=np.float32)
V = np.zeros((ydim, xdim), dtype=np.float32)
lon = np.linspace(0, 1, xdim, dtype=np.float32)
lat = np.linspace(-60, 60, ydim, dtype=np.float32)
depth = np.zeros(1, dtype=np.float32)
data = {"U": np.array(U, dtype=np.float32), "V": np.array(V, dtype=np.float32)}
dimensions = {"lat": lat, "lon": lon, "depth": depth}
return FieldSet.from_data(data, dimensions)


def create_fieldset_zeros_conversion(mesh="spherical", xdim=200, ydim=100, mesh_conversion=1) -> FieldSet:
"""Zero velocity field with lat and lon determined by a conversion factor."""
lon = np.linspace(-1e5 * mesh_conversion, 1e5 * mesh_conversion, xdim, dtype=np.float32)
Expand Down

0 comments on commit e57ac50

Please sign in to comment.