Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Modifying CESM2 case Python wrappers to accept shell environment variables

I am attempting to centralize a version of CESM2 on our local cluster so that individual users do not have to download their own copy of the model and instead we can have just one group version of the model. The obstacle that I am facing is how the Python wrappers in charge of setting case/output directories appear to ignore shell environment variables. So for example, in each user's bash shell, they have a 'CUSER' environment variable which is unique to each user (mine is CUSER = 'cmaloney').

In the 'config_machines.xml' file, where the various case directory are defined, I want make the paths look something like this:

<CIME_OUTPUT_ROOT>/scratch/project/central/$CUSER/CESM_runs<CIME_OUTPUT_ROOT>

However, when I set the path like shown above and build a case, CESM creates a directory called '$CUSER' in "scratch/project/central". Obviously this is problematic. For now I have the path looking like this:

<CIME_OUTPUT_ROOT>/scratch/project/central/cmaloney/CESM_runs<CIME_OUTPUT_ROOT>

where "cmaloney" is my personal directory on "/scratch/project/central". While this works for me, it won't work for other group members unless they download their own version of the model and change the 'cmaloney' portion of the path to their respective directory name. I'd like to work around this.

So my question is: Has anyone had any experience addressing this Python issue in CESM2? I am having difficulty locating which Python script that I need to modify to accept the environment variables. I will greatly appreciate any suggestions.

Thanks,
Chris
 

erik

Erik Kluzek
CSEG and Liaisons
Staff member
Hmmm. I actually thought that this would work. XML variables are expanded with syntax like that in the system. We do have expansions that are specific to environment variables that look like this though "$ENV{CUSER}". So you might need to use that sort of thing. Note that cases also have both REALUSER and USER xml variables and perhaps you could use one of them?

CIME_OUTPUT_ROOT is set for each machine in the file: config/cesm/machines/config_machines.xml

I'm not sure if you are using that file to define your machine or the user specific one? I imagine since you are trying to get a centralized setup you are working with the above file however.

So hopefully that helps.
 
Top