Srend Manual

Srend Quick Start: Python cotab editor for Grads .ctl data

Here is a screenshot of ctl.py running.

image of python Tk screenshot for .ctl

The code is in the sources directory under "python". As usual for all examples, these codes are not for illustrating a certain ideal programming style, but how one can use Srend.


Instructions
0. Set definition in Srend.F90 like this:
   ...
   ! ---- color table: --------------------------------------------------
   ! Uncomment exactly one of these:
   #define SREND_COTAB_FILENAME 'cotab.txt'
   !#define SREND_COTAB_PASSNAMELIST
...

1. compile Srend to a shared library
   gfortran Srend.F90 -O3 -DSREND_NOMPI 
                          -DSREND_COTAB_EACH_PASS 
                          -DSREND_COTAB_FILENAME="'cotab.txt'" 
                          -fPIC -shared -o Srend.so
   names: nm  Srend.so   (callable subroutines are "T" entries)
   "Srend.so" shuld be in the working directory with this
   file "ctl.py".

2. ctl.py opens Grads format data which comes as two files:
     header:  data.ctl
     data  :  data.dat
   CM1 Grads output emits these, and this is an easy format to create in simulation
   code where the data is available.  There are many more utilities
   available to convert Grads to something else than something
   else to Grads.  But, again, this is an easy format to code, and
   this tk GUI doesn't need to read much of the header.
   
3. The Python libraries needed below might already be installed.  
   On Linux, tkinter is the one most likely missing beyond a plain
   Python 2.7 install.
   
4. Make sure that ctl.py is executable.  In the working directory,
   with ctl.py, this command will ensure this: chmod 755 ctl.py
   
5. Select .ctl, scan .ctl, process data, and open or write a cotab
   file in the editor before rendering.  Most of the open entry boxes
   can be edited to do something.  (Exception: The "XYZ raw data" boxes 
   are filled in during a .B_get_ctl file scan.)  Edit the scaling function
   to change how the raw 32-bit floating point data (x) is scaled to
   bytes in [0,255].  Edit the RGB and alpha color table entries in The
   editor; the contents of the editor are used for rendering, saved to
   "cotab.txt" then opened by srend_render().  A sample cotab file
   is "cotabedit.txt" which is created on startup if it doesn't
   already exist.