Opened 8 years ago

Closed 8 years ago

#863 closed help (fixed)

accessing the $RUNID environment variable from a FAMOUS handedit

Reported by: ggjhtw Owned by: annette
Component: UM Model Keywords: handedit, FAMOUS
Cc: Platform:
UM Version: 4.5


Hi there

I'm a researcher at Bristol Uni running FAMOUS.

I'm using a handedit (~ggjhtw/scripts/optimum_params_v3 on PUMA) to change some of the parameters in the CNTLATM and CNTLOCN files. I need it to work generically (i.e. for an arbitrary RUNID). The previous incarnation of this handedit (optimum_params_v2) has the explicit RUNID included instead of $RUNID. The $RUNID environment works fine when inserted within the UMUI itself, for example in the specification of the location of the executable. Is there a way of getting the handedit to recognise this variable?

Many thanks

Jonny Williams

Change History (7)

comment:1 Changed 8 years ago by annette

  • Owner changed from um_support to annette
  • Status changed from new to assigned

Hi Jonny,

If you just want to edit the CNTLATM file for the current job I think you just need to replace these lines:

\cd $HOME/umui_jobs
\cd $RUNID

with this one:

cd $HOME/umui_jobs/$1

You'll notice that's how it is done in the rest of the script. If you're trying to do something different to that let me know.

Best wishes,

comment:2 Changed 8 years ago by ggjhtw

Hi Annette

Thanks very much for that. Are you able to give me any information on what the $1 parameter does exactly? I don't quite see how "$1==RUNID" if you see what I mean!

Many thanks!


comment:3 Changed 8 years ago by annette

Hi Jonny,

$1 means the first argument passed to the script, which in this case is equal to RUNID. The $n syntax is just a feature of shell scripting.


comment:4 Changed 8 years ago by ggjhtw

Hi Annette

Thanks again and sorry if I'm being dumb (it happens a lot) but where does the script get this RUNID argument from? I don't see how I would have known a priori where the $1 parameter's value was assigned.

Thank you


comment:5 Changed 8 years ago by annette

Hi Jonny,

When you click 'process' on a UMUI job, a bunch of scripts are run that take your UMUI settings and create all the namelists and submission scripts required to run your UM job.

Once this is done your hand-edit scripts are then run and these make extra changes to the submission scripts and namelists in ways you can't do with the UMUI. So your scripts are run from within another script with an argument variable $RUNID. So imagine the main process script looks something like this:

# Process script

# Set up namelists and submission scripts from UMUI 

# Run hand-edit scripts
~ggjhtw/scripts/optimum_params_v3 $RUNID

# etc ... 

This is just the way it works, so we know already that the first argument will always be $RUNID. Unfortunately this isn't obvious to a new user! FAMOUS is based on pretty old code and the UM scripts aren't easy to navigate. The only way to have found this out is from looking at other hand-edit code. Now you know how to make hand-edits you shouldn't need to worry about it too much though.

Does this help?


comment:6 Changed 8 years ago by ggjhtw

Does this help?

Yes, it does! Thanks a lot Annette, great.


comment:7 Changed 8 years ago by annette

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.