Monday, May 6, 2013

Tutorial: Plot RADAR data using GrADS

GrADS is great for plotting model data, but did you know that you can plot RADAR and satellite data as well?  This tutorial is very similar to the plotting satellite tutorial, and will take you through the steps of making plots with archived RADAR data from the National Climatic Data Center (NCDC).

For this tutorial, it is recommended that you use the script color.gs and cbar.gs.  Alternatively to color.gs you could use the script colorset.gs to approximate the NWS RADAR color scale.

Using GrADS to plot radar data is not much different than using GrADS to plot model data, and is essentially compromised of three main steps.

  1. Get RADAR data
  2. Save data into a netcdf file
  3. Plot the data using Grads

Step 1: Get the Data.

You can download archived RADAR data from the NCDC at this website.
Accessing the data is very simple, and only requires you to pick a RADAR site and time.  Enter your e-mail address into the box provided and a data request number will be sent to you shortly after.

You can additionally download data in real time via FTP from this website.  I have had success using a batch version of NOAA's weather and climate tool kit data exporter.  More information on this can be found here.

However assuming that you are downloading archived RADAR data, you can simply use the online version of the weather and climate toolkit here.  Once you have this program open on your computer, it is time to move on to step 2.

Step 2: Convert the Data to Netcdf Format.

Once you have both the toolkit and the data request number, you can now access the data.  Accessing the data is simple, all you have to do is choose the "load data" option to bring up the "data selector" window.  Once this window is open, choose the tab NCDC HAS Order and enter your confirmation number into the space provided.

NCDC Weather and Climate Toolkit

Once you have your list of files, choose the "export" option.  This will bring you to another list of options to go through.  Choose "gridded netcdf" as your file type, after that the options are pretty much up to you.  I generally just click through keeping the default options.

Once the program is finished processing the data, you will see a file in your folder that looks something like this:KVWX_NCR_20100510_162700.nc.  Basically, the name is made up of the RADAR call sign, the variable, the date and the time.  This file is a self describing netcdf file, and can be read into GrADS.  Which brings us to the final step.


Step 3: Plot the data in GrADS

First open your file using the 'sdfopen' command.  Once the file is open, you can follow the commands listed below to approximate the standard RADAR color scheme used in operation by NOAA using color.gs.

     'set gxout grfill'
     'set mpdset hires'
     'color 5 75 5 -kind dodgerblue->blue->lime->green->darkgreen->yellow->goldenrod->orange->firebrick->red->darkred->fuchsia->indigo

     'd cref'
     'cbar'

...or alternatively, using colorset.gs:

      'set gxout grfill'
      'set mpdset hires'
     'colorset Rad1'
     'd cref'
     'cbar'

Another option for a RADAR color scheme that approximates the standard NWS scheme (available from COLA. Full example here) is listed below as a function.  It is called as such:

     getcols()
     'set ccols 20 21 22 23 24 25 26 27 28 29 30 31 32 33' 
     'set clevs 5 10 15 20 25 30 35 40 45 50 55 60 65 '

    function getcols()
    'set rgb 99 140 140 116'
    'set rgb 20 180 200 255'
    'set rgb 21 95 135 255' 
    'set rgb 22 20 70 230' 
    'set rgb 23 110 245 75' 
    'set rgb 24 0 195 0' 
    'set rgb 25 0 115 0' 
    'set rgb 26 255 255 0' 
    'set rgb 27 255 180 48' 
    'set rgb 28 250 125 0'
    'set rgb 29 230 45 0'
    'set rgb 30 175 0 0'
    'set rgb 31 105 0 0'
    'set rgb 32 250 0 200' 
    'set rgb 33 155 0 250'

No matter which color scale you use, your resultant image should look similar to the one below.


Example of RADAR data from GrADS



Download this script

6 comments:

  1. I am trying to plot reflectivity from multiple radar sites into one image to generate a "regional' radar for the great lakes region, but cannot open multiple NetCDF files into grads due to the varying time stamps and X Y dimensions. Have tried using xdfopen on a descriptor file, but do not think I was doing it right. Any suggestions???

    ReplyDelete
  2. Hi, I can help you with the first bit, every time you open a new file, simply reset t to 1 (as long as the file times are only 5 minutes off of so). As to the x/y dimensions, just manually set them before opening up the files to ensure that the different RADAR scans fit in the dimensions. The radar files themselves should be fine with the 'sdfopen ' command so long as you get them from NCDC.

    The other problem you will find is that as you plot each scan, you will overwrite the area that overlaps with previous scans, this can lead to weird looking plots. It is possible that you could fix this using the maskout function, but I haven't looked into that personally. Just wanted to give you a heads up there!

    ReplyDelete
    Replies
    1. Thank you! Have made great progress, have read in multiple radar sites and displayed them successfully, my latest issue Im trying to work out is making the bref values that are less than (say 5 for ex.) be transparent. I overlay the radar images on top of shape files and I used basemap to shade the US, but values of between 0-5 show up as white patches

      Delete
  3. This should be easy enough, first try setting the first contour color = 0,

    'set clevs 5 10 15 …'
    'set ccols 0 1 2 …'

    then make sure you set the printim image to have a transparency of 0..
    'printim … -t 0 …'

    this will make every value below 5dBZ transparent.

    If for some reason that doesn't work, just use the maskeout function to mask values below 5dBZ.

    'd maskout(bref,bref-5)'

    Good Luck!

    ReplyDelete
  4. First, thanks for your site. It has been very helpful.

    I'm trying to plot NEXRAD, but not sure where to get the data via FTP. I have found ftp://tgftp.nws.noaa.gov/SL.us008001/DF.of/DC.radar/, but I'm unsure which folder contains what product?

    I am looking for Base Reflectivity to start (BREF1)

    Thanks

    ReplyDelete
  5. Man i try but i dont have any progress. I dont know if im doing something bad

    ReplyDelete