Faculty of Environment

MIDL

File Location:

The files for midl are located in:

/usr/local/midl

which is sym-linked at:

/apps/midl

Accessing the Software:

To  access the midl software, either use the 'app setup' command:

app setup midl

or, if you prefer, add the /usr/local/midl/bin directory to your path:

setenv PATH "/usr/local/midl/bin:${PATH}"

then, simply run:

midl

It is also possible to run the script directly:

/usr/local/midl/bin/midl

Creating a personal copy:

if you want to create a personal copy the files, so that they can be modified as necessary, there is a tar file, which should contain all the necessary bits and pieces at:

/usr/local/midl/src/midl.tar.gz

so, for example, if you wanted to add the midl files in your ${HOME}/idl directory, you could:

cd ~/idl

tar xzvf /usr/local/midl/src/midl.tar.gz

You would then have to modify the 'base_dir' setting in the file iu_misc/midlenv:

base_dir=${HOME}/idl

As well as this, you would also need to take a copy of the file /usr/local/midl/bin/midl, e.g:

cp /usr/local/midl/bin/midl ~/idl/

and alter the midlDir setting to point to ${HOME}/idl:

set midlDir="${HOME}/idl"

then you should be able to run:

~/idl/midl

and it will use the midl files within your home directory.

You could also, if it is preferable, move the ~/idl/midl script to a directory which is in your PATH, e.g. ~/bin/:

mv ~/idl/midl ~/bin/

note: This would require the ~/bin directory to exist, and to be in your PATH, e.g. by adding to your ~/.cshrc:

setenv PATH "${PATH}:${HOME}/bin"

Documentation:

There is a useful guide to using the Met Office IDL library here:

cms.ncas.ac.uk/index.php/analysis-and-visualisation/96-met-office-idl-library

An example of reading a UM .pp file using MIDL:

file='blah.pp'

headers=ppa(file,/all,/header)
stashlist,headers
;this outputs list of fields and stash codes as below (you often get each twice for some reason)
;   ATMOS    24 surface temperature after timestep
;   ATMOS    25 boundary layer depth after timestep
;   ATMOS    26 roughness length after timestep
;   ATMOS  1201 net down surface sw flux: sw ts only
;   ATMOS  1207 incoming sw rad flux (toa): all tss
;  BLAH BLAH
;   ATMOS 15202 v wind on pressure levels b grid
;   ATMOS 15242 w compnt (of wind) on pressure levs
;   ATMOS 16202 geopotential height on p lev/p grid
;   ATMOS 16203 temperature on p lev/p grid
;   ATMOS 16222 pressure at mean sea level

sc=16202 ;geopotential height on p lev/p grid
stashind=where(headers.lbuser(3) eq sc)
data=ppa(file, stashind)  

Note that much of the .pp data is read into IDL structures. Some of the timing info is quite complex, see documentation of the format of header record:

Format_of_header_record_for_pp-fields.pdf