diff --git a/docs/environment_docs.yml b/docs/environment_docs.yml index 0b11b29..dca5e66 100644 --- a/docs/environment_docs.yml +++ b/docs/environment_docs.yml @@ -26,8 +26,8 @@ dependencies: - ipython - numpydoc - nbsphinx - - sphinx<6 - - pandoc>3,<4 + - sphinx + - pandoc - pydata-sphinx-theme - sphinx-autobuild - myst-parser diff --git a/tests/test_data/test_KZ_2020-01-01.nc b/tests/test_data/test_KZ_2020-01-01.nc new file mode 100644 index 0000000..d00380a Binary files /dev/null and b/tests/test_data/test_KZ_2020-01-01.nc differ diff --git a/tests/test_data/test_KZ_2020-01-04.nc b/tests/test_data/test_KZ_2020-01-04.nc index 9b48f49..510f44d 100644 Binary files a/tests/test_data/test_KZ_2020-01-04.nc and b/tests/test_data/test_KZ_2020-01-04.nc differ diff --git a/tests/test_data/test_KZ_2020-01-05.nc b/tests/test_data/test_KZ_2020-01-05.nc new file mode 100644 index 0000000..8d583a3 Binary files /dev/null and b/tests/test_data/test_KZ_2020-01-05.nc differ diff --git a/tests/test_data/test_S_2020-01-01.nc b/tests/test_data/test_S_2020-01-01.nc new file mode 100644 index 0000000..272fa5d Binary files /dev/null and b/tests/test_data/test_S_2020-01-01.nc differ diff --git a/tests/test_data/test_S_2020-01-04.nc b/tests/test_data/test_S_2020-01-04.nc index ef14e53..34ad6e3 100644 Binary files a/tests/test_data/test_S_2020-01-04.nc and b/tests/test_data/test_S_2020-01-04.nc differ diff --git a/tests/test_data/test_S_2020-01-05.nc b/tests/test_data/test_S_2020-01-05.nc new file mode 100644 index 0000000..bf83b84 Binary files /dev/null and b/tests/test_data/test_S_2020-01-05.nc differ diff --git a/tests/test_data/test_T_2020-01-01.nc b/tests/test_data/test_T_2020-01-01.nc new file mode 100644 index 0000000..043b9f8 Binary files /dev/null and b/tests/test_data/test_T_2020-01-01.nc differ diff --git a/tests/test_data/test_T_2020-01-04.nc b/tests/test_data/test_T_2020-01-04.nc index 8f5cecb..3c87ac6 100644 Binary files a/tests/test_data/test_T_2020-01-04.nc and b/tests/test_data/test_T_2020-01-04.nc differ diff --git a/tests/test_data/test_T_2020-01-05.nc b/tests/test_data/test_T_2020-01-05.nc new file mode 100644 index 0000000..ba3aad5 Binary files /dev/null and b/tests/test_data/test_T_2020-01-05.nc differ diff --git a/tests/test_data/test_U_2020-01-01.nc b/tests/test_data/test_U_2020-01-01.nc new file mode 100644 index 0000000..2c83630 Binary files /dev/null and b/tests/test_data/test_U_2020-01-01.nc differ diff --git a/tests/test_data/test_U_2020-01-04.nc b/tests/test_data/test_U_2020-01-04.nc index f11f7e6..4424087 100644 Binary files a/tests/test_data/test_U_2020-01-04.nc and b/tests/test_data/test_U_2020-01-04.nc differ diff --git a/tests/test_data/test_U_2020-01-05.nc b/tests/test_data/test_U_2020-01-05.nc new file mode 100644 index 0000000..4051dc3 Binary files /dev/null and b/tests/test_data/test_U_2020-01-05.nc differ diff --git a/tests/test_data/test_V_2020-01-01.nc b/tests/test_data/test_V_2020-01-01.nc new file mode 100644 index 0000000..c98a555 Binary files /dev/null and b/tests/test_data/test_V_2020-01-01.nc differ diff --git a/tests/test_data/test_V_2020-01-04.nc b/tests/test_data/test_V_2020-01-04.nc index eadf013..518200a 100644 Binary files a/tests/test_data/test_V_2020-01-04.nc and b/tests/test_data/test_V_2020-01-04.nc differ diff --git a/tests/test_data/test_V_2020-01-05.nc b/tests/test_data/test_V_2020-01-05.nc new file mode 100644 index 0000000..41efb5f Binary files /dev/null and b/tests/test_data/test_V_2020-01-05.nc differ diff --git a/tests/test_data/test_W_2020-01-01.nc b/tests/test_data/test_W_2020-01-01.nc new file mode 100644 index 0000000..724e760 Binary files /dev/null and b/tests/test_data/test_W_2020-01-01.nc differ diff --git a/tests/test_data/test_W_2020-01-04.nc b/tests/test_data/test_W_2020-01-04.nc index 8a82b6d..a9ed681 100644 Binary files a/tests/test_data/test_W_2020-01-04.nc and b/tests/test_data/test_W_2020-01-04.nc differ diff --git a/tests/test_data/test_W_2020-01-05.nc b/tests/test_data/test_W_2020-01-05.nc new file mode 100644 index 0000000..3cbb663 Binary files /dev/null and b/tests/test_data/test_W_2020-01-05.nc differ diff --git a/tests/test_data/test_bathymetry_mesh_zgr.nc b/tests/test_data/test_bathymetry_mesh_zgr.nc index c33e354..d0500a8 100644 Binary files a/tests/test_data/test_bathymetry_mesh_zgr.nc and b/tests/test_data/test_bathymetry_mesh_zgr.nc differ diff --git a/tests/test_data/test_bgc_mesh_hgr.nc b/tests/test_data/test_bgc_mesh_hgr.nc index d51ad1e..6ddcb50 100644 Binary files a/tests/test_data/test_bgc_mesh_hgr.nc and b/tests/test_data/test_bgc_mesh_hgr.nc differ diff --git a/tests/test_data/test_nppv_2020-01-04.nc b/tests/test_data/test_nppv_2020-01-04.nc index d8ba01a..50c06ec 100644 Binary files a/tests/test_data/test_nppv_2020-01-04.nc and b/tests/test_data/test_nppv_2020-01-04.nc differ diff --git a/tests/test_data/test_nppv_2020-01-05.nc b/tests/test_data/test_nppv_2020-01-05.nc new file mode 100644 index 0000000..ad4f7b8 Binary files /dev/null and b/tests/test_data/test_nppv_2020-01-05.nc differ diff --git a/tests/test_data/test_ocean_mesh_hgr.nc b/tests/test_data/test_ocean_mesh_hgr.nc index d1f3720..509dd48 100644 Binary files a/tests/test_data/test_ocean_mesh_hgr.nc and b/tests/test_data/test_ocean_mesh_hgr.nc differ diff --git a/tests/test_data/test_phy2_2020-01-04.nc b/tests/test_data/test_phy2_2020-01-04.nc index 0368729..9d634a1 100644 Binary files a/tests/test_data/test_phy2_2020-01-04.nc and b/tests/test_data/test_phy2_2020-01-04.nc differ diff --git a/tests/test_data/test_phy2_2020-01-05.nc b/tests/test_data/test_phy2_2020-01-05.nc new file mode 100644 index 0000000..888513c Binary files /dev/null and b/tests/test_data/test_phy2_2020-01-05.nc differ diff --git a/tests/test_data/test_phy_2020-01-04.nc b/tests/test_data/test_phy_2020-01-04.nc index 86971d8..1255b98 100644 Binary files a/tests/test_data/test_phy_2020-01-04.nc and b/tests/test_data/test_phy_2020-01-04.nc differ diff --git a/tests/test_data/test_phy_2020-01-05.nc b/tests/test_data/test_phy_2020-01-05.nc new file mode 100644 index 0000000..b43fe2a Binary files /dev/null and b/tests/test_data/test_phy_2020-01-05.nc differ diff --git a/tests/test_data/test_waves_2020-01-04.nc b/tests/test_data/test_waves_2020-01-04.nc index a28fc65..a935381 100644 Binary files a/tests/test_data/test_waves_2020-01-04.nc and b/tests/test_data/test_waves_2020-01-04.nc differ diff --git a/tests/test_data/test_wind_2020-01-04.nc b/tests/test_data/test_wind_2020-01-04.nc index a6ce7fb..c27845f 100644 Binary files a/tests/test_data/test_wind_2020-01-04.nc and b/tests/test_data/test_wind_2020-01-04.nc differ diff --git a/tests/test_kernels.py b/tests/test_kernels.py index 765a0ef..0cf758c 100644 --- a/tests/test_kernels.py +++ b/tests/test_kernels.py @@ -19,7 +19,7 @@ def make_standard_plastictype_settings(): # Use tiny wind percentage because test data set is not large and wind speeds are quick! plastictype_settings = {'wind_coefficient': 0.0001, # Percentage of wind to apply to particles 'plastic_diameter': 0.001, # Plastic particle diameter (m) - 'plastic_density': 1030., # Plastic particle density (kg/m^3) + 'plastic_density': 1027.67, # Plastic particle density (kg/m^3) } return plastictype_settings @@ -32,6 +32,14 @@ def make_standard_particleset(fieldset, settings): return pset +def checkBelowDataDepth(particle, fieldset, time): + # The vertical mixing kernel can push particles below the test dataset depth, throwing an + # out of bounds error. This kernel will keep particles above the max depth. + if particle.depth + particle_ddepth >= fieldset.max_depth: # noqa + # move a meter above the max depth + particle_ddepth = fieldset.max_depth - particle.depth - 1.0 # noqa + particle.state = parcels.StatusCode.Success + @pytest.mark.parametrize('use_3D', [True, False]) def test_advection_only(use_3D): @@ -159,7 +167,6 @@ def test_Stokes(): start_lons = pset.lon.copy() start_lats = pset.lat.copy() - print(pset[0].dt) pset.execute(kernels, runtime=settings['simulation']['runtime'], dt=settings['simulation']['dt']) # Assert that the particles move from their initial location @@ -216,18 +223,23 @@ def test_mixing(): settings['use_stokes'] = False fieldset = pp.constructors.create_fieldset(settings) + fieldset.add_constant('max_depth', fieldset.U.depth[-1]) + + # Set the simulation runtime to just 1 day so particles aren't kicked around significantly + settings['simulation']['runtime'] = timedelta(days=1) + kernels = [parcels.application_kernels.AdvectionRK4_3D, pp.kernels.checkThroughBathymetry, pp.kernels.checkErrorThroughSurface, pp.kernels.deleteParticle] kernels_mixing = [parcels.application_kernels.AdvectionRK4_3D, pp.kernels.VerticalMixing, - pp.kernels.checkThroughBathymetry, pp.kernels.checkErrorThroughSurface, - pp.kernels.deleteParticle] + checkBelowDataDepth, pp.kernels.checkThroughBathymetry, + pp.kernels.checkErrorThroughSurface, pp.kernels.deleteParticle] pset = make_standard_particleset(fieldset, settings) pset_mixing = make_standard_particleset(fieldset, settings) pset.execute(kernels, runtime=settings['simulation']['runtime'], dt=settings['simulation']['dt']) - pset.execute(kernels_mixing, runtime=settings['simulation']['runtime'], dt=settings['simulation']['dt']) + pset_mixing.execute(kernels_mixing, runtime=settings['simulation']['runtime'], dt=settings['simulation']['dt']) # Assert that the particles move from their initial location assert (np.sum(np.abs(pset.lon - pset_mixing.lon)) > 0.) & (np.sum(np.abs(pset.lat - pset_mixing.lat)) > 0.)