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 precedure. 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 request.

There are essentially four '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)
  4. Level 3) + monthly means and zonal averages of your newly added variables on pressure levels (strip_phy=1, diagnos=1)


      Level

variables
1.
strip_phy=0
diagnos=0
2.
strip_phy=1
diagnos=0
3.
strip_phy=1
diagnos=1
4.
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'
As in Level 3)
+
add 3D variables to NOMVAR variable definition  in Climat_lancer_diag
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/GEMDM/v_version/scripts.
Search for "Add new varibles 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,<start of current job,end of current job,6 hours>;


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/GEMDM/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/GEMDM/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_lancer_diag

If you added new 3D variables and you want to have their mean and variance calculated by the diagnostics you have to add them to 'Climat_lancer_diag'.
Get a copy of the script 'Climat_lancer_diag' (if you don't have one already) and put it in your ${HOME}/modeles/GEMDM/v_version/scripts.

Search for "Creating variable lists". Just below this line the variable 'NOMVAR' gets defined. Simply add your variables to this list of variables.
If you are running your diagnostics not on an multi-node AIX computer this is all you have to do. But, if you do run your diagnostics on AIX and add a lot of variables to this list 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 on 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.


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 fieldsin the specific standard file.
    The first listcontains all fields in the correct order.
    The second listcontains only fields with instantaneousvalues.
    The third listcontains only fields with minimum/maximumvalues.
    The fourth listcontains only fields with accumulators(md-files) resp. averages(pr-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

First 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.

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 single fields
            Extracting accumulators
       Extract fields from file that will be kept:
            Extracting single fields
            Extracting instantaneous fields
            Extracting accumulators
       Calculate min / max
       Add accumulators
       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
           otherwise other resolutions
               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
            otherwise other resolutions
               Extracting single fields
               Extracting instantaneous fields
               Extracting fields containing averages
       Calculate min / max
       Add accumulators
       Joinup all fields





Author: Katja Winger
Last update: September 22, 2004