Setting up script to automatically download HRRR rainfall forecast
This sample shows how to setup a scheduled task to download real-time hourly spatial rainfall forecast for the next 18 hours from the NOAA HRRR site. NOAA uploads the forecast for the next 18 hours every hour consisting of 18 files. This enhanced version will run every 15 minutes to make sure all the 18 files are downloaded for each hour. If you don’t need to continuously download the data, you can manually run the script without setting up a scheduled task.
Before getting started you’ll need to have the following,
- A server that you can setup a scheduled task
- The bounding box of the area for the rainfall data
- Create the folders for the scripts and the downloaded files
- (Optional) for automated modeling, setup a scheduled task to run the script every 15 minutes
- Setup the spatial database for loading the HRRR data
- (Optional) Setup the data loader to load the downloaded data into the system every 30 minutes
The main challenge with HRRR workflow is that ICMLive requires all the data files to be downloaded for each forecast before it can be imported. However, the time when all the files are ready to be downloaded can change from hour to hour. Downloading the file over the Internet can also pose some connection issues. Therefore, if we download the data only once, we might not be able to get the full dataset.
To overcome these challenges, this script should be scheduled to run every 15 minutes starting at 10min of each hour. This way, we try to download the data 4 times at 10, 25, 40, 55min each hour. This should overcome most of the issues if we only try to download the data once an hour.
Install the script
The script only uses PowerShell script and batch files, any windows computer should support it.
- Create a script folder, and data folder. In this example, both under the sample folder
- Copy hrrr.bat and hrrr.ps1 to the script folder
- Edit hrrr.bat as shown below
- Setup the bounding box, you can get it in Google Maps by right click on the map, make sure there is no space before and after the “=” sign
- Update the folder where the hrrr files will be downloaded, make sure there are two slashes at the end
- Run the *.bat file, you should see files starts to download in the data folder
- Check the log file, as shown below, it shows the files that are successfully downloaded, and the one that are not downloaded yet
When all the 18 files are downloaded, a text file with the prefix for the forecast will be created.
- Setup a task scheduler
Load the HRRR files into a TSDB
- Define the projection in GeoPlan
- Verify the projection using Google Maps
- Zoom to the extent for the rainfall (if you only need to load the rainfall for part of the downloaded HRRR files.)
- Create a spatial time series database
- Setup the TSDB
- Give it a name
- Depending how far into the future you need to run the model, maximum is 18.
- Select a sample file from the data folder
- HRRR uses UTC time
- Select the projection of the model network
- If you need to crop the data, check this option, and the easiest way to do it is to zoom to the area in the GeoPlan, TSDB will automatically pick up the coordinates.
- The conversion for imperial unit, and time interval is 1hr
- If you are using dataloader, setup the update schedule. It depends on how often you run the forecast simulation.
- Review the results
- Open the network
- Turn on the radar cell
- Drag the TSDB into the GeoPlan
- Graph the data to get some sense of the rainfall events.
- Review the rainfall event
- Select a forecast
- Use arrow key to move through the forecast
- See the rainfall in the GeoPlan