Skip to content
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

Use tutorial: How to override configuration variables #88

Open
norlandrhagen opened this issue Jan 29, 2022 · 0 comments
Open

Use tutorial: How to override configuration variables #88

norlandrhagen opened this issue Jan 29, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@norlandrhagen
Copy link
Contributor

Intro

The cmip6_downscaling python package uses the donfig package for configuration. The config schema as well as defaults are laid out in config.py. These defaults can be overwritten by specifying a yaml file setting environment variables or using the config.set() method.

YAML configuration

Donfig allows yaml configuration files in three locations:

  1. The ~/.config/mypkg directory in the user’s home directory
  2. The {sys.prefix}/etc/mypkg directory local to Python
  3. The root directory (specified by the MYPKG_ROOT_CONFIG environment variable or /etc/mypkg/ by default)

In this example, we are using option #3.
Steps:

  1. Create the directory ~/.config/cmip6_downscaling/{choose_a_name}.yaml (ex. cloud.yaml)
  2. Populate the .yaml file. Note, the schema of the yaml file must reflect the schema of the config.py file.
    In this case, we are modifying the default values for storage.intermediate.uri
storage:
  intermediate: 
    uri: "az://flow-outputs/intermediate"
@norlandrhagen norlandrhagen added the documentation Improvements or additions to documentation label Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant