-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise Error when readers are discarded #1325
Comments
For operational processing chains (e.g. search & rescue and oil drift) the priorities are different. Then you add several backup ocean and atmospheric models, and if one returns an error for whatever reason, the simulation shall continue by using a secondary reader for the same variables. If you want the simulation to stop when some variable (e.g. current) is missing, you should instead set the corresponding fallback value to None. In OpenOil and Leeway this is None by default, as running without currents does generally not produce a valid result: However, for the OceanDrift model fallback value of winds and currents is 0, as it might be of interest e.g. for sensitivity studies to run without either of these. Thus if you want to abort a simulation if current is missing, you should do:
If you are making your own module, you may also set the default fallback value to None in your class definition, such as shown for OpenOil above. Btw, if you updated your OpenDrift with |
Thanks, good to know that It's just something I came across while debugging. I seemed to circumvent the original problem by explicitly instantiating an xarray |
Yes, if you create the reader explicitly before adding it to OpenDrift (e.g. with reader_copernicusmarine), you should get the error message (and abort) immediately, and not possibly "masked" by the internal try-except. Btw: if you add |
This:
opendrift/opendrift/readers/reader_copernicusmarine.py
Line 30 in 572f1ba
opendrift/opendrift/models/basemodel/environment.py
Line 416 in 572f1ba
inside a try/except clause makes it only emit a warning and continue with missing data. I guess this should be part of the general error cleanup you mentioned the other day.
On a more general note, OpenDrift would (as far as I am concerned) be more restrictive about trying to continue - e.g. if one gets the projection wrong and hence the reader gets the domain wrong, OpenDrift will still continue with zero velocities (i.e. particles not moving). But I recognize that this is harder to handle (because relevant particles may be seeded later, or drift into the domain).
The text was updated successfully, but these errors were encountered: