Adding new output variables to 'outcfg.out'

As long as no post processing is requested, new output variables are put in the output variable/timesteps definition file'outcfg.out' in the same manner as in the non-climate mode. But if post processing is requested (i.e. strip_phy=1), the 'outcfg.out' file will be created automatically by the climate-mode model launching procedure. In that case, if you want to add your own output variables to the 'outcfg.out' file, you will have to modify the scripts that create it. This depends on what kind of variable you want to add (dynamics/physics, model/pressure level) and on the 'level' of diagnostics you requested.

There are essentially three 'levels' of diagnostics processing:
  1. No diagnostics (strip_phy=0, diagnos=0)
  2. Reorganisation of output into 2D and 3D variable files; interpolation of 3D model-level variables to pressure-levels (strip_phy=1, diagnos=0)
  3. Level 2) + produce monthly means, variances, time series for original variables + remove all files corresponding at higher sampling frequency than 1/12h , such as those valid at 6Z and 18Z (see diagnostics) (strip_phy=1, diagnos=1)
If you run your diagnostics on AIX and add a lot of variables the calculation of the 3D means and variances might suddenly take much longer than the rest of the diagnostics. And since the diagnostics are running on eight cpu's under AIX the cpu's calculating the 3D means and variances might still be running while others are long finished. In this case it might be better to use more cpu's to calculate 3D means and variances and less for the time series. How long each part of the diagnostics took can be seen by looking at the listings 'resultat_*' which can be found with the diagnostic files. The number of cpu's used for the different parts of the diagnostice can be set/changed with climat_diag_cpus.


      Level

variables
1.
strip_phy=0
diagnos=0
2.
strip_phy=1
diagnos=0
3.
strip_phy=1
diagnos=1
physic variables:
2D and 3D non accumulators kept on model levels
Add variables to your 'outcfg.out' Add variables to 'Climat_prepare_job'

As in Level 2)
+
add variables to 'Climat_mdpr_clean'
physic variables:
2D and 3D  accumulators kept on model levels
As in Level 2)
+
add variables to 'Climat_mdpr_clean'
+
add variables to
'Climat_diag_phy'
physic variables:
3D accumulators to be interpolated to pressure levels
Not possible, needs a call to Climat_strip_phy Add variables to 'Climat_prepare_job'
+
add variables to 'Climat_strip_phy'
physic variables:
3D non accumulators to be interpolated to pressure levels
As in Level 2)
+
add variables to 'Climat_mdpr_clean'
dynamic variables: Add variables to your 'outcfg.out' Add variables to 'Climat_prepare_job'



Adding variables to Climat_prepare_job

Get a copy of the script 'Climat_prepare_job' and put it in your ${HOME}/modeles/GEMCLIM/v_version/scripts.
Search for "Add new variables here !". This is where you add your new variables to one of the already existing 'sortie' statements or create a new 'sortie' between the 'echo "' and '" \  >> outcfg.out' statements. You should check the settings for grid, levels, and steps above this line and add new ones if you want. As of now, these settings are:

   grid=1,model;   in non-lam mode
   grid=1,core;      in lam mode

   levels=1, eta, -1;
   levels=2, pres, all pressure levels as defined in 'Climat_eta2preshyb';
   levels=3, eta, surface eta level;

   steps=1,hour,0.;
   steps=2,step,<first output step of current job,last output step of current job,inc. acc. to 'P_out_moyhr'>;


Adding variables to Climat_strip_phy

If you added new 3D physics variables and you want to have them interpolated on pressure levels, you have to add them to 'Climat_strip_phy'.
Get a copy of the script 'Climat_strip_phy' (if you don't have one already) and put it in your ${HOME}/modeles/GEMCLIM/v_version/scripts.
  1. Search for "Extracting the multi level physics fields from ${pm}". You will find there an 'editfst' statement extracting several fields with 'desire'. Add your variables to one of the 'desire's or add a new 'desire' (Note that the maximum line length per 'desire' or 'exclure' is 80 characters).
  2. Just a few lines below this you will find another 'editfst' statement excluding the same variables with 'exclure'. Add your variables there too.


Adding variables to Climat_diag_phy

If you added new accumulators and want them to be treated properly by the diagnostics, you have to add them to 'Climat_diag_phy'.
Get a copy of the script 'Climat_diag_phy' (if you don't have one already) and put it in your ${HOME}/modeles/GEMCLIM/v_version/scripts.

  1. Search for "Isoler les accumulateurs".... You will find there an 'editfst' statement extracting several fields with 'desire'. Add your variables to one of the 'desire's or add a new 'desire' (Note that the maximum line length per 'desire' or 'exclure' is 80 characters).
  2. Directly below this you will find another 'editfst' statement excluding almost the same variables with 'exclure'. Add your variables there too.


Adding variables to Climat_mdpr_clean

After the diagnostics have been produced  (means, variances, time series etc.) all files corresponding to higher sampling frequency than 1/12h,  such as those valid at 6Z and 18Z, are removed from the archives. The files are treated two by two: Each call to Climat_mdpr_clean 'removes' every second md- and pr-file, correctly accounting for variables that are accumulations, averages, minima or maxima. More than one call to this script may be required to reduce the final sampling interval to 12 hours. Hereby variables are treated differently depending on if they are on model (md-files) or pressure (pr-files) levels, and depending on if they are:
If you look into 'Climat_mdpr_clean' and search for "md-files" resp. "pr-files" you will find a list of all fields in the specific standard file.
    The first list contains all fields in the order in which they are in the file.
    The second list contains only fields with instantaneous values.
    The third list contains only fields with minimum/maximum values.
    The fourth list contains only fields with averages.
    The fifth list contains only fields with accumulators (only for md-files).

What makes the script a bit more difficult to modify is that we want this operation to preserve the order of fields in the final sample files. Therefore fields are only extracted together when they belong to the same list and follow each other with no "gaps" (field belonging to another list). So in the end there are several files containing one or more fields for each list. All fields have to be extracted except for the fields with instantaneous values of the file that will get "kicked out".

If you add new variables you will have to find out where in these lists your fields will be: Check the order of fields in a md- resp. pm-file before it goes though the diagnostics.

General structure of the 'Climat_mdpr_clean' script

Briefly, as a first step all files get extracted, then some calculations are done and finally all files will get joined up again to replace the file that will be kept. And now for a more detailed description...

1) Definition of a few second level variables and directories

2) Treating md-files (all variables on model levels)
       Extract fields from file that will be kicked out:
            Extracting accumulators
            Extracting averages
            Extracting min/max
        Extract fields from file that will be kept:
            Extracting instantaneous fields
            Extracting accumulators
            Extracting averages
            Extracting min/max
       Calculate min/max
       Add accumulators
       Calculate averages
        Joinup all fields

3) Treating pr-files (all variables on pressure levels)
       Extract fields from file that will be kicked out:
           high resolution (only if splitout or window are used)
               Extracting single fields
               Extracting fields containing averages
           whole gird and low resolution
               Extracting single fields
               Extracting fields containing averages
       Extract fields from file that will be kept:
           high resolution (only if splitout or window are used)
               Extracting single fields
               Extracting instantaneous fields
               Extracting fields containing averages
            whole gird and low resolution
               Extracting single fields
               Extracting instantaneous fields
               Extracting fields containing averages
       Calculate min / max
       Calculate averages
       Joinup all fields





Author: Katja Winger
Last update: May 2006