A ruby script to parse GrADS CTL files
Saji N. Hameed of the APEC Climate Center in Busan, Korea gave us permission to include his ruby script that parses a GrADs ctl file and generates NCL code to read in the data and create a COARDS compliant netcdf data object.
Saji provided us with his code and this information in an ncl-talk message:
This is a preview version and some essential features may not be implemented: for example currently there is only support for linear grids (I will add support for gaussian grids over the weekend or better if somebody chipped in and added those code, that will be nice too). Meanwhile I would appreciate feedback and reports on possible bugs/errors.
To use:
- Hopefully you have ruby installed in your system
- Visit the download page for Ctl2Ncl
to download the software. The latest and previous versions are available. A
version is also available here on the NCL website, but it may not be the latest one.
- Untar the tar file in somewhere like $HOME/bin
- Point the $PATH variable to this location.
For example, PATH=$PATH:$HOME/bin/Grad2NCL ; export PATH
OR
set path=($HOME/bin/Grad2NCL $path)
- After sourcing your .cshrc or .bashrc,
run ctl2ncl.rb and follow the instructions
- The help screen is shown below:
Usage: ctl2ncl.rb [options] A grads ctl parser and NCL script generator based on ruby Specific options: -i, --infile=CTLFILE the grads ctl file -o, --outfile=NCLFILE the NCL script file -v, --vars *NUM The variables --plot add code to display figures Common options: --help Show this message --version Show version