phenology / springtime

Spatiotemporal phenology research with interpretable models
https://springtime.readthedocs.io
Apache License 2.0
3 stars 2 forks source link

Support configuration in multiple ways #44

Closed Peter9192 closed 1 year ago

Peter9192 commented 1 year ago

Perhaps use hydra https://hydra.cc/docs/intro/

sverhoeven commented 1 year ago

Now not ideal, as config fields are used on import time. For example at https://github.com/phenology/springtime/blob/ce3bdfd250b3439fe18f78914291147aba0531a2/src/springtime/datasets/phenocam.py#L23

You need to change configuration before importing things that use config.

sverhoeven commented 1 year ago

Use https://pypi.org/project/xdg-base-dirs/ to get cache and config dir

sverhoeven commented 1 year ago
springtime --output-dir /tmp/outputdir --cache ~/.cache/springtime --config ~/.config/springtime <recipe>
# for example ~/.config/springtime/pep725_credentials.txt
sverhoeven commented 1 year ago

I would like to have several options for output location:

  1. output in specific folder
    • With --output-dir /tmp/myoutput so data.csv is written in /tmp/myoutput/data.csv`.
  2. output in current working directory.
    • With --output-dir . so data.csv is written in ./data.csv.
  3. output in sub directory like the current time of specific folder. for example /tmp/springtime-jobs/springtime-24072023T14:18:23/data.csv
    • can configure /tmp/springtime-jobs with --output-root-dir.

If --output-dir is absent then <output-root-dir>/springtime-24072023T14:18:23/data.csv If --output-root-dir is absent then it is ..