# COSIMA Hackathon - G1 training

**URL:** <https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195>\
**Category:** Workshops\
**Tags:** python, cosima, hackathon, github, git\
**Created:** [27 June 2024 06:47 UTC](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195 "2024-06-27T06:47:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dougiesquire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/dougiesquire/32/16_2.png) [@dougiesquire](https://forum.access-hive.org.au/u/dougiesquire)\
**Post date:** [27 June 2024 06:47 UTC](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195/1 "2024-06-27T06:47:08Z")

</div>

**This post contains the G1 training for 2024. For 2025 training, see [below](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195/3)**

# COSIMA hackathon v4.0 - G1 training

This is material to support training for the **G1** group at the [COSIMA hackathon v4.0](https://forum.access-hive.org.au/t/cosima-hackathon-v4-0-monday-july-1st-2024/2157), 1st July 2024.

It is aimed at people who are new to COSIMA recipes. After completing this training, users will be able to use and modify COSIMA recipe notebooks using the NCI Australian Research Environment (ARE).

# Prerequisites

Please make sure you’ve completed the steps in this [topic post](https://forum.access-hive.org.au/t/cosima-hackathon-v4-0-monday-july-1st-2024/2157/8?) prior to the hackathon.

# 1. Set up SSH keys for accessing Gadi and Github

First follow [these instructions on the ACCESS-Hive](https://access-hive.org.au/getting_started/first_steps/#automatic-login) to set up an SSH key to access Gadi from your local machine.

Now we’ll set up an SSH key to push/pull from Github from our local machine and use [SSH agent forwarding](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/using-ssh-agent-forwarding) to allow our local SSH keys to also be used on Gadi.

1. Follow the Github documentation to [generate a new SSH key for Github](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key) and [add the SSH key to the ssh-agent](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent).

2. Follow the Github documentation to [add the SSH key to your Github account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account#adding-a-new-ssh-key-to-your-account).

3. Follow the Github documentation to [test your SSH connection](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/testing-your-ssh-connection) from your local machine

4. Set up SSH forwarding from your local machine to Gadi. Using your favourite text editor, open `~/.ssh/config` and add the following line to the `gadi` host that you set up earlier:

5. Test that the SSH agent forwarding was successful:

# 2. Starting an ARE JupyterLab session

There are lots of existing resources on how to use the NCI Australian Research Environment (ARE). The [instructions on the ACCESS-Hive](https://access-hive.org.au/getting_started/are/) and the [NCI ARE User Guide](https://opus.nci.org.au/display/Help/ARE+User+Guide) include lots of useful information.

Steps:

1. Log in to [ARE](https://are.nci.org.au/) using your NCI username and password

2. Select the JupyterLab app and enter the following configuration settings (The fields marked with \* are found in “Advanced Options”):

3. Click the “Launch” button. You should see something like this:

# 3. Cloning COSIMA recipes

[COSIMA recipes](https://github.com/COSIMA/cosima-recipes) is a collection of Jupyter notebooks for analysing and plotting ocean model output. Most recipes make heavy use of the [COSIMA cookbook](https://github.com/COSIMA/cosima-cookbook) which is a Python package for searching and loading model output on Gadi. Note the COSIMA cookbook is now largely unsupported. ACCESS-NRI have built the ACCESS-NRI Intake catalog, which provides similar functionality to the COSIMA cookbook.

COSIMA recipes is a repository on Github. In order to use the recipe notebooks on the ARE we need to create a copy of COSIMA recipes on Gadi. In git terminology, this is called “cloning” the repository.

We’re going to do this from the terminal available in our ARE Jupyterlab session, but you could equally do it from your own terminal after SSHing into Gadi.

1. Go to your Jupyterlab window, click on the folder icon at the top left, click on the blue “+”, scroll down and click on the “Terminal” icon to open a terminal window:

2. From the terminal window, navigate to where you would like to clone the COSIMA recipes. E.g.:

3. Clone the COSIMA recipes Github repo:

# 4. Navigate to a recipe notebook and open it in JupyterLab

We’ll be running the `COSIMA_Cookbook_Tutorial.ipynb` notebook. Click on the folder icon at the top left of your JupyterLab session and user the interface to navigate to your clone of the COSIMA recipes.

Within the `Tutorials` directory, double click `COSIMA_Cookbook_Tutorial.ipynb` to open the notebook.

You can execute cells in the notebook using the arrow button in the control panel along the top of the notebook or using `<shift>+<enter>`

# 5. Self-led tutorials

That concludes the guided segment of the G1 training. For the afternoon of the Hackathon, it’s recommended that you either join a group working on an issue, or have a go at one of the following tutorials. We’ll be around to help with questions!

- [COSIMA workshop 2023 training](https://github.com/ACCESS-NRI/cosima-training-workshop-2023/tree/main): clone this repo in the same way as the COSIMA recipes and run the notebooks
- [Xarray in 45 mins tutorial](https://tutorial.xarray.dev/overview/xarray-in-45-min)
- [ACCESS-NRI Intake catalog quickstart tutorial](https://access-nri-intake-catalog.readthedocs.io/en/latest/usage/quickstart.html)
- [Git tutorial from Monash School of Mathematics](https://github.com/MonashMath/SCI1022/blob/master/Git.md)
- [Github’s introductory material for git and Github](https://docs.github.com/en/get-started/start-your-journey/about-github-and-git)
- [Xarray, GitHub, and many other tutorials from Project Pythia Foundations](https://foundations.projectpythia.org/landing-page.html): a community developed resource that contains several self-led tutorials, specifically for those in the climate and geo sciences
- Go through some other COSIMA recipes!

---

<div class="post-metadata">

**Author:** ![dougiesquire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/dougiesquire/32/16_2.png) [@dougiesquire](https://forum.access-hive.org.au/u/dougiesquire)\
**Post date:** [27 June 2024 06:48 UTC](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195/2 "2024-06-27T06:48:04Z")

</div>



---

<div class="post-metadata">

**Author:** ![dougiesquire](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/dougiesquire/32/16_2.png) [@dougiesquire](https://forum.access-hive.org.au/u/dougiesquire)\
**Post date:** [2 September 2025 07:39 UTC](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195/3 "2025-09-02T07:39:28Z")

</div>

# COSIMA hackathon v5.0 - G1 training

This is material to support training for the **G1** group at the [COSIMA hackathon v5.0](https://forum.access-hive.org.au/t/cosima-2-day-hackathon-v5-0-monday-sep-8-tuesday-sep-9-2025/4794), 8th Sept 2025. It is an update to the [G1 training from last year’s COSIMA hackathon](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195).

It is aimed at people who are new to COSIMA recipes. After completing this training, users will be able to use and modify COSIMA recipe notebooks using the NCI Australian Research Environment (ARE).

# Prerequisites

Please make sure you’ve completed the steps in this [topic post](https://forum.access-hive.org.au/t/cosima-2-day-hackathon-v5-0-monday-sep-8-tuesday-sep-9-2025/4794/6?) prior to the hackathon.

# 1. Logging in to the ARE

The [Australian Research Environment](https://are.nci.org.au) is a web-based graphical interface for performing your computational research on Gadi, provided by [NCI](https://nci.org.au). There are lots of existing resources on how to use the NCI ARE. The [instructions on the ACCESS-Hive](https://access-hive.org.au/getting_started/are/) and the [NCI ARE User Guide](https://opus.nci.org.au/display/Help/ARE+User+Guide) include lots of useful information.

In this training, we’ll use the ARE to run both terminal commands and a JupyterLab instance on Gadi nodes. The terminal commands run below could also be run from your own terminal after SSHing into Gadi.

To log in to the ARE, go to [https://are.nci.org.au/](https://are.nci.org.au/) and enter your NCI username and password.

# 2. Set up Github authentication

In order to interact with Github from Gadi we need to authenticate to Github. Last year, we [manually set up SSH keys](https://forum.access-hive.org.au/t/cosima-hackathon-g1-training/2195) to do this. This year we’ll use the Github command-line tool `gh` to greatly simplify the process.

Steps:

1. From your ARE dashboard, select the “Gadi Terminal” app. This will open a terminal with SSH connection to a Gadi login node.
2. In the terminal window enter:

```bash
$ module use /g/data/vk83/modules
$ module load gh
$ gh auth login

```

You will be prompted with a few questions. Answer as follows:

```bash
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Y
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: ABCD-1234
Press Enter to open github.com in your browser... 
! Failed opening a web browser at https://github.com/login/device
  exec: "xdg-open,x-www-browser,www-browser,wslview": executable file not found in $PATH
  Please try entering the URL in your browser manually
✓ Authentication complete.

```

As you can see, `gh` will fail to automatically open the web browser from Gadi so we’ll do this manually. In a new browser tab, go to [https://github.com/login/device](https://github.com/login/device) and follow the prompts. You will be asked for a verification code, which is printed to your terminal (e.g. `ABCD-1234` above). Then click “Authorize GitHub”.
3. That’s it. You do not need to do this again on Gadi.

# 3. Cloning COSIMA recipes

[COSIMA recipes](https://github.com/COSIMA/cosima-recipes) is a collection of Python notebooks for analysing and plotting ocean model output.

COSIMA recipes is a repository on Github. In order to use the recipe notebooks on the ARE we need to create a copy of COSIMA recipes on Gadi. In git terminology, this is called “cloning” the repository.

Steps:

1. From your ARE terminal window, navigate to where you would like to clone the COSIMA recipes. E.g.:

2. Clone the COSIMA recipes Github repo:

# 4. Starting an ARE JupyterLab session

JupyterLab is a web-based interactive development environment for Python, R and Julia notebooks. We’ll use JupyterLab to run and modify the COSIMA recipes Python notebooks.

Steps:

1. From your ARE dashboard, select the “JupyterLab” app and enter the following configuration settings (The fields marked with \* are found in “Advanced Options”):

2. Click the “Launch” button. You should see something like this:

# 5. Navigate to a recipe notebook and open it in JupyterLab

We’ll be running the `01-Loading-Slicing-Dicing-Output.ipynb` notebook. Click on the folder icon at the top left of your JupyterLab session and user the interface to navigate to your clone of the COSIMA recipes.

Within the `Cooking-Lessons-101-Tutorials/01-Basics` directory, double click `01-Loading-Slicing-Dicing-Output.ipynb` to open the notebook.

You can execute cells in the notebook using the arrow button in the control panel along the top of the notebook or using `<shift>+<enter>`

# 5. Self-led tutorials

That concludes the guided segment of the G1 training. For the rest of the Hackathon, it’s recommended that you either join a group working on an issue, or go through the following COSIMA recipes tutorials in the `Cooking-Lessons-101-Tutorials` directory. We’ll be around to help with questions!

1. `ACCESS-NRI_Intake_Catalog.ipynb`
2. `Making_Maps_with_Cartopy.ipynb`

You may also find these additional resources/tutorials useful:

- [Xarray in 45 mins tutorial](https://tutorial.xarray.dev/overview/xarray-in-45-min)
- [ACCESS-NRI workshop 2024 training on finding and analysing large data](https://github.com/ACCESS-NRI/training-day-2024-find-analyse-data)
- [ACCESS-NRI workshop 2024 training on advanced Git](https://github.com/ACCESS-NRI/training-day-2024-advanced_git)
- [COSIMA workshop 2023 training](https://github.com/ACCESS-NRI/cosima-training-workshop-2023/tree/main)
- [ACCESS-NRI Intake catalog quickstart tutorial](https://access-nri-intake-catalog.readthedocs.io/en/latest/usage/quickstart.html)
- [Git tutorial from Monash School of Mathematics](https://github.com/MonashMath/SCI1022/blob/master/Git.md)
- [Github’s introductory material for git and Github](https://docs.github.com/en/get-started/start-your-journey/about-github-and-git)
- [Xarray, GitHub, and many other tutorials from Project Pythia Foundations](https://foundations.projectpythia.org/landing-page.html): a community developed resource that contains several self-led tutorials, specifically for those in the climate and geo sciences
