SAEON / somisana

SOMISANA-related tooling
MIT License
6 stars 2 forks source link

Copernicus environment variables not being read from .env file #38

Open GilesFearon opened 1 year ago

GilesFearon commented 1 year ago

I was having another go at downloading mercator data from the toolkit cli i.e. following the Algoa Bay operational model example in the toolkit docs, at step 3. I have COPERNICUS_PASSWORD and COPERNICUS_USERNAME defined in $SOMISANA_DIR/.env as provided in the docs. It only works if I export these manually in my shell environment (or add them to my .bashrc), but my understanding is that it should be read from the .env file.

By the way, I also tried defining these in the .env file in the toolkit dir in the source code (but same result). This actually got me wondering if we need these multiple .env files? They should probably be defined in the temp working dir to keep them out of the source code right?

zachsa commented 1 year ago

It should work in the .env file placed in the same directory as the __main__.py file.

There are two .env files:

  1. The env file for the toolkit
  2. A matlab .env file - the toolkit writes to this file, that is then read by matlab (https://github.com/SAEON/somisana/blob/stable/toolkit/cli/applications/ops/download/__init__.py#L38-L53)