From e472ff035f372e768403ca0d0b0bcf6596dc0cf9 Mon Sep 17 00:00:00 2001 From: michaeldenes Date: Tue, 4 Jun 2024 15:30:07 +0200 Subject: [PATCH] Creating a test for fieldset creation --- tests/test_constructors.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/test_constructors.py diff --git a/tests/test_constructors.py b/tests/test_constructors.py new file mode 100644 index 0000000..cf748f5 --- /dev/null +++ b/tests/test_constructors.py @@ -0,0 +1,19 @@ +import plasticparcels as pp +import parcels +from datetime import datetime, timedelta + +def test_create_fieldset(): + settings_file = 'tests/test_data/test_settings.json' + settings = pp.utils.load_settings(settings_file) + settings = pp.utils.download_plasticparcels_dataset('NEMO0083', settings, 'input_data') + + settings['simulation'] = {'startdate': datetime.strptime('2020-01-04-00:00:00', '%Y-%m-%d-%H:%M:%S'), # Start date of simulation + 'runtime': timedelta(days=2), # Runtime of simulation + 'outputdt': timedelta(hours=1), # Timestep of output + 'dt': timedelta(minutes=20), # Timestep of advection + } + + fieldset = pp.constructors.create_fieldset(settings) + + assert isinstance(fieldset, parcels.FieldSet) +