@@ -328,36 +328,47 @@ def __setattr__(self, name: str, value) -> None:
328
328
# this is not a user-defined option
329
329
if - 180 < self .lon < 0 :
330
330
self .__dict__ ["lon" ] += 360
331
+ self .config_ptm ["lon" ]["value" ] = False
331
332
332
333
if name == "surface_only" and value :
333
334
self .logger .info (
334
- "overriding values for ` do3D`, `z` , and ` vertical_mixing` because ` surface_only` True"
335
+ "Overriding values for do3D, z , and vertical_mixing because surface_only is True (to False, 0, False). "
335
336
)
336
337
self .do3D = False
337
338
self .z = 0
338
339
self .vertical_mixing = False
339
340
340
341
# in case any of these are reset by user after surface_only is already set
341
- if name in ["do3D" , "z" , "vertical_mixing" ]:
342
- if self .surface_only :
343
- self .logger .info (
344
- "overriding values for `do3D`, `z`, and `vertical_mixing` because `surface_only` True"
345
- )
346
- if name == "do3D" :
347
- value = False
348
- if name == "z" :
349
- value = 0
350
- if name == "vertical_mixing" :
351
- value = False
352
- self .__dict__ [name ] = value
353
- self .config_ptm [name ]["value" ] = value
354
-
355
- # if not 3D turn off vertical_mixing
342
+ # if surface_only is True, do3D must be False
343
+ if name == "do3D" and value and self .surface_only :
344
+ self .logger .info (
345
+ "do3D must be False because surface_only is True. Setting do3D to False."
346
+ )
347
+ self .__dict__ ["do3D" ] = False
348
+ self .config_ptm ["do3D" ]["value" ] = False
349
+
350
+ # if surface_only is True, z must be 0
351
+ if name == "z" and value != 0 and self .surface_only :
352
+ self .logger .info (
353
+ "z must be 0 because surface_only is True. Setting z to 0."
354
+ )
355
+ self .__dict__ ["z" ] = 0
356
+ self .config_ptm ["z" ]["value" ] = 0
357
+
358
+ # if surface_only is True, vertical_mixing must be False
359
+ if name == "vertical_mixing" and value and self .surface_only :
360
+ self .logger .info (
361
+ "vertical_mixing must be False because surface_only is True. Setting vertical_mixing to False."
362
+ )
363
+ self .__dict__ ["vertical_mixing" ] = False
364
+ self .config_ptm ["vertical_mixing" ]["value" ] = False
365
+
366
+ # if not 3D turn off vertical_mixing
367
+ if name in ["do3D" , "vertical_mixing" ]:
356
368
if not self .do3D and self .vertical_mixing :
357
- self .logger .info ("turning off vertical_mixing since do3D is False" )
369
+ self .logger .info ("Turning off vertical_mixing since do3D is False" )
358
370
self .__dict__ ["vertical_mixing" ] = False
359
371
self .config_ptm ["vertical_mixing" ]["value" ] = False
360
- # self.vertical_mixing = False # this is recursive
361
372
362
373
# set z to None if seed_seafloor is True
363
374
if name == "seed_seafloor" and value :
@@ -414,9 +425,12 @@ def __setattr__(self, name: str, value) -> None:
414
425
):
415
426
# the behavior in calc_end_time changes depending on which variable has been updated
416
427
self .__dict__ ["end_time" ] = self .calc_end_time (name )
428
+ self .config_ptm ["end_time" ]["value" ] = self .calc_end_time (name )
417
429
# duration and steps are always updated now that start_time and end_time are set
418
430
self .__dict__ ["duration" ] = self .calc_duration ()
431
+ self .config_ptm ["duration" ]["value" ] = self .calc_duration ()
419
432
self .__dict__ ["steps" ] = self .calc_steps ()
433
+ self .config_ptm ["steps" ]["value" ] = self .calc_steps ()
420
434
421
435
if name == "ocean_model" and value not in _KNOWN_MODELS :
422
436
self .logger .info (f"ocean_model is not one of { _KNOWN_MODELS } ." )
0 commit comments