Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mostly just updates to ptm_levels #26

Merged
merged 1 commit into from
Apr 24, 2024
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
4 changes: 4 additions & 0 deletions docs/whats_new.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# What's New

## v0.8.4 (April 24, 2024)

* updated the `ptm_level` of a bunch of config parameters

## v0.8.3 (April 23, 2024)

* removed `Dcrit` because realized it is not necessary
Expand Down
50 changes: 25 additions & 25 deletions particle_tracking_manager/models/opendrift/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"z",
"origin_marker"
],
"ptm_level": 2,
"ptm_level": 3,
"type": "list",
"description": "List of variables to export. Options available with `m.all_export_variables` for a given `drift_model`. ['lon', 'lat', 'ID', 'status'] will always be exported."
},
"radius": {
"default": 1000.0,
"ptm_level": 1,
"ptm_level": 2,
"type": "float",
"min": 0.0,
"max": 1000000,
Expand All @@ -25,13 +25,13 @@
},
"radius_type": {
"default": "gaussian",
"ptm_level": 2,
"ptm_level": 3,
"type": "enum - gaussian - uniform",
"description": "If 'gaussian' (default), the radius is the standard deviation in x-y-directions. If 'uniform', elements are spread evenly and always inside a circle with the given radius. This is used by function `seed_elements`."
},
"wind_drift_factor": {
"default": 0.02,
"ptm_level": 1,
"ptm_level": 2,
"od_mapping": "seed:wind_drift_factor"
},
"diffusivitymodel": {
Expand All @@ -42,7 +42,7 @@
"stokes_drift": {
"default": true,
"od_mapping": "drift:stokes_drift",
"ptm_level": 1
"ptm_level": 2
},
"use_auto_landmask": {
"default": false,
Expand All @@ -57,12 +57,12 @@
"coastline_action": {
"default": "previous",
"od_mapping": "general:coastline_action",
"ptm_level": 1
"ptm_level": 2
},
"seafloor_action": {
"default": "previous",
"od_mapping": "general:seafloor_action",
"ptm_level": 1
"ptm_level": 2
},
"max_speed": {
"default": 5,
Expand All @@ -71,29 +71,29 @@
"horizontal_diffusivity": {
"default": "None",
"od_mapping": "drift:horizontal_diffusivity",
"ptm_level": 1
"ptm_level": 2
},
"current_uncertainty": {
"default": 0,
"value": 0,
"od_mapping": "drift:current_uncertainty",
"ptm_level": 1
"ptm_level": 2
},
"wind_uncertainty": {
"default": 0,
"value": 0,
"od_mapping": "drift:wind_uncertainty",
"ptm_level": 1
"ptm_level": 2
},
"wind_drift_depth": {
"default": 0.02,
"od_mapping": "drift:wind_drift_depth",
"ptm_level": 2
"ptm_level": 3
},
"vertical_mixing_timestep": {
"default": 60,
"od_mapping": "vertical_mixing:timestep",
"ptm_level": 2
"ptm_level": 3
},
"object_type": {
"default": "Person-in-water (PIW), unknown state (mean values)",
Expand Down Expand Up @@ -138,62 +138,62 @@
"m3_per_hour": {
"default": 1,
"od_mapping": "seed:m3_per_hour",
"ptm_level": 1
"ptm_level": 2
},
"oil_film_thickness": {
"default": 1,
"od_mapping": "seed:oil_film_thickness",
"ptm_level": 2
"ptm_level": 3
},
"droplet_size_distribution": {
"default": "uniform",
"od_mapping": "seed:droplet_size_distribution",
"ptm_level": 2
"ptm_level": 3
},
"droplet_diameter_mu": {
"default": 0.001,
"od_mapping": "seed:droplet_diameter_mu",
"ptm_level": 2
"ptm_level": 3
},
"droplet_diameter_sigma": {
"default": 0.0005,
"od_mapping": "seed:droplet_diameter_sigma",
"ptm_level": 2
"ptm_level": 3
},
"droplet_diameter_min_subsea": {
"default": 0.0005,
"od_mapping": "seed:droplet_diameter_min_subsea",
"ptm_level": 2
"ptm_level": 3
},
"droplet_diameter_max_subsea": {
"default": 0.005,
"od_mapping": "seed:droplet_diameter_max_subsea",
"ptm_level": 2
"ptm_level": 3
},
"emulsification": {
"default": true,
"od_mapping": "processes:emulsification",
"ptm_level": 1
"ptm_level": 2
},
"dispersion": {
"default": true,
"od_mapping": "processes:dispersion",
"ptm_level": 1
"ptm_level": 2
},
"evaporation": {
"default": true,
"od_mapping": "processes:evaporation",
"ptm_level": 1
"ptm_level": 2
},
"update_oilfilm_thickness": {
"default": true,
"od_mapping": "processes:update_oilfilm_thickness",
"ptm_level": 1
"ptm_level": 2
},
"biodegradation": {
"default": true,
"od_mapping": "processes:biodegradation",
"ptm_level": 1
"ptm_level": 2
},
"log": {
"type": "enum",
Expand All @@ -202,7 +202,7 @@
"high"
],
"default": "low",
"ptm_level": 2,
"ptm_level": 3,
"description": "Log verbosity"
}
}
15 changes: 10 additions & 5 deletions particle_tracking_manager/models/opendrift/opendrift.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,19 @@ def __setattr_model__(self, name: str, value) -> None:
self.__dict__["vertical_mixing_timestep"] = None
self.config_model["vertical_mixing_timestep"]["value"] = None

# Make sure diffusivitymodel equals None if vertical_mixing False
# Make sure diffusivitymodel equals default value if vertical_mixing False
if name in ["vertical_mixing", "diffusivitymodel"]:
if not self.vertical_mixing:
dmodeldef = self.config_model["diffusivitymodel"]["default"]
if (
not self.vertical_mixing
and self.diffusivitymodel != dmodeldef
and self.diffusivitymodel is not None
):
self.logger.info(
"vertical_mixing is False, so setting value of diffusivitymodel to None."
"vertical_mixing is False, so resetting value of diffusivitymodel to default and not using."
)
self.__dict__["diffusivitymodel"] = None
self.config_model["diffusivitymodel"]["value"] = None
self.__dict__["diffusivitymodel"] = dmodeldef
self.config_model["diffusivitymodel"]["value"] = dmodeldef

# Make sure mixed_layer_depth equals default value if vertical_mixing False
if name in ["vertical_mixing", "mixed_layer_depth"]:
Expand Down
10 changes: 5 additions & 5 deletions particle_tracking_manager/the_manager_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"type": "bool",
"default": true,
"description": "Run forward in time.",
"ptm_level": 1
"ptm_level": 2
},
"time_step": {
"type": [
Expand All @@ -72,7 +72,7 @@
"max": 86400,
"units": "seconds",
"description": "Interval between particles updates, in seconds or as timedelta.",
"ptm_level": 2
"ptm_level": 3
},
"time_step_output": {
"type": [
Expand All @@ -84,7 +84,7 @@
"max": 604800,
"units": "seconds",
"description": "Time step at which element properties are stored and eventually written to file.",
"ptm_level": 2
"ptm_level": 3
},
"steps": {
"type": "int",
Expand Down Expand Up @@ -145,7 +145,7 @@
"vertical_mixing": {
"default": true,
"od_mapping": "drift:vertical_mixing",
"ptm_level": 1
"ptm_level": 2
},
"z": {
"default": 0,
Expand All @@ -160,7 +160,7 @@
"use_static_masks": {
"type": "bool",
"default": true,
"ptm_level": 2,
"ptm_level": 3,
"description": "Set to True to use static masks for known models instead of wetdry masks. If False, the masks are change in time."
},
"output_file": {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_opendrift.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_init(self):
self.assertEqual(
self.odm.use_auto_landmask, config_model["use_auto_landmask"]["default"]
)
self.assertEqual(self.odm.diffusivitymodel, None)
self.assertEqual(self.odm.diffusivitymodel, "windspeed_Large1994")
self.assertEqual(self.odm.stokes_drift, config_model["stokes_drift"]["default"])
self.assertEqual(
self.odm.mixed_layer_depth, config_model["mixed_layer_depth"]["default"]
Expand Down Expand Up @@ -279,7 +279,7 @@ def test_vertical_mixing_false_diffusivitymodel_not_default(self):
self.m.vertical_mixing = False
self.m.diffusivitymodel = "not_default"
d = self.m.show_config(key="diffusivitymodel")
assert d["value"] == None
assert d["value"] == "windspeed_Large1994"

def test_vertical_mixing_false_mixed_layer_depth_not_default(self):
self.m.vertical_mixing = False
Expand Down
Loading