-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding unit tests files for kernels and initialisationmaps
- Loading branch information
1 parent
d8b6c7a
commit 3706103
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import plasticparcels as pp | ||
import parcels | ||
import pytest | ||
|
||
def make_simple_fieldset(): | ||
fieldset = parcels.FieldSet.from_data({'U': 0, 'V': 0}, {'lon': 0, 'lat': 0}, mesh='spherical') | ||
return fieldset | ||
|
||
|
||
@pytest.mark.parametrize('maptype', ['coastal', 'rivers', 'fisheries', 'global_concentrations']) | ||
def test_maptypes(maptype): | ||
settings = pp.utils.load_settings('docs/examples/example_Italy_coast_settings.json') | ||
for key in settings["release_maps"]: | ||
settings["release_maps"][key] = settings["release_maps"][key].replace("input_data", "docs/examples/input_data") | ||
fieldset = make_simple_fieldset() | ||
|
||
settings['release'] = { | ||
'initialisation_type': maptype, | ||
'country': 'Italy', | ||
} | ||
|
||
settings['plastictype'] = { # TODO these should be defaults? | ||
'wind_coefficient' : 0.01, # Percentage of wind to apply to particles | ||
'plastic_diameter' : 0.001, # Plastic particle diameter (m) | ||
'plastic_density' : 1030., # Plastic particle density (kg/m^3) | ||
} | ||
|
||
pset = pp.constructors.create_particleset_from_map(fieldset, settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import plasticparcels as pp | ||
import parcels | ||
|
||
def make_simple_fieldset(): | ||
fieldset = parcels.FieldSet.from_data({'U': 0, 'V': 0}, {'lon': 0, 'lat': 0}, mesh='spherical') | ||
return fieldset | ||
|
||
def test_kernels_options(): | ||
settings = pp.utils.load_settings('docs/examples/example_Italy_coast_settings.json') | ||
fieldset = make_simple_fieldset() |