Skip to content

nicojourdain/misomip2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

misomip2

A python package to process model outputs to standard MISOMIP2 format and to analyse MISOMIP2 multi-model outputs.

This package is written for python3 and largely based on xarray and scipy.interpolate.

This package contains:

  • preproc : contains functions used to pre-process model outputs, i.e. to interpolate them to the MISOMIP2 grids and write files with standard attributes (More details here).
  • examples : contains scripts that can be used on provided test cases (e.g. to check that your python environment works) and that can be adapted to your specific output files.
  • analysis : (TO BE COMPLETED) contains functions used to analyse multiple model outputs that were previously interpolated to the common grids (More details here).

Contributors

  • Nicolas C. Jourdain (IGE, CNRS-UGA, Grenoble, France)
  • Jan De Rydt (University Northumbria Newcastle, UK)
  • Yoshihiro Nakayama (Hokkaido University, Japan)
  • Ole Richter (Alfred Wegener Institute, Germany)

All MISOMIP participants who want to contribute to this package are invited to fork this github repo and make a pull request as documented here.

Install

If you don't have a python environment yet, you can install anaconda following this page.

If these modules are not installed (check with conda list), install them:

conda install numpy xarray scipy
conda install dask pyproj
conda install -c conda-forge gsw 
# or conda install -c conda-forge/label/gcc7 gsw 
# or conda install -c conda-forge/label/cf201901 gsw 
# or conda install -c conda-forge/label/cf202003 gsw

Then, clone the misomip2 package :

git clone https://github.com/nicojourdain/misomip2.git
# or git clone git@github.com:nicojourdain/misomip2.git

You can update the cloned directory anytime with git pull executed in that directory.




Examples of ocean interpolation to the MISOMIP2 grids

We provide a few test cases so that users can check that this package works well in their python environment before adapting it to their model outputs. These test cases are also used by the developers of this package to check that it is working with various types of model.

For simplicity, we describe the example directly used in the misomip2 repositories, but the interpolation script can be run from anywhere.

cd misomip2/examples
vi interpolate_to_common_grid_oce.py # or using any other text editor than vi

The first thing to change in this file is the directory in which the misomip2 package has been cloned, i.e. change this path:

sys.path.append("/Users/jourdain/MY_PACKAGES")

The second thing is to choose the test case you want to run by uncommenting one of these lines:

test_case='NEMO_test'
#test_case='MITGCM_test'
#test_case='ROMS_test'
#test_case='eORCA025_test'

We recommend starting with 'NEMO_test' which is the smallest in size and fastest to run.

To make it work, you need to download the input files for the tes cases, which are all provided on DOI. You can get the files directly using wget as:

cd test_cases/oce
wget https://zenodo.org/record/4709851/files/NEMO_test.zip
unzip NEMO_test.zip && rm NEMO_test.zip

Other test cases can be downloaded as follows (note the file sizes):

# MITGCM_test (242M):
wget https://zenodo.org/record/4709851/files/MITGCM_test.zip
unzip MITGCM_test.zip && rm MITGCM_test.zip
# eORCA025_test (7.8G):
wget https://zenodo.org/record/4709851/files/eORCA025_test.zip
unzip eORCA025_test.zip && rm eORCA025_test.zip
# ROMS_test (257M):
wget https://zenodo.org/record/4709851/files/ROMS_test.zip
unzip ROMS_test.zip && rm ROMS_test.zip

Then, execute the script as follows:

python interpolate_to_common_grid_oce.py

This should create the following files:

  • Oce3d_NEMO3.6-IGE-CNRS-UGA_a_Ocean-A1_201001-201002.nc
  • OceSec_NEMO3.6-IGE-CNRS-UGA_a_Ocean-A1_201001-201002.nc
  • OceMoor_NEMO3.6-IGE-CNRS-UGA_a_Ocean-A1_201001-201002.nc

On a laptop (16Gb, 2GHz), the test cases took the following durations:

  • NEMO_test : 48s (smaller than MISOMIP2 domain; all variables calculated).
  • MITGCM_test : 3min 30s (smaller than MISOMIP2 domain; no sea-ice or surface fluxes).
  • eORCA025_test : 2min 30s (global simulation; most variables calculated).
  • ROMS_test : 6min 20s (circum-Antarctic simulation (sigma coordinates); no sea-ice or surface fluxes).

Adapt to your own ocean configuration

You can copy interpolate_to_common_grid_oce.py and adapt it to your model. You need to adapt at least section 0 (General information), section 1 (Files and variables) and section 2 (Global attributes of output netcdf). For section 1, you may need to create or modify a load_oce_mod_xxxx.py function similar to the one existing for NEMO, MITgcm and ROMS if your model is not covered yet. If your model is already covered but variable names differ from what is understood by load_oce_mod_xxxx.py, just add options for these variables in load_oce_mod_xxxx.py and make a pull request to upload it onto the official misomip2 repository (so that you keep this in case of updates).

Performance of ocean interpolation

The scripts were written in best effort by non-experts in a way that should work for various grids, and suggestions that may boost perfromances are welcome. We nonetheless found that the computing times were acceptable for several example of simulations, the idea being that the higher the original model resolutoin, the shorter the period to be computed in a single call of interpolate_to_common_grid_oce.py. Here are some example of computing time:

  • Processing the "NEMO-AMUXL025" data (231x190x75 points, reduced to 203x107x75 when "loading nemo") on a 2.6 GHz computer required ~10 minutes and ~2.5Gb of memory per year of simulation (tests up to 10 years in a single call of interpolate_to_common_grid_oce.py show that both walltime and memory increase linearly).

  • Processing the "NEMO-AMUXL12" data (687x567x75 points, reduced to 623x286x75 when "loading nemo") on a 2.6 GHz computer required 1h22 minutes and a bit less than 16Gb of memory per year of simulation.




Ice test cases

To be completed

About

A python package to postprocess model outputs to standard MISOMIP2 format and to analyse MISOMIP2 multi-model outputs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages