diff --git a/docs/whats_new.md b/docs/whats_new.md index 6c0a0c8..c93ebb1 100644 --- a/docs/whats_new.md +++ b/docs/whats_new.md @@ -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 diff --git a/particle_tracking_manager/models/opendrift/config.json b/particle_tracking_manager/models/opendrift/config.json index d3499f3..9d12f85 100644 --- a/particle_tracking_manager/models/opendrift/config.json +++ b/particle_tracking_manager/models/opendrift/config.json @@ -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, @@ -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": { @@ -42,7 +42,7 @@ "stokes_drift": { "default": true, "od_mapping": "drift:stokes_drift", - "ptm_level": 1 + "ptm_level": 2 }, "use_auto_landmask": { "default": false, @@ -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, @@ -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)", @@ -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", @@ -202,7 +202,7 @@ "high" ], "default": "low", - "ptm_level": 2, + "ptm_level": 3, "description": "Log verbosity" } } diff --git a/particle_tracking_manager/models/opendrift/opendrift.py b/particle_tracking_manager/models/opendrift/opendrift.py index 80f7779..edeaedf 100644 --- a/particle_tracking_manager/models/opendrift/opendrift.py +++ b/particle_tracking_manager/models/opendrift/opendrift.py @@ -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"]: diff --git a/particle_tracking_manager/the_manager_config.json b/particle_tracking_manager/the_manager_config.json index 38013a9..7962fa6 100644 --- a/particle_tracking_manager/the_manager_config.json +++ b/particle_tracking_manager/the_manager_config.json @@ -60,7 +60,7 @@ "type": "bool", "default": true, "description": "Run forward in time.", - "ptm_level": 1 + "ptm_level": 2 }, "time_step": { "type": [ @@ -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": [ @@ -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", @@ -145,7 +145,7 @@ "vertical_mixing": { "default": true, "od_mapping": "drift:vertical_mixing", - "ptm_level": 1 + "ptm_level": 2 }, "z": { "default": 0, @@ -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": { diff --git a/tests/test_opendrift.py b/tests/test_opendrift.py index 969faf6..41c1e9f 100644 --- a/tests/test_opendrift.py +++ b/tests/test_opendrift.py @@ -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"] @@ -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