opendrift icon indicating copy to clipboard operation
opendrift copied to clipboard

Add opendrift command line tool for doing a subset of simulations

Open gauteh opened this issue 4 years ago • 9 comments

  • opendrift.py: add opendrift command line
  • add opendrift.py to setup.py

@vegardb: Let's see if this happens.

gauteh avatar Oct 18 '21 09:10 gauteh

Interesting!

knutfrode avatar Oct 18 '21 09:10 knutfrode

This is the tool written by @vegardb for drifty. We have discussed moving it into opendrift for a while, which makes sense. If we constrain ourselves to supporting a limited set of features it should be feasible to make it generic.

gauteh avatar Oct 18 '21 09:10 gauteh

Nice!

Maybe replace set_config_override with some config file mechanism, though?

vegardb avatar Oct 18 '21 09:10 vegardb

Possibility to do opendrift.py -f <config_file.ini> would be nice.

knutfrode avatar Oct 18 '21 09:10 knutfrode

Yes, I think it should take a template file in yaml or toml, and let the command line override that so that you easily tweak a per-defined simulation. ini should work for the config values, but it has some limitations in data-types and ambiguity that are better specified in json/yaml/toml, which could possibly all be supported.

gauteh avatar Oct 18 '21 10:10 gauteh

Yes, I was more thinking of a config-file with both config-settings as well as other things like seeding, readers etc. And it could very well be e.g. yaml: opendrift.py -f <config_file.yml>

knutfrode avatar Oct 18 '21 10:10 knutfrode

Tests can be added with: https://click.palletsprojects.com/en/8.0.x/testing/, did not look like you already tested this way @vegardb ?

gauteh avatar Oct 18 '21 10:10 gauteh

No, no tests so far.

vegardb avatar Oct 18 '21 10:10 vegardb

I had earlier in mind that any OpenDrift module could be called the same way as this script, i.e.

>>> openoil.py <options>
>>> leeway.py <options>

I don't know whether that is feasible, or whether it is better than having a dedicated script opendrift.py as here.

knutfrode avatar Nov 05 '21 14:11 knutfrode