This repository is a template example for generating a forecast that is automated through GitHub Actions.
- Click Use This Template in the top right of this page to copy this example to your GitHub account.
- Modify
forecast_model.R
to create your forecast model. Many of the components you need to generate the forecast already exist in this example, including downloading NOAA weather forecasts, downloading target data, generating forecast files, generating metadata, validating files, and submitting forecasts. Avoid running theneon4cast::submit()
function at the end offorecast_model.R
until you are ready to submit a forecast to the Challenge. Do not change the name of the file. GitHub Actions rely on this file name. Be sure to change yourmodel_id
. - Commit and push the changes to
forecast_model.R
to GitHub.
- Under the Actions tab, click on
.github/workflows/generate_forecast.yml
on the left side. - Click Run workflow, then the green Run workflow button.
The forecast in this repository is designed to run daily at 20:00 UTC. The execution of the forecast occurs on GitHub's servers, so your local computer does not need to be turned on. In .github/workflows/generate_forecast.yml
, the lines - cron: "0 20 * * *"
define the time that the forecast is run. In this case, it runs each day at 20:00:00 UTC (note all GitHub timings are in UTC). You can update this to run on a different schedule based on timing codes found at crontab.guru.
To start the automated forecast generation:
- Find the file
generate_forecast.yml
in the.github/workflows
directory on GitHub. - Click the edit (pencil) button to edit the file.
- Remove the
#
before the words "schedule" and "- cron". See below:
Change
on:
#schedule:
# - cron: '0 20 * * *'
workflow_dispatch:
to
on:
schedule:
- cron: '0 20 * * *'
workflow_dispatch:
A video describing how to use GitHub actions for automated forecast generation can be found here: https://youtu.be/dMrUlXi4_Bo
You can run this repo as a "binder". The mybinder.org project will convert the repository into an interactive Rstudio session for you. To create a binder, use the link below but replace "eco4cast/usgsrc4cast-R-example.git" with your repository. This is the exact R configuration that GitHub will be using to run your forecast. The use of mybinder is primarily for testing and not for operationally generating forecasts.
https://mybinder.org/v2/gh/eco4cast/usgsrc4cast-R-example.git/HEAD
Although this software program has been used by the U.S. Geological Survey (USGS), no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith. This software is provided “AS IS.”
As a government employee, the contributions from Jacob Zwart to this repository are in the public domain.