CLI program to download GFS data
I wrote a basic program to quickly get GFS data through the command-line. I had a standard script I always used, but it was cumbersome to continuously find it, copy it and run it. I just needed a command-line-like utility to ease my life.
The most important functions I needed were:
- access from anywhere on my laptop
- can specify which model run I needed
- can specify and download more than one forecast for a model run
The program relies on wget and climate data operators (CDO). If you do not have these do:
Create a ~/bin directory to store the script in. Basically I did the following:
Now there’s a getGFS file which you can edit and add the following
Change the permissions of the getGFS file
Append the following line to your .bashrc file
And it should work after closing and opening your terminal by typing in getGFS. This is just a quick download utility so there’s minor issues. I don’t do forecasts more than an 100 hours out and the script does not allow for that, it’s an easy fix nevertheless. I’ve had some issues where it seems like the data was somehow corrupted when trying to convert to netcdf format, but then I just manually inspect it.