About GrADS-aholic!

Hello!  I am starting this blog because throughout my undergraduate and graduate career in meteorology and atmospheric science, I have developed a hearty knowledge of the free Grid Analysis Display System (or GrADS) software package.  Most of my skills come from trial and error, as well as what I like to call "precision Googling."  After acquiring the lot of my skills, I feel as if I have something to contribute in this area.  In a nutshell, this blog is basically my attempt to provide everyone with a lot of tools and tips that I wish I had while I was learning/using GrADS.  I welcome feedback and questions related to this blog, and GrADS in general.

Update (2017): If you frequent the site you have probably noticed that I have not added any new scripts or tutorials in over a year.  Unfortunately, I have not had enough time to sit down and thoroughly construct and test any new features and functions... And honestly, I've been doing most of my recent work in python.  That said, I do still have several scripts and tutorials that I want to publish on this blog this upcoming year.... so stay tuned as they say. 

Lets start with the basics, below is a list of advantages and disadvantages to using the software.

Advantages
  • Free/Easy to install
  • Works well on Windows
  •  Easy to learn scripting/good introduction into computer programming
  • Quick and easy access to real time and reanalysis weather data through interface
  •  Compatible with shapefiles
  • Possible to develop GUI interface using scripting Language
  • KML/PNG/JPG/GIF/TXT/DAT file output
  • Large library of scripts available online
  • Does not use a ton of memory
  • Models such as WRF and the Bryan Cloud Model (CM1) include GrADS output options
Disadvantages
  • Not as powerful as other plotting software (e.g., Python, NCL)
  • In my opinion, GrADS produces relatively low quality images (compared to Matlab,Python, etc)
  • Can only handle gridded and station data files (Grib/NETCDF) with appropriate control file
  • Cannot perform high level data functions such as EOF analysis
  • Cannot easily plot "Generic vertical cross sections" (that is anything other than East/West or North/South)
It is because of the disadvantages that GrADS seems to becoming less and less preferred to other plotting languages, but it is still a very useful tool.  If you are still wondering if GrADS is right for you, I included a few example images made with GrADS to give you an idea of what GrADS can be used for.

Visible Satellite Data and Counties
Surface weather map from the NAM model

NARR Reanalysis Precipitable Water


So, now that you have an idea of what to expect with GrADS, I will provide a few links and some basic info so you can get started.  Now, I presume if you are here you probably have GrADS installed on your computer and you probably are just looking for a few scripts to help you make some bad-ass weather plots.  I mean, I highly doubt you just stumbled across this in your spare time and decided to get started with GrADS based on the information in this post, but just in case you did here is a paragraph describing how to install the software.

So the first thing you will want to do is get the GrADS software installed on your computer.  As I recall, installing the software was as easy as going to This Website and downloading the version you want, untarring/unzipping the folder and installing it.  Note, if you are using windows you will need Cygwin installed, however, I believe it comes as part of the GrADS package available for windows, so this should be fairly straight forward.  The installation comes with a bunch of different executable files (all listed on the website), I have personally never used anything other than the basic "grads" executable.

In windows you can open the GrADS interface by double-clicking the executable file (linux just typing "grads" into your console should do the trick).  GrADS first opens a command shell and prompts you to choose "landscape" or "portrait" for your image dimensions (the default is landscape).  Once you make your choice, a second window will open up.  This window will be where your data is plotted.  So basically, you have a command console to enter commands, and a display console where your data will be plotted.  Once you have these windows up, all that's left is to learn the commands!

Now instead on going through a detailed instruction on how to use commands in GrADS, I am going to go ahead and point anyone new to GrADS to This Tutorial to help get you started.  This is just because I don't want to repeat a ton of information, and I feel like going through the basics might be a little redundant.  Anyway, once you have gone through the tutorial and have a basic idea of the different functions you can use with GrADS, I encourage you to come back here and browse the different scripts/tutorials I have on this blog.

All ad revenue generated from this site (while comically minuscule) will be donated to the Association for Women in Science and National Public Radio.

So I think that's it for the introduction, I hope you found this page useful, check back often for newly added scripts, and tutorials!

29 comments:

  1. Awesome stuff dude! I am just starting out in the world of GrADS(plus a few others) and I am really liking your site. It's great that you take out your own time to do this, it's very much appreciated! Anyways...I shall get back to it!
    Cheers again!

    Lee

    ReplyDelete
  2. I am glad that you find this site useful, feel free to ask questions regarding certain tutorials or scripts, I would be happy to help explain things a little better!

    Best of luck!
    -Ted

    ReplyDelete
  3. Hi, I wanted some help actually but am a bit shy to ask. I know I will be wasting your time and should learn myself! But if you are up to giving me some scripting help perhaps we could talk via email?
    Lee

    ReplyDelete
  4. Hello!! Excellent initiative. I have started a blog (in Portuguese) for similar reasons. Congratulations.

    http://prestrelocristiano.blogspot.com.br/

    ReplyDelete
  5. Hi this is Mike Fiorino -- quite a site!

    have a few comments:

    there are two versions of grads:

    1) iges/cola (grads.iges.org)

    2) opengrads (opengrads.org)

    * same as iges/cola except for hooks for user defined
    functions/commands and interface to python

    * implemented by Arlindo DaSilva (mostly) and myself

    Disadvantages -- not really...mostly perception...

    * python is NOT a plotting language per se, I use matplotlib)

    * the python interface allows access to matplotlib so if you really need
    a super-duper quality graphic you could pass grads data objects to
    matplotlib

    * gridded data only? I use python to generate 'station data' sets for
    plotting. station data in a .nc form is not easily handled, but grads
    is the only graphics package that handles *directly* the international
    standard for station data - BUFR

    * the whole point of opengrads is to interface the grads data engine to
    python,perl,php...and external functions. Arlindo has implemented an EOF function in opengrads

    * I've written grads-gue scripts to do generic cross sections.

    how do you know that 'GrADS seems to becoming less and less perferred to other...?'

    I continue to be amazed at how universal GrADS has become, at least in
    my field (meterorology).

    keep up the good work!

    Best /R Mike

    ReplyDelete
  6. Thanks for the comments Mike! I really enjoy your GrADS functions! I have not used opengrads nearly as much as GrADS, which might be why I am mistaken about the EOF capabilities.

    A sample of people I have talked to have indicated they have transitioned from using GrADS to matlab or python for most of their analysis, so while I certainly cannot speak to the general state of GrADS use, in my experience it seems to be less preferred than it may have been at one time.

    Thanks again for the feedback, I really appreciate your input!

    -Ted

    ReplyDelete
  7. Awesome blog you have going here. Just getting started with GrADS on a mac and am having trouble with installation. I have downloaded the GrADS file as suggested above and have also untarred it. What commands should i type into terminal in order to install GrADS? Thanks so much for any help!

    ReplyDelete
  8. I have unfortunately have had many issues trying to get GrADS installed on my new macbook. If you google "install grads on mac" you can find some documentation, though they all appear to be focused on specific operating systems. If you have fink, you might be able to get it working using fink. Though, I do not know, I have yet to get it to work.

    Good luck!

    ReplyDelete
    Replies
    1. Actually got it working. Thanks for the fast reply, I really appreciated it! Any thoughts on what to code in order to upload a blank map of the U.S as a background image(most likely an easy task, still a beginner at this). Thanks again!

      Delete
  9. Hey could you please help me with this..
    I have two files combined-precipitation-data.ctl and combined-evaporation-data.ctl.

    So I have to use the total precipitation(tp) variable in the 1st file to subtract the evaporation(e) variable in the 2nd file...

    I'm new to programming so I find it difficult to write a script to do it, because it involves opening 2 different files, and get one of the many variables in each file and do a subtraction..

    ReplyDelete
    Replies
    1. Looks like you found the answer to your question :)

      Delete
  10. Can anyone tell me what's the difference between synoptic monthly means and monthly means of daily means? Please give an example to ease my understanding. thank you! :D

    ReplyDelete
  11. I have been trying to write a script that extracts the same data from multiple files. i.e. data is extarcted from file 20140101 then 20140102 then 20140103 etc... Hence, do you have any tips on how to write a GrADS script that loops through file names?

    ReplyDelete
    Replies
    1. Super Easy, simply run a while loop changing the file name... If the files are in order, like they appear to be in your example, you can just use numbers, otherwise you might need to use some kind of array. Here is a snippet that might help:

      files=5
      f=1
      number=201401

      while(f<=files)

      fnum=f
      if(f<10);fnum='0'f;endif
      name=number''fnum
      'open 'name'.ctl'
      'set dfile 'f

      *** DO STUFF***

      f=f+1
      endwhile

      Or something like that...

      Delete
  12. Hi, is there anyone that has an opoly_hires.asc for africa?

    ReplyDelete
  13. hi can you help me make a script on how to plot JTWC best track data set.thanks

    ReplyDelete
  14. Hey I was wondering if it is possible in grads to select and plot some irregular shaped region from a bigger domain.

    ReplyDelete
  15. Hi,

    I have been trying to open a netcdf file with single dimension (time) using grads, but neither sdfopen nor open can open it.
    It's a southern oscillation index from 1886-2015 monthly data, so it doesn't have a lon nor lat coordinate, but grads just cant open it.

    I've tried to google it but nobody it seems know how to open the file :(

    Could you please advise?

    ReplyDelete
    Replies
    1. Single dimension eh? Okay, so I think your best bet as of now would be to use to 'xdfopen' command. Essentially, this allows you to open a netcdf file in GrADS, and you control how its read in. the 'sdfopen' command just opens the netcdf file based on it's metadata and variable attributes. You will need to write out a control (.ctl) file that points to your netcdf file. So you would do:

      'xdfopen controlfile.ctl'

      and within controlfile.ctl you point the netcdf file.

      I just checked, and I'm surprised I don't have a tutorial for that (looks like a project for me to do..). Since I don't have a tutorial, here is some information: http://www.iges.org/grads/gadoc/gradcomdxdfopen.html

      Lastly, I like grads for doing maps, and shapefiles with ease and comfort. If you are just trying to open a single dimension netcdf file, I recommend looking into other languages (python is really good for this, matlab is great), it might be easier to do that than to write up a control file to read into grads.

      Delete
    2. Hi,

      Thanks for you suggestion

      I have solved the problem.

      Delete
  16. Hi there,

    I really like your site and all the tutorials you provide. I am looking for a possibility to make height - time plots from station data with GrADs. It is easy enough to create the needed binary file, I can access it and make spatial plots for certain heights and time series for specific stations. However, when I try to set z as the varying dimension, I always end up with an error message like this: "Varying dimension 2 decreases". Any ideas on that? Google has not helped me there :-(

    Cheers, Heidrun

    ReplyDelete
    Replies
    1. So, I've worked on the problem somewhat. Changing the z coordinate helped. Now I can set the z dimension like I want, but I still end up with an error message: "Invalid station data dimension environment" Varying dimensions now are z and time. Any ideas? I would be grateful for any help!

      Heidrun

      Delete
    2. To be honest, I've never actually had to use GrADS to access station data that varies vertically. I can take a guess as to what is wrong, but I would need to dummy up some data and play with it myself to give you a better answer.

      My initial guess is that this error looks like you are trying to access too many dimensions at once. Do you have multiple stations in your data file? If so, have you set your station to be equal for one station?

      Delete
  17. Hi,
    Its nice work you have done,
    I am stuck with a problem,
    i want to plot spatial distribution of Root Mean Square Error of precipitation variable, but dont know how to loop over lat lon so that i can plot RMSE for entire domain.

    would be so nice of you if you reply,
    thanks in advance

    ReplyDelete
  18. Hello,
    I have data in text format like as follows:
    longitude 10 10.5 11 11.5 12 12.5 .................. 50
    latitude 0 0.5 1 1.5 2 2.5 3 3.5 .....................40
    20010101 0 0 0 0 1 0 2 0 4.5 0 ..............
    20010102 1 0 1 2 3 0 4 1 1 ..................
    20010103 2 3 4 1 0 0.5 2 1................
    .
    .
    .
    How can I write out it in Grads gridded format? Please help me

    ReplyDelete
  19. Hello,
    I have data in text format like as follows:
    longitude 10 10.5 11 11.5 12 12.5 .................. 50
    latitude 0 0.5 1 1.5 2 2.5 3 3.5 .....................40
    20010101 0 0 0 0 1 0 2 0 4.5 0 ..............
    20010102 1 0 1 2 3 0 4 1 1 ..................
    20010103 2 3 4 1 0 0.5 2 1................
    .
    .
    .
    How can I write out it in Grads gridded format? Please help me

    ReplyDelete
  20. Hi,
    how open hdf4 sds files in grads?

    ReplyDelete
  21. How i can find wet and dry spells in monthly precipitation nc file

    ReplyDelete
  22. It seems the links above are broken - could you refer me to the update links? Could you also refer me to the Python API you're using?

    ReplyDelete