Difference between revisions of "SCM with ERA-Interim"

Line 99: Line 99:
I just copied it from Greg:
I just copied it from Greg:
<syntaxhighlight lang=text>
$ mkdir -p cd /short/$PROJECT/$USER/SCM/Data
$ mkdir -p cd /short/$PROJECT/$USER/SCM/Data
$ cd /short/$PROJECT/$USER/SCM/Data
$ cd /short/$PROJECT/$USER/SCM/Data

Latest revision as of 23:58, 11 December 2019

Single Column Model with ERA-Interim

This is a work in progress. I am using this page to keep notes on what I do to get SCM running. I will later rewrite this page into something coherent on how to run the SCM.

Compiling the SCM

The SCM is compiled on raijin without using the UMUI.

$ cd /short/$PROJECT/$USER
$ mkdir SCM
$ cd SCM
$ tar xvzf ~access/AccessModelExperimentLibrary/scm_access13/scm_access13_standalone.tgz
$ cd scm_access13_standalone
$ module load intel-fc intel-cc netcdf
$ make -f Makefile.scm

Generating the Namelist

If you are running SCM on raijin, you can use a python script which the CMS team has created to ERA-Interim data into the SCM namelist. You can get it from github:

$ cd /short/$PROJECT/$USER
$ git clone https://github.com/coecms/era_genesis.git

This will create a new subdirectory era_genesis where it will place the scripts and two default input namelists: template.scm}}, which looks just like the final Template:Namelist.scm, and {{base.inp, from which for example the height dimension is read. You are free, and even encouraged, to supply your own namelists, or to modify them as needed.

Before you can run the script, you first need to load a few modules:

$ module use ~access/modules
$ module load python pythonlib/netCDF4 pythonlib/f90nml

The actual script is called era_genesis.py, and to run it, there are some parameters that you have to, or may, give.

$ ./era_genesis.py -h
usage: era_genesis.py [-h] [-X LON] [-Y LAT] [-S START_DATE] [-E END_DATE]
                      [-N NUM] [-b FILE] [-t FILE] [-o FILE] [-s SURFACE_TYPE]
                      [-d] [-T]

Cleans up the template file

optional arguments:
  -h, --help            show this help message and exit
  -X LON, --lon LON     longitude
  -Y LAT, --lat LAT     latitude
  -S START_DATE, --start-date START_DATE
                        start date: YYYYMMDD[HHMM]
  -E END_DATE, --end-date END_DATE
                        end date: YYYYMMDD[HHMM]
  -N NUM, --num NUM     number of times
  -b FILE, --base FILE  Base Namelist
  -t FILE, --template FILE
                        Namelist Template
  -o FILE, --output FILE
                        Output Namelist
  -s SURFACE_TYPE, --surface_type SURFACE_TYPE
                        Surface Type: land, sea, or coast
  -d, --debug           Debug
  -T, --test            run doctest on this module

The most important ones are -X}} and Template:-Y, giving the longitude and latitude of the location, respectively. Without both of them, the script will not run. You can set a start date, if you don't, it will take the one that is given in the {{base.inp namelist. The end date is chosen with these priorities:

  1. Parameter given with the -E option, if present.
  2. (NUM}}-1) * 6h after start date, if {{-N present.
  3. end date from the base.inp file.

-b}}, Template:-t, and Template:-o default to Template:Base.inp, Template:Template.scm, and {{namelist.scm respectively. -d makes the script produce considerably more output. -T is just for testing purposes.

If -s}} is not given, the script will try to determine whether a land, sea, or coast environment is selected by evaluating Template:Template.scm, specifically the values of {{cntlscm -> land_points}}, {{logic -> land_sea_mask}}, {{logic -> soil_mask}}, and {{rundata -> fland_ctile. If the type of surrounding grid points is at odds with the selected or determined surface type (i.e. surface type sea is selected, but all surrounding points are land), the script will give a warning or even fail.

If all of this went well, you can jump from here right to Running SCM.

Compile Genesis

Note: On raijin, the old genesis is no longer required to convert ERA-Interim data into the namelist that SCM needs. Use era_genesis instead.

$ cd /short/$PROJECT/$USER
$ git clone https://github.com/coecms/genesis
$ cd genesis/src
$ module load intel-fc intel-cc netcdf
$ make -f Makefile.raijin genesis

Acquiring the Data

I just copied it from Greg:

$ mkdir -p cd /short/$PROJECT/$USER/SCM/Data
$ cd /short/$PROJECT/$USER/SCM/Data
$ cp /short/public/forGreg/era-i/*.nc .

Convert the Data

Rotate field

Greg used xconv and trans to convert.

I try this: File:rotate_hemispheres.sh

Output of Greg's history

  • XCONV V1.92 16-February-2006

> Transpose grid, rename lat and lon. > Done

  • ncks -O -d initial_time0_hours,0,33 -d latitude,0,60 -d longitude,0,30 tQ_6hrs_pl_2014_01.nc stQ_6hrs_pl_2014_01.nc

> Select a smaller grid. > Done

  • cdo invertlev stQ_6hrs_pl_2014_01.nc istQ_6hrs_pl_2014_01.nc

> Invert Levels > Done

  • ncap -O -s initial_time0_hours=(float(initial_time0_hours)-1875888)/24. /short/p66/glr548/genesis/run_from_era_interim/istQ_6hrs_pl_2014_01.nc adum2.nc

> Transpose time > Not done

  • ncrename -O -d lv_ISBL1,p -v lv_ISBL1,p -d initial_time0_hours,t -v initial_time0_hours,t -v Q_GDS0_ISBL,q adum3.nc adum4.nc

> Rename:

    • level -> p
    • time -> t
    • var -> q
  • ncap -O -s q=float(q) adum4.nc adum4aB.nc

> Make q into a float. It is already a float.

  • ncap -O -s p=float(p); t=float(t) adum4.nc adum4a.nc

> Make p and t floats. They are already floats.

  • ncks -A -x adum4a.nc adum5.nc

> Copy global attributes

  • ncks -A -v longitude adum4a.nc adum5.nc

> Copy longitude

  • ncks -A -v latitude adum4a.nc adum5.nc

> Copy latitude

  • ncks -A -v p adum4a.nc adum5.nc

> Copy pressure level

  • ncks -A -v t adum4a.nc adum5.nc

> Copy time

  • ncks -A -v q adum4a.nc adum5.nc

> Copy var

Running SCM

Copy some auxillary data

$ cp ~access/AccessModelExperimentLibrary/scm_access13/* .

Make changes to runscm (pointing at correct scm.exe), and dir_name (pointing at the current directory)

Run the SCM

$ runscm

Data Output

$ scm2nc cable_test.dat cable_test.nc