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
30 changes: 1 addition & 29 deletions docs/examples/example_dask_chunk_OCMs.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def test_globcurrent_2D(mode, chunk_mode):
# we removed the failsafe, so now if all chunksize dimensions are incorrect, there is nothing left to chunk,
# which raises an error saying so. This is the expected behaviour
if chunk_mode == 'failsafe':
return True
return
# GlobCurrent sample file dimensions: time=UNLIMITED, lat=41, lon=81
if chunk_mode != 'failsafe': # chunking time but not lat
assert (len(field_set.U.grid.load_chunk) == len(field_set.V.grid.load_chunk))
Expand Down Expand Up @@ -587,34 +587,6 @@ def test_diff_entry_chunksize_error_nemo_complex_nonconform_depth(mode):
compute_nemo_particle_advection(fieldset, mode, lonp, latp)


@pytest.mark.parametrize('mode', ['jit'])
def test_erroneous_fieldset_init(mode):
data_folder = download_example_dataset('NemoNorthSeaORCA025-N006_data')
ufiles = sorted(glob(f'{data_folder}/ORCA*U.nc'))
vfiles = sorted(glob(f'{data_folder}/ORCA*V.nc'))
wfiles = sorted(glob(f'{data_folder}/ORCA*W.nc'))
mesh_mask = f'{data_folder}/coordinates.nc'

filenames = {'U': {'lon': mesh_mask, 'lat': mesh_mask, 'depth': wfiles[0], 'data': ufiles},
'V': {'lon': mesh_mask, 'lat': mesh_mask, 'depth': wfiles[0], 'data': vfiles},
'W': {'lon': mesh_mask, 'lat': mesh_mask, 'depth': wfiles[0], 'data': wfiles}}
variables = {'U': 'uo',
'V': 'vo',
'W': 'wo'}
dimensions = {'U': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthw', 'time': 'time_counter'},
'V': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthw', 'time': 'time_counter'},
'W': {'lon': 'glamf', 'lat': 'gphif', 'depth': 'depthw', 'time': 'time_counter'}}
chs = {'U': {'depth': ('depthu', 75), 'lat': ('y', 16), 'lon': ('x', 16)},
'V': {'depth': ('depthv', 75), 'lat': ('y', 16), 'lon': ('x', 16)},
'W': {'depth': ('depthw', 75), 'lat': ('y', 16), 'lon': ('x', 16)}}

try:
FieldSet.from_nemo(filenames, variables, dimensions, chunksize=chs)
except ValueError:
return True
return False


@pytest.mark.parametrize('mode', ['jit'])
def test_diff_entry_chunksize_correction_globcurrent(mode):
data_folder = download_example_dataset("GlobCurrent_example_data")
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ parcels.tools.loggers module
:members:
:undoc-members:

parcels.utils module
parcels.tools.exampledata_utils module
-----------------------------------

.. automodule:: parcels.utils
.. automodule:: parcels.tools.exampledata_utils
:members:
:undoc-members:
1 change: 0 additions & 1 deletion parcels/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
from parcels.particlefile import * # noqa
from parcels.particleset import * # noqa
from parcels.tools import * # noqa
from parcels.utils import * # noqa
2 changes: 1 addition & 1 deletion parcels/interaction/neighborsearch/hashspherical.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def all_neigh_depth(i_lat, i_lon, lat_sign):
neighbors.extend(
all_neigh_depth(new_i_lat, new_i_lon, new_lat_sign))
else:
start_i_lon = int(np.floor(coor[2]/d_lon))
start_i_lon = int(np.floor(coor[2][0]/d_lon))
for delta_lon in [-1, 0, 1]:
new_i_lon = (start_i_lon+delta_lon+n_new_lon) % n_new_lon
neighbors.extend(
Expand Down
1 change: 1 addition & 0 deletions parcels/tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .converters import * # noqa
from .exampledata_utils import * # noqa
from .global_statics import * # noqa
from .interpolation_utils import * # noqa
from .loggers import * # noqa
Expand Down
File renamed without changes.
290 changes: 0 additions & 290 deletions performance/example_performanceProfiling.py

This file was deleted.

10 changes: 5 additions & 5 deletions tests/test_advection.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ class RK45Particles(ptype[mode]):
pset = ParticleSet(fieldset, pclass=pclass, lon=lon, lat=lat)
pset.execute(kernel[method], dt=dt, endtime=endtime)

exp_lon = [truth_moving(x, y, pset.time)[0] for x, y, in zip(lon, lat)]
exp_lat = [truth_moving(x, y, pset.time)[1] for x, y, in zip(lon, lat)]
exp_lon = [truth_moving(x, y, t)[0] for x, y, t in zip(lon, lat, pset.time)]
exp_lat = [truth_moving(x, y, t)[1] for x, y, t in zip(lon, lat, pset.time)]
assert np.allclose(pset.lon, exp_lon, rtol=rtol)
assert np.allclose(pset.lat, exp_lat, rtol=rtol)

Expand Down Expand Up @@ -446,7 +446,7 @@ def test_decaying_eddy(fieldset_decaying, mode, method, rtol, diffField, npart=1
fieldset = fieldset_decaying
if method == 'AA':
if mode == 'jit':
return True # AnalyticalAdvection not implemented in JIT
return # AnalyticalAdvection not implemented in JIT
else:
# needed for AnalyticalAdvection to work, but comes at expense of accuracy
fieldset.U.interp_method = 'cgrid_velocity'
Expand All @@ -468,8 +468,8 @@ class RK45Particles(ptype[mode]):
pset = ParticleSet(fieldset, pclass=pclass, lon=lon, lat=lat)
pset.execute(kernel[method], dt=dt, endtime=endtime)

exp_lon = [truth_decaying(x, y, pset.time)[0] for x, y, in zip(lon, lat)]
exp_lat = [truth_decaying(x, y, pset.time)[1] for x, y, in zip(lon, lat)]
exp_lon = [truth_decaying(x, y, t)[0] for x, y, t in zip(lon, lat, pset.time)]
exp_lat = [truth_decaying(x, y, t)[1] for x, y, t in zip(lon, lat, pset.time)]
assert np.allclose(pset.lon, exp_lon, rtol=rtol)
assert np.allclose(pset.lat, exp_lat, rtol=rtol)

Expand Down
Loading