opendrift icon indicating copy to clipboard operation
opendrift copied to clipboard

Modify log statement?

Open kthyng opened this issue 1 year ago • 2 comments

Hi again. This is a small issue but I think I have investigated it multiple times unnecessarily so it would be nice to avoid in the future.

My understanding is that the code here: https://github.com/OpenDrift/opendrift/blob/668986480358eb55b211f80f1c27f2e4c17785f8/opendrift/models/basemodel/environment.py#L859-L860

checks the current set of variables for the presence of x_wind and if it isn't present, the log message is written. But, the first two times this code is called, the variables were:

variables
['land_binary_mask']

and then

variables
['sea_floor_depth_below_sea_level']

which caused the message to be written, but subsequently when the code was called that line wasn't written because x_wind was present in variables. Could the logic of that section be improved to know that while the wind isn't present in variables at the moment, it also shouldn't be? I am not sure what to suggest, not being very familiar with this section of code yet.

kthyng avatar Feb 19 '24 22:02 kthyng

Yes, this is a bit messy. As a temporary solution, I disabled that log message: https://github.com/OpenDrift/opendrift/pull/1236

and added a comment that that hardcoded calculation of stokesdrift from wind should instead be made using the newer feature of environment_mapping https://github.com/OpenDrift/opendrift/blob/master/opendrift/readers/basereader/variables.py#L492

We can keep this issue open until this migration has been implemented.

knutfrode avatar Feb 26 '24 23:02 knutfrode

Ok thank you.

kthyng avatar Feb 27 '24 17:02 kthyng