GFS maps creation with OpenGrads - does it work?

Wow! This is great, thanks so much!

I was able to get it working using your script, but have two questions …

for Temp, how do I change to F instead of C?

Any recommendation on how/where to learn to automate this? and upload to a ftp server?

I’m glad it worked for you :slight_smile:

I’ll have to look at how easy it is to convert to Fahrenheit. I’m sure it’s possible but I don’t know how many changes would be needed. Some calculations might be basec on using Celsius and the graph colour ranges would need tweaking too.

As regards automating it…I’ll assume that you’re running Grads on Windows and also running Weather Display. If so, then look at the first message in the thread to find a .bat file that probably does most of what you need to do to run the nordic script with the current date passed in. Once you have the .bat file working from the command line, you should learn a bit about Windows Task Scheduler. It’s not terribly complicated but you can configure that to run your .bat file to a schedule that you choose. Once you’ve got the image files created the Weather Display FTP function will allow you to upload non-WD files to your server alongside your normal WD uploads. Then just include them on any pages you want them on.

Thank you! I was able to get the bat file up and running along with Windows Task Scheduler. Thanks so much!! Now, I just got to figure out this whole C to F thing…

I started looking at the C->F conversion but I got distracted by other things. It’s not as straightforward as I thought it might be though. It’s easier for some charts than others but it really needs a proper mod to handle all the different potential units that can be on the different charts. That was what I was doing when I got distracted. I’ll get back to it soon and hopefully have a properly configurable script that lets you select any set of units you like…fully metric, fully imperial or combinations of the two like we use in the UK.

Hi Chris,

I installed the win32_superpack.exe version of OpenGrad, the install worked fine and I have the correct path set.

I got the Four “Grad” browser links on my desktop that open dos command windows.

The problem is when you run any of the desktop icons created or run C:\OpenGrADS > grads via DOS, the effect is the same. A DOS window appears and is blown away inside a second.

I have looked online for a solution but could not find one. I even tried running the program with the Firewall disabled. No Luck. The window doesn’t stay around long enough to see if there is an error message.

My question is, have anyone else had this happen?

Regards, Dave

I’ve not tried the Windows version of OpenGrads. I’ve got it installed and I’m investigating.

I’ve got it working…probably not optimally but it generates PNG files without errors (and only one warning that I think can be ignored). You need to do a number of things:

  1. You need to have the GrADS library in the same directory as the script. You can download the script from GrADS Script Library and put it in the required directory. You only need to do this once.

  2. Open a CMD.exe window and ‘cd’ to the directory where OpenGrADS is installed (D:\OpenGrADS-2.2 in my case).

  3. Create an environment variable (GADDIR) to point to the directory where the udunits.dat file is. This should be in Contents\Resources\SupportData below your OpenGrads install directory. So I use:

set GADDIR=D:\OpenGrADS-2.2\Contents\Resources\SupportData\
  1. You can now run the script using :
cscript opengrads.vbs -lcbx

This pops up another command window running the script. You’ll get the prompts for date/hour/hour offset and the script will the generate the required PNG files.

  1. I’ve created a small .BAT file (I know I’m old fashioned and .CMD files are the modern way but old habits die hard) to create the environment variable and then run the script. Mine is called mygrads.bat (in D:\OpenGrADS-2.2) and contains:
set GADDIR=D:\OpenGrADS-2.2\Contents\Resources\SupportData\
cscript opengrads.vbs -lcbx

What I’ve not figured out yet is how to pass the parameters (YYYYMMDD HH OO) into the script so that you can have a fully automated script that runs from the scheduler. I’m sure that’s possible but I’ve run out of time for now!

Hi Chris,

It doesn’t seem to like the length of my PATH statement.

Here is the DOS Command window.


1 [main] opengrads 9024 find_fast_cwd: WARNING: Couldn’t compute FAST_CWD pointer. Please report this problem to
the public mailing list [email protected]
MAX_SIZE = 2048, needed size = 4870
Internal error: environment variable PATH is too long; change MAX_SIZE to at least 4870 and recompile or else shorten your PATH by 2822 characters



Regards, Dave

Mine was also too long but when I looked at it there were a lot of duplicate entries that when removed shrunk it enough to run ok.

One thing you could do is to add a new PATH setting in your. BAT that only has just what you need in it to run OpenGrADS.

This is a much better batch file…

@echo off
set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemDrive%;D:\OpenGrADS-2.2\Contents\Cygwin\Versions\2.2.1.oga.1\i686
set GADDIR=D:\OpenGrADS-2.2\Contents\Resources\SupportData\
opengrads.exe -lcbx " %1 %2 %3"

It sets a short path that I think should cover what the vast majority of users will need to run OpenGrADS. Add to the PATH if you need to though.

The PATH includes the directory that opengrads.exe is in so we just need to run the program directly rather than using the WSH script to find and execute it. This removes a level of complexity. Note: you have to specify it as opengrads.exe otherwise Windows will run opengrads.vbs by default.

Finally, it allows the relevant parameters to be passed into the batch file via the command line. So in my case I can use…

mygrads 20200522 00 6

…to generate maps for the 00z GFS run on 22/May/2020 with an offset of 6 hours from the start of the run, i.e. first map at 06z.

Hi Chris,

I got something on the screen with a start.bat file looking like this.

@echo off
set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemDrive%;C:\OpenGrADS\Contents\Cygwin\Versions\$version\i686
set GADDIR=C:\OpenGrADS\Contents\Resources\SupportData\
grads -lcbx " %1 %2 %3"

Tried these inputs and got the following errors.

Running in Batch mode
Enter forecast date (example, 20200418) → 20200523
Enter forecast hour (example, 00 or 06 or 12 or 18) → 12
Enter start hour for forecasting (example, 5) → 5
All files closed; all defined objects released;
All GrADS attributes have been reinitialized
curl error details:
Error: nc_open failed to open file
NetCDF: I/O failure
gadsdf: Couldn’t ingest SDF metadata.
No Files Open



You’re trying to run it for the 12z GFS data from tomorrow (20200523) but that won’t be available until tomorrow afternoon at about 16z. The run date is the GFS run date which is always in the past. Try it again with “20200522 06 6” (today’s 06z run).

Hi Chris,

Tried those parameters as you can see below.

Enter forecast date (example, 20200418) --> 20200522
Enter forecast hour (example, 00 or 06 or 12 or 18) --> 06
Enter start hour for forecasting (example, 5) --> 6
All files closed; all defined objects released;
All GrADS attributes have been reinitialized
curl error details:
Error: nc_open failed to open file
NetCDF: I/O failure
gadsdf: Couldn't ingest SDF metadata.
No Files Open

However if I type the above link in my browser the page appears, so someone is lying.


I’ve just tried the same parameters and they work for me so the data is available on at some of the servers. It’s possible it’s not on all of the servers due to an error.

I see a couple of differences between your batch file and mine…

  1. [li]
    In your path you have $version in the path C:\OpenGrADS\Contents\Cygwin\Versions$version\i686 and I have the actual software version (2.2.1.oga.1) - D:\OpenGrADS-2.2\Contents\Cygwin\Versions\2.2.1.oga.1\i686 in mine[/li]
  2. You’re running grads (probably grads.vbs) and I’m running opengrads.exe.

I don’t know if those would break it but it would be worth testing as close to the same settings on your PC to see if it makes a difference.

Hi Chris,

changed it to :

set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemDrive%;C:\OpenGrADS\Contents\Cygwin\Versions\2.1.a2.oga.1\i686

It made no difference.


Did you change grads to OpenGrads.exe?

tried that, same error.

Is your CMD window running as administrator? If not, try that.

Tried CMD it as Administrator and even tried disabling the Firewall.

No success. “curl error”


In the CMD window try ‘curl’ followed by the URL to see if there’s a problem with curl downloading the file.