Seafloor height in new version of Opendrift #1387
Closed
brucelaughlin
started this conversation in
General
Replies: 1 comment
-
Apologies; "sea_surface_height" wasn't in my list of required variables previously. This fixed the problem. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I just cloned my project onto a new machine, where I have a fresh install of Opendrift. I believe that I am now working with a more modern version of Opendrift, and I am suddenly seeing the following error in my log files:
23:50:20 WARNING opendrift.models.basemodel:736: Seafloor check not being run because sea_surface_height is missing.
23:50:20 WARNING opendrift.models.basemodel:2134: The simulation stopped before requested end time was reached.
23:50:20 INFO opendrift.models.basemodel:2136: ========================
23:50:20 INFO opendrift.models.basemodel:2137: End of simulation:
23:50:20 INFO opendrift.models.basemodel:2138: recarray has no attribute sea_surface_height
23:50:20 INFO opendrift.models.basemodel:2139: Traceback (most recent call last):
File "/home/blaughli/.conda/envs/opendrift/lib/python3.11/site-packages/numpy/core/records.py", line 453, in getattribute
res = fielddict[attr][:2]
~~~~~~~~~^^^^^^
KeyError: 'sea_surface_height'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/blaughli/opendrift/opendrift/models/basemodel/init.py", line 2111, in run
self.update()
File "/home/blaughli/tracking_project/opendrift_custom/models/larvaldispersal_track_eco_variables.py", line 165, in update
self.vertical_mixing()
File "/home/blaughli/opendrift/opendrift/models/oceandrift.py", line 499, in vertical_mixing
Zmin = -1.*(self.environment.sea_floor_depth_below_sea_level + self.environment.sea_surface_height)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/blaughli/.conda/envs/opendrift/lib/python3.11/site-packages/numpy/core/records.py", line 455, in getattribute
raise AttributeError("recarray has no attribute %s" % attr) from e
AttributeError: recarray has no attribute sea_surface_height
The patch notes led me to try removing the following line from my custom model:
required_profiles_z_range = [0, -50]
which I initially replaced by adding the following line to init():
self._set_config_default('drift:profile_depth', 50)
But, this yielded its own errors. So, I removed the above line, and hoped that I could rely on default values, which are described in the patch notes ("All subclasses of OceanDrift now have sea_surface_height (default 0) as new parameter").
However, I haven't gotten rid of the "missing sea_surface_height" error. My ROMS files do contain "zeta", so I have tried adding it to "required_variables" in my model. Still, the error persists. 'zeta': 'sea_surface_height' is already in my custom reader; removing it does not change this error either.
I know I'm stabbing in the dark, but please advise, if you can! Thank you!
Cheers,
Bruce
Beta Was this translation helpful? Give feedback.
All reactions