Script Library

Here is an ever growing library of scripts developed myself for GrADS-aholic.  I figured it might be easier to just have a separate page with links to all the scripts readily available than to make you have to scroll through the scripts category on the main page and find them one at a time.

NARR PlotterMay 2013GUI to make maps and cross-sections with NARR dataDownload Here
NARR SoundingMay 2013Script for plotting skew-t diagrams with the NARR dataDownload Here
Set PareaMay 2013Simple way to set multiple plots on one pageDownload Here
Warn PlotMay 2013Plot current or archived weather hazards from shapefiles using the NOAA color codeDownload Here
ColorsetMay 2013Sets colors to match a number of common scales for RADAR and Satellite dataDownload Here
DynamicMay 2013Calculates advanced dynamic variables such as frontogenesisDownload Here
CheckeredMay 2013Draws a checkered border around your mapDownload Here
US_mapMay 2013Saves a map of the US with Alaska and Hawaii in the lower left cornerDownload Here
ThetaMay 2013Calculates Potential and Equivalent Potential TemperatureDownload Here
ScatterJuly 2013Uses GrADS to generate scatter plotsDownload Here
ConeJuly 2013Uses GrADS to Draw uncertainty cones around projected storm tracksDownload Here
NARR Plotter v2.2July 2013Updated Version of the NARR Plotter, includes capability to draw soundings and other upgrades/fixesDownload Here
Stat PackOctober 2013Library of basic statistical functions for user input "arrays"Download Here
Box PlotOctober 2013Use GrADS to plot boxplots form user-input "arrays"Download Here
Diamond BarJanuary 2014Use GrADS to draw colorbars using diamonds instead of rectanglesDownload Here
ColormapsMay 2014Use GrADS to create elegant color scalesDownload Here
Draw ShapesOctober 2014A simple GUI to draw shapes on your plotsDownload Here
Colormaps v2.0Dec 2015colormaps V 2.0Download Here


  1. hello
    I had difficulties with creation of correlation shifts. You couldn't help with creation of correlation shifts. shifts on time, width and longitude. initial materials ( to
    1) how to set time when averaging on days
    2) how to construct the schedule of correlation function

    1. Correlation shifts are likely tough with GrADS, you can easily do time/or spatial correlations by using the 'scorr' and 'tcorr' functions. But to shift them, you may need to alter the control files to do it right. For example: to do a time shift you would need to save your time-shifted data into a new file, and write a control file with the same time dimensions as your un-shifted data. So your time in the control file would not be correct, but it would make it easier for the 'tcorr' function to do the correlation. Basically you would trick GrADS into doing the time shifted correlation.

      Since you are using .nc files from ncep, you would need to subset the data with the 'fwrite' command to get your files set. Tutorial here:

      This may be something (especially with the spatial shifted correlation) that you want to use a different language to do. Another option, if you are using OpenGrADS would be to see if there are any UDFs that do this for you.

      Hope this helps!

    2. i want to make Gs to show the mean of temp for month of jan only for 10 years , please tell me how ??

  2. please I need a sript to do eof analysis in counting on your help.thanks.

  3. Hey can I get script or advise on the vertical temperature advection calculation in grads. TO be specific I am trying to calculate the adiabatic heating rate which involves derivative with pressure.

    1. I'm not 100% sure what equation you are looking for, but I presume is something in the ballpark of: omega*(d theta / dp). If you are trying to make maps with this, it will be pretty simple, just pick your level and do something like this:

      'd omega*(theta(z=1)-theta(z-1))/(p(z=1)-p(z-1))'

      or something like that. Your other (perhaps more attractive option) would be to use the 'cdiff' command to get it:

      This site actually uses temperature advection for an example, so you should certainly be able to adapt it for vertical temperature advection.

      Good Luck!

  4. Hi
    Please, help me to draw the graph Skew-t with data from NCEP / NCAR Reanalysis using Grads.

    1. I think the NCEP variables are the same as the NARR variables, so the script NARR Sounding (link is above on this page) should do the trick. Depending on how you are accessing the data, you might need to open multiple files:

      Hope that helps!

  5. please I need a script to do vertical variables analysis in grads. e.g. average temp between 1 - 50m, 51-200m etc... I'm new user grads.

  6. Hye there, I'm new user in grads and I really need your help. I have a sea ice extent data in a txt.file, so I want to convert the file to ctl or nc file so that I can open it in GrADs. I've been searching alot and still can't find the proper way to do. Can you please help me and I really appreciate it. TQ

    1. Hi, so how you go about creating an netCDF (or binary data file) depends on how your data is structured in your .txt file.

      First of all, you will need a higher level programming language to do this (I use Python, but I'm sure matlab will do the trick fine).

      As long as your .txt file contains data that is gridded on some lat/lon grid with all that information built in, this won't be too complicated, otherwise you will need to do some interpolation to turn it into a gridded dataset before you output to a file (or you could make a GrADS station file instead).

      If you use a netCDF file, I recommend including a control (.ctl) file with it and opening it in GrADS using 'xdfopen', this will free you from having to include all the right metadata within the netCDF file to make it compatible with the self-describing file specifications.

      One advantage to binary files is that if your data is not on a square grid (e.g., Its fit to a lambert map projection) you can feed GrADS that information from your control file.

      Unfortunately, this is not a super simple or straightforward task, and really the best way to go about it is case dependent. If you are interested, I can link you a couple of python scripts that I use that might help you get started.

  7. I want to assign values to a new vaiable such as- vapour pressure deficit, at different elevation, lat, lon on a specific date. And want to plot that on grads.

    I can plot variables fro existing grib2 files but I can not understand how to define a new variable with my defined values of it and plot that in GrADS.

    please help me if someone can.

  8. I want to assign values to a new vaiable such as- vapour pressure deficit, at different elevation, lat, lon on a specific date. And want to plot that on grads.

    I can plot variables fro existing grib2 files but I can not understand how to define a new variable with my defined values of it and plot that in GrADS.

    please help me if someone can.

  9. Hi, do you know if there is any function for calculating median rainfall in GrADS? it seems like it only have ave(), but not median...


  10. I would like to calculate using math expression of (to the power of) but I couldnt execute it yet. Ive tried this symbol "^" or"**" or this expression pow=math_pow(num, exponent). But all is failed. May you gimme some solution. thanks in advance

  11. how to open ncep file in GRAds?

  12. I need to top to obtain ighta horizontal cloud tpp field from a total water mixing ratio field from a wrf simulation of a convective storm. Can anybody help me to find a script? Thank you in advance.

  13. It came out unclear from the phone. I meant that I need aa script to calculate the cloud top height field from a wrf convective storm simulation. I have the 3D total water mixing ratio field ftom wrf output and arw post output and need a 2D cloud top height field. Thank you