Skip to content

esm-tools/pycmor_workshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pycmor Workshop

Clone this repository to get access to the slides and practice problems:

$ git clone https://github.com/esm-tools/pycmor_workshop.git
$ cd pycmor_workshop
$ mkdir work

Make a folder to work in, for example:

$ cd work

During the live workshop, you'll be able to use the QOS --qos=training in DKRZ's HPC, to gain priority in the slurm queue. To benefit from this make sure you add this to your salloc or sbatch commands, or to the #SBATCH headers of the scripts.


Outline

1. Intro

  • Workshop intro - Slides, Video
    • Aims
    • Outline
  • Pycmor - Slides, Video
    • What is Pycmor?
    • Main Pycmor features
  • Demo: pycmor cli, Video
  • Time to resolve installation problems @pgierz
    • Have you installed Pycmor inside a conda environment named pycmor already?
    • Can you run pycmor --help and other commands?
    • Maybe you need to upgrade (pip install --upgrade py-cmor[dev,fesom])

2. Pycmor syntax

3. Features

3.1. Units (module_units and cmor_units)

3.2. Time span for output files (file_timespan)

3.3. Time averages

3.4. Adjusting time stamps of steps

3.5. Control computing resources

3.6. Pipelines and custom steps

3.7. Combining model output variables

3.8. PyFESOM

4. Try Pycmor with your data

5. Close the workshop


Install Pycmor

As the data to run the exercises lives on Levante,(DKRZ), we need to setup the Pycmor package on Levante.

The installation is done in 2 steps:

  1. Create a virtual environment
  2. Install Pycmor

Create a virtual environment

Note: the exercises assume you have a pycmor conda environment, so make sure when you create the environment that its name matches that.

module load python3
eval "$(conda shell.bash hook)"      # Init conda without the need to add extra lines to ~/.bashrc
conda create -n pycmor python=3.10    # Create a conda environment named pycmor

Install Pycmor

conda activate pycmor
pip install --isolated py-cmor[dev,fesom]

You can then check the Pycmor works by running:

pycmor --version
pycmor --help

For additional information, check out the following links

Pycmor workshop repository

The Pycmor workshop repository contains scripts to run the exercises.

work="/work/$(id -gn)/$USER"
echo "work directory: $work"
cd $work
git clone https://github.com/esm-tools/pycmor_workshop.git
cd pycmor_workshop

Get the example data

This workshop is designed for ease-of-use if you are working on DKRZ's Levante system. You can access all of the test data here:

/work/ab0995/a270243/pycmor_workshop/exercises/data

If you want to be able to see the files as part of your own repository, you can make a link

pwd  # You should be in the root of the repository (`/work/$PROJECT/$USER/pycmor_workshop`)
ln -sv /work/ab0995/a270243/pycmor_workshop/exercises/data ./exercises/data

Alternatively, if you would like to use synthetic data made up of random numbers, but with realistic metadata, dimensions, and attributes, you can generate some. Make sure you are in the same Python environment as pycmor is installed for this:

make fake-data
ln -sv ./fake-data ./exercises/data

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •