{"id":17501322,"url":"https://github.com/vinc/forecaster","last_synced_at":"2026-02-27T10:35:04.957Z","repository":{"id":31500846,"uuid":"35065112","full_name":"vinc/forecaster","owner":"vinc","description":"Ruby wrapper around wgrib2 to read data directly from the Global Forecast System ⛅","archived":false,"fork":false,"pushed_at":"2024-10-25T04:48:36.000Z","size":72,"stargazers_count":17,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-12-01T19:58:50.135Z","etag":null,"topics":["gfs","ruby","weather","wgrib2"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-04T23:02:45.000Z","updated_at":"2025-04-23T19:35:09.000Z","dependencies_parsed_at":"2024-11-16T06:03:53.423Z","dependency_job_id":"95c91377-8aed-4f65-838e-e3e8a4a48197","html_url":"https://github.com/vinc/forecaster","commit_stats":{"total_commits":87,"total_committers":4,"mean_commits":21.75,"dds":0.03448275862068961,"last_synced_commit":"98146e23d15761730aa31676031b7abd93ea5b8f"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/vinc/forecaster","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinc%2Fforecaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinc%2Fforecaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinc%2Fforecaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinc%2Fforecaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinc","download_url":"https://codeload.github.com/vinc/forecaster/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinc%2Fforecaster/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29891659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T09:48:51.284Z","status":"ssl_error","status_checked_at":"2026-02-27T09:48:43.992Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gfs","ruby","weather","wgrib2"],"created_at":"2024-10-19T19:44:53.888Z","updated_at":"2026-02-27T10:35:04.924Z","avatar_url":"https://github.com/vinc.png","language":"Ruby","readme":"Forecaster\n==========\n\n[![Gem](https://img.shields.io/gem/v/forecaster.svg)](https://rubygems.org/gems/forecaster)\n[![Build Status](https://api.travis-ci.org/vinc/forecaster.svg?branch=master)](http://travis-ci.org/vinc/forecaster)\n[![Code Climate](https://codeclimate.com/github/vinc/forecaster.svg)](https://codeclimate.com/github/vinc/forecaster)\n[![Code Coverage](https://codecov.io/gh/vinc/forecaster/branch/master/graph/badge.svg)](https://codecov.io/gh/vinc/forecaster)\n\n[Forecaster](https://github.com/vinc/forecaster) is a gem wrapping `wgrib2` to\nfetch and read weather data directly from the Global Forecast System.\n\nIt comes with a library and a CLI allowing you to type commands like `forecast\nfor this afternoon in paris` in your terminal to get the latest weather\nforecast.\n\n[![asciicast](https://asciinema.org/a/193637.png)](https://asciinema.org/a/193637)\n\n\nInstallation\n------------\n\n```bash\ngem install forecaster\n```\n\nAlternatively you can build the gem from its repository:\n\n```bash\ngit clone git://github.com/vinc/forecaster.git\ncd forecaster\ngem build forecaster.gemspec\ngem install forecaster-1.0.0.gem\n```\n\nIn both cases you need to make sure that you have `wgrib2` present in your\nsystem.\n\nTo install the `wgrib2` from source:\n\n```bash\nwget https://ftp.cpc.ncep.noaa.gov/wd51we/wgrib2/wgrib2.tgz\ntar -xzvf wgrib2.tgz\ncd grib2\nexport CC=gcc\nexport FC=gfortran\nmake\nsudo cp wgrib2/wgrib2 /usr/local/bin/\n```\n\nUsage\n-----\n\n```ruby\nrequire \"forecaster\"\n```\n\nTo configure the gem:\n\n```ruby\nForecaster.configure do |config|\n  config.wgrib2_path = \"/usr/local/bin/wgrib2\"\n  config.cache_dir = \"/tmp/forecaster\"\n  config.records = {\n    temperature: \":TMP:2 m above ground:\",\n    humidity:    \":RH:2 m above ground:\",\n    pressure:    \":PRES:surface:\"\n  }\nend\n```\n\nForecaster saves large files containing the data of GFS runs from the NOAA\nservers in the cache directory, but only the parts of the files containing\nthe records defined in the configuration will be downloaded.\n\nYou can find the list of available records [online][1] or by reading any\n`.idx` files distributed along with the GFS files.\n\nA record is identified by a variable and a layer separated by colon\ncharacters. In the case of the temperature for example, those attributes\nare `TMP` and `2 m above ground`. See the [documentation of wgrib2][2] for\nmore information.\n\nTo fetch a forecast:\n\n```ruby\nt = Time.now.utc # All the dates should be expressed in UTC\ny = t.year       # year of GFS run\nm = t.month      # month of GFS run\nd = t.day        # day of GFS run\nc = 0            # hour of GFS run (must be a multiple of 6)\nh = 12           # hour of forecast (must be a multiple of 3)\nforecast = Forecaster.fetch(y, m, d, c, h) # Forecaster::Forecast\n```\n\nTo read the [record][1] of a forecast:\n\n```ruby\nres = forecast.read(:temperature, longitude: 48.1147, latitude: -1.6794) # String in Kelvin\nval = res.to_f - 273.15 # Float in degree Celsius\n```\n\n[1]: https://www.nco.ncep.noaa.gov/pmb/products/gfs/gfs.t00z.pgrb2.0p25.f003.shtml\n[2]: http://www.cpc.ncep.noaa.gov/products/wesley/wgrib2/\n\n\nCommand line\n------------\n\nForecaster has a command line tool that try to be smart:\n\n    $ forecast for tomorrow afternoon in auckland\n    GFS Weather Forecast\n\n      Date:        2016-05-13\n      Time:          12:00:00\n      Zone:             +1200\n      Latitude:         -36.8 °\n      Longitude:        174.8 °\n\n      Pressure:        1013.8 hPa\n      Temperature:       21.7 °C\n      Nebulosity:         0.0 %\n      Humidity:          65.1 %\n      Precipitation:      0.0 mm\n      Wind:               8.0 m/s (NE)\n\nBut you can use it in a more verbose way:\n\n    $ TZ=America/Los_Angeles forecast --time \"2016-05-12 09:00:00\" \\\n                                      --latitude \"37.7749295\" \\\n                                      --longitude \"-122.4194155\" \\\n                                      --debug\n    Requested time:  2016-05-12 09:00:00 -0700\n    GFS Run time:    2016-05-11 23:00:00 -0700\n    Forecast time:   2016-05-12 08:00:00 -0700\n\n    Downloading: 'http://www.ftp.ncep.noaa.gov/data/nccf/com/gfs/prod/gfs.20160\n    51200/gfs.t00z.pgrb2.0p25.f015'\n    Reading index file...\n    Length: 4992281 (4.76M)\n\n    100% [===========================================\u003e] 696 KB/s Time: 00:00:07\n\n    GFS Weather Forecast\n\n      Date:        2016-05-12\n      Time:          08:00:00\n      Zone:             -0700\n      Latitude:          37.8 °\n      Longitude:       -122.4 °\n\n      Pressure:        1013.5 hPa\n      Temperature:       13.4 °C\n      Nebulosity:         0.0 %\n      Humidity:          89.7 %\n      Precipitation:      0.0 mm\n      Wind:               1.0 m/s (NE)\n\nTo use automatically the timezone of a location you will need to create\na free [GeoNames account][3] and export your username in an environment\nvariable:\n\n    export GEONAMES_USERNAME=\u003cusername\u003e\n\nAnd while you're doing that, you can also export your favorite location\nto avoid typing it every time:\n\n    export FORECAST_LATITUDE=\u003clatitude\u003e\n    export FORECAST_LONGITUDE=\u003clongitude\u003e\n\n[3]: http://www.geonames.org/login\n\n\nLicense\n-------\n\nCopyright (c) 2015-2018 Vincent Ollivier. Released under MIT.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinc%2Fforecaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinc%2Fforecaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinc%2Fforecaster/lists"}