NumLab2013: Instructions for file format conversions

The MUSC output files are in so-called lfa format. To make some sense of this odd format,
  1. Use the programs available in the DDH toolbox, which is in the $utimusc directory, OR
  2. Convert the files to a more convenient format.
Here, only the second alternative is described.

From lfa to text files

In <$scrimusc>, there are two different scripts for converting the lfa files to text files:

  1. lfa2ascii_hourly.sh [or something like that] for hourly mean output
  2. lfa2ascii_inst.sh [or something like that] for output at individual time steps
Things that might need to be changed in lfa2ascii_hourly.sh>

  1. The expdir line, which gives the directory where your data are.
     However, you can also give the directory as a script argument, e.g.:
     lfa2ascii_hourly.sh $MU_OUT/AROM_60s_L41_basic 
  2. The list of hours ( for hh in 00 01 02 ... ). This appears twice in the script.

  3. The lists of multi-level and single-level fields ( for ch in ...), depending
     on what is in your MUSC output and what you want to analyze.
     To see what is in your MUSC output, you can use (e.g.) the lfaminm command, e.g.

     lfaminm Out.001.0000.lfa    

In lfa2ascii_inst.sh you may additionally need to change

  4. The list of decimal hours ( for mm in 0000 0167 ...) depending of the time step
     of your simulation. You might also want tho change this list if  you really don't 
     want text files for each single time step but only a subset of them.
Both scripts (but particularly lfa2ascii_inst.sh!) produce a lot of small files, many of them containing only a single value of a single variable. This is a cumbersome solution, but very flexible.

From text files to GrADS binaries

Separate scripts are available for hourly files (convert_to_grads_hourly.sh) and instantaneous time step output (convert_to_grads_inst.sh). In both, the things that you might need to change are right in the beginning:
   subdir=${1-AROM_60s_L41_Jokioinen}  [1]  
   firsttime="'00z04dec2012'"          [2]
   forecrange=48                       [3]
   timedelta=1                         [4]       
   nlev=41                             [5]

   [1] determines the directories where the text files are read from and where the 
       grads and  files are written to. See the definitions of datdir
       and gradsdir slightly further down in the script.
   [2] marks the the first output time, i.e. the beginning of the simulation.
   [3]-[4] The length of the simulation and the output interval are both given in hours in 
       convert_to_grads_hourly.sh but in minutes in convert_to_grads_inst.sh.
   [5] The number of model levels in the simulation.
Both of these scripts should produce 3 GrADS data files (output***.grads) and the corresponding 3 data descriptor files (output***.ctl), separately for NLEV-level, NLEV+1-level and single-level fields. These files will be located in the directory $MU_OUT/subdir.
Back to the NumLab2013 homepage.