OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
231 stars 113 forks source link

Modify log statement? #1233

Open kthyng opened 4 months ago

kthyng commented 4 months ago

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.

knutfrode commented 4 months ago

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.

kthyng commented 4 months ago

Ok thank you.