Migrate experiment projects

Revision as of 23:18, 15 February 2022 by A.heerdegen (talk | contribs)

This page contains information on what to do if you want to change project to work at NCI.

Setting your default project

To change the default project that jobs get submitted to when you run 'qsub', edit the file on Gadi '~/.config/gadi-login.conf'

If you also run models from accessdev you can change the default project on that computer by editing the file '~/.rashrc'

In either case you will need to log out and back in again for the change to take effect

Climate model experiments

WRF does not have a standard experiment setup so we can't give specific instructions for this model. But the compilation script will work without modifications after the project merge.


Tips for other scripts

In your script, you may have used w35 or w48 in the following lines:

  • PBS directive -P to specify the project
  • PBS directive -l storage to load the storage space for these projects.
  • Full paths of input or output data

It is difficult to give a list of specific steps that would work for anyone. Below are a few tips that might help you.

It is important for you to make sure you know what changes you are doing, that's why we do not provide a magic sed one-liner command to change all the project IDs in all your files at once.

Find files with the project listed in

To find all the files that contain the mention of w35, you can use the following command:

grep --exclude=*.nc -irlI w35 <directory_name> > files_to_update.txt

files_to_update.txt will contain a list of files where w35 appear in at least one line. The command will not search in binary files and netCDF files and you can exclude more files from the search (e.g. figures) with the --exclude= option. Replace <directory_name> with the directory you want to search through.

At the opposite, if you only want to search through files with a specific extension, you could use --include=GLOB. Replace GLOB by the extension you want to search. For example the following command will search for w35 in all the Python Notebooks and only these:

grep --include=*.ipynb -irlI w35 <directory_name> > ipynb_to_update.txt


Backup before modifications

You will want to create some sort of backup of your text files before changing them. DO NOT create copies. We do not have heaps of free storage around to allow for it. Our recommended method is to use Git. If your files are not under the Git version control yet, here is a simple workflow that allows to record the state of your files before change. And some tips on comparing the modified and initial versions of the files.

Let's say, you want to change some files under a directory called my_scripts. You will first need to create a Git repository from that directory, record the current state of your files, do the changes you want to do, test the modified files work:

# Create repository. Go in your my_scripts directory
git init

# Record current state
git add .
git commit -m "State at time of merge"

# Change your files as you require, test the new files

If something does not work, you can then use the following commands depending on what you want to do:

# Difference between modified file and previous version
git diff <filename>

# Re-instate the previous version and delete the modified file
git checkout <filename>

Find all and replace all

All text file editors come with the ability to find all occurences of a pattern and to replace all these occurences. Make sure you know how to use this functionality, including reviewing the changes before making the change, for your favourite text editor.