{"id":13800937,"url":"https://github.com/IBM/MAX-Weather-Forecaster","last_synced_at":"2025-05-13T10:30:38.900Z","repository":{"id":39854493,"uuid":"148203076","full_name":"IBM/MAX-Weather-Forecaster","owner":"IBM","description":"Predict hourly weather features given historical data for a specific location","archived":false,"fork":false,"pushed_at":"2023-05-23T00:41:03.000Z","size":6640,"stargazers_count":72,"open_issues_count":4,"forks_count":33,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-07T05:42:16.566Z","etag":null,"topics":["docker-image","lstm-neural-network","machine-learning","machine-learning-models","weather-forecast"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IBM.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-09-10T18:47:13.000Z","updated_at":"2025-04-11T09:17:02.000Z","dependencies_parsed_at":"2024-01-05T20:57:20.780Z","dependency_job_id":"b66299e2-df1a-42c6-b599-b69ecb1adb4a","html_url":"https://github.com/IBM/MAX-Weather-Forecaster","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Weather-Forecaster","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Weather-Forecaster/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Weather-Forecaster/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IBM%2FMAX-Weather-Forecaster/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IBM","download_url":"https://codeload.github.com/IBM/MAX-Weather-Forecaster/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253922790,"owners_count":21984780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["docker-image","lstm-neural-network","machine-learning","machine-learning-models","weather-forecast"],"created_at":"2024-08-04T00:01:17.804Z","updated_at":"2025-05-13T10:30:38.356Z","avatar_url":"https://github.com/IBM.png","language":"Python","readme":"[![Build Status](https://travis-ci.com/IBM/MAX-Weather-Forecaster.svg?branch=master)](https://travis-ci.com/IBM/MAX-Weather-Forecaster) [![Website Status](https://img.shields.io/website/http/max-weather-forecaster.codait-prod-41208c73af8fca213512856c7a09db52-0000.us-east.containers.appdomain.cloud/swagger.json.svg?label=api+demo)](http://max-weather-forecaster.codait-prod-41208c73af8fca213512856c7a09db52-0000.us-east.containers.appdomain.cloud)\n\n[\u003cimg src=\"docs/deploy-max-to-ibm-cloud-with-kubernetes-button.png\" width=\"400px\"\u003e](http://ibm.biz/max-to-ibm-cloud-tutorial)\n\n# IBM Developer Model Asset Exchange: Weather Forecaster\n\nThis repository contains code to instantiate and deploy a weather forecasting model. The model takes hourly weather data\n(as a Numpy array of various weather features, in text file format) as input and returns hourly weather predictions for\na specific target variable or variables (such as temperature or wind speed).\n\nThree models have been included with this repository, all trained by the [CODAIT team](http://codait.org) on\n[National Oceanic and Atmospheric Administration](https://www.ncdc.noaa.gov) local climatological data originally\ncollected by JFK airport. All three models use an LSTM recurrent neural network architecture. You can specify which\nmodel you wish to use when making requests to the API (see [Use the Model](#3-use-the-model) below for more details).\n\nA description of the weather variables used to train the models is set out below.\n\n| Variable                 | Description           |\n|---------------          | ----------------------|\n| HOURLYVISIBILITY        | Distance from which an object can be seen. |\n| HOURLYDRYBULBTEMPF      | Dry bulb temperature (degrees Fahrenheit). Most commonly reported standard temperature. |\n| HOURLYWETBULBTEMPF      | Wet bulb temperature (degrees Fahrenheit).  |\n| HOURLYDewPointTempF     | Dew point temperature (degrees Fahrenheit). |\n| HOURLYRelativeHumidity  | Relative humidity (percent). |\n| HOURLYWindSpeed         | Wind speed (miles per hour). |\n| HOURLYStationPressure   | Atmospheric pressure (inches of Mercury; or 'in Hg'). |\n| HOURLYSeaLevelPressure  | Sea level pressure (in Hg). |\n| HOURLYPrecip            | Total precipitation in the past hour (in inches). |\n| HOURLYAltimeterSetting  | Atmospheric pressure reduced to sea level using temperature profile of the “standard” atmosphere (in Hg). |\n| HOURLYWindDirectionSin     | Sine component of wind direction transformation (since wind direction is cyclical). |\n| HOURLYWindDirectionCos     | Cosine component of wind direction transformation (since wind direction is cyclical). |\n| HOURLYPressureTendencyIncr  | Dummy variable indicating if pressure was increasing in the past hour. |\n| HOURLYPressureTendencyDecr  | Dummy variable indicating if pressure was decreasing in the past hour. |\n| HOURLYPressureTendencyCons  | Dummy variable indicating if pressure has stayed relatively constant in the past hour. | \n\nFor further details on the weather variables see the [US Local Climatological Data Documentation](https://www1.ncdc.noaa.gov/pub/data/cdo/documentation/LCD_documentation.pdf)\n\nEach model returns a different format for its predictions:\n* *Univariate Model*: returns a prediction of dry bulb temperature (`HOURLYDRYBULBTEMPF`), for the next hourly time step, for each input data point\n* *Multivariate Model*: returns predictions for all 15 weather variables, for the next hourly time step, for each input data point\n* *Multistep Model*: returns predictions of dry bulb temperature (`HOURLYDRYBULBTEMPF`), for the next 48 hourly time steps, for each input data point\n\nThe model files are provided as part of this repository in the [`assets/models`](assets/models) folder. The code in this\nrepository deploys the model as a web service in a Docker container. This repository was developed as part of the\n[IBM Code Model Asset Exchange](https://developer.ibm.com/code/exchanges/models/) and the public API is powered by\n[IBM Cloud](https://ibm.biz/Bdz2XM).\n## Model Metadata\n\n| Domain        | Application           | Industry       | Framework  | Training Data           | Input Data Format |\n|---------------|-----------------------|----------------|------------|-------------------------|-------------------|\n| Weather       | Time Series Prediction | General | TensorFlow / Keras | [JFK Airport Weather Data, NOAA](https://www.ncdc.noaa.gov/cdo-web/datasets/LCD/stations/WBAN:94789/detail) | CSV |\n\n* Data from [US Local Climatological Data](https://www.ncdc.noaa.gov/cdo-web/datatools/lcd), National Climatic Data Center, National Oceanic \u0026 Atmospheric Administration\n\n## References\n\nLiterature and Documentation\n* [LSTMs in Keras](https://keras.io/layers/recurrent/#lstm)\n* [Time Series Prediction with RNNs](https://mourafiq.com/2016/05/15/predicting-sequences-using-rnn-in-tensorflow.html)\n* _S. Hochreiter, J. Schmidhuber_ [\"Long Short Term Memory\"](http://www.bioinf.jku.at/publications/older/2604.pdf), Neural Computation 1997\n\nRelated Repositories\n* [TensorFlow Tutorials for Time Series](https://github.com/tgjeon/TensorFlow-Tutorials-for-Time-Series)\n* [Tensorflow LSTM Regression](https://github.com/mouradmourafiq/tensorflow-lstm-regression)\n\n## Licenses\n\n| Component | License | Link  |\n| ------------- | --------  | -------- |\n| This repository | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | [LICENSE](LICENSE) |\n| Model Weights | [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) | [LICENSE](LICENSE) |\n| Test Assets | No restriction | [Asset README](assets/README.md) |\n\n## Prerequisites\n\n* `docker`: The [Docker](https://www.docker.com/) command-line interface. Follow the [installation instructions](https://docs.docker.com/install/) for your system.\n* The minimum recommended resources for this model is 2GB Memory and 2 CPUs.\n* If you are on x86-64/AMD64, your CPU must support [AVX](https://en.wikipedia.org/wiki/Advanced_Vector_Extensions) at the minimum.\n\n# Deployment options\n\n* [Deploy from Quay](#deploy-from-quay)\n* [Deploy on Red Hat OpenShift](#deploy-on-red-hat-openshift)\n* [Deploy on Kubernetes](#deploy-on-kubernetes)\n* [Run Locally](#run-locally)\n\n## Deploy from Quay\n\nTo run the docker image, which automatically starts the model serving API, run:\n\n```\n$ docker run -it -p 5000:5000 quay.io/codait/max-weather-forecaster\n```\n\nThis will pull a pre-built image from the Quay.io container registry (or use an existing image if already cached locally) and run it.\nIf you'd rather checkout and build the model locally you can follow the [run locally](#run-locally) steps below.\n\n## Deploy on Red Hat OpenShift\n\nYou can deploy the model-serving microservice on Red Hat OpenShift by following the instructions for the OpenShift web console or the OpenShift Container Platform CLI [in this tutorial](https://developer.ibm.com/tutorials/deploy-a-model-asset-exchange-microservice-on-red-hat-openshift/), specifying `quay.io/codait/max-weather-forecaster` as the image name.\n\n## Deploy on Kubernetes\n\nYou can also deploy the model on Kubernetes using the latest docker image on Quay.\n\nOn your Kubernetes cluster, run the following commands:\n\n```\n$ kubectl apply -f https://github.com/IBM/MAX-Weather-Forecaster/raw/master/max-weather-forecaster.yaml\n```\n\nThe model will be available internally at port `5000`, but can also be accessed externally through the `NodePort`.\n\n## Run Locally\n\n1. [Build the Model](#1-build-the-model)\n2. [Deploy the Model](#2-deploy-the-model)\n3. [Use the Model](#3-use-the-model)\n4. [Development](#4-development)\n5. [Clean Up](#5-cleanup)\n\n### 1. Build the Model\n\nClone this repository locally. In a terminal, run the following command:\n\n```\n$ git clone https://github.com/IBM/MAX-Weather-Forecaster.git\n```\n\nChange directory into the repository base folder: \n\n```\n$ cd MAX-Weather-Forecaster\n```\n\nTo build the docker image locally, run:\n\n```\n$ docker build -t max-weather-forecaster .\n```\n\n_Note_ that currently this docker image is CPU only (we will add support for GPU images later).\n\n## 2. Deploy the Model\n\nTo run the docker image, which automatically starts the model serving API, run:\n\n```\n$ docker run -it -p 5000:5000 max-weather-forecaster\n```\n\n## 3. Use the Model\n\nThe API server automatically generates an interactive Swagger documentation page. Go to `http://localhost:5000` to load it. From there you can explore the API and also create test requests.\n\nUse the `model/predict` endpoint to load a test data file and get predictions for the relevant weather target variable (or variables) from the API. You can use one of the test files from the `assets/lstm_weather_test_data` folder, after unzipping the test data archive by running the following command:\n\n```\n$ tar -zxvf assets/lstm_weather_test_data.tar.gz -C assets\n```\n\n![Swagger Screenshot](/docs/swagger-screenshot.png \"Swagger Screenshot\")\n\nYou can also test it on the command line, for example to test the univariate model:\n```bash\n$ curl -F \"file=@assets/lstm_weather_test_data/univariate_model_test_data.txt\" -XPOST http://localhost:5000/model/predict\n```\n\nYou can select one of the three available models used to make predictions by setting the `model` request parameter to one of: `univariate` (default), `multivariate`, or `multistep`. _Note_ that each model takes in different weather datasets. After loading a particular model, you must predict only on the accompanying test dataset (e.g. `univariate` must predict on `univariate_model_test_data.txt`).\n\nFor example, to test the multivariate model:\n```bash\n$ curl -F \"file=@assets/lstm_weather_test_data/multivariate_model_test_data.txt\" -XPOST http://localhost:5000/model/predict?model=multivariate\n```\n\nTo test the multi-step model:\n```bash\n$ curl -F \"file=@assets/lstm_weather_test_data/multistep_model_test_data.txt\" -XPOST http://localhost:5000/model/predict?model=multistep\n```\n\nYou should see a JSON response like that below for the `multistep` test data, where `predictions` contains the predicted dry bulb temperature (in F) for each of the next 48 hours, for each input data point.\n\n```\n{\n  \"status\": \"ok\",\n  \"predictions\": [\n    [\n      77.51201432943344,\n      76.51381462812424,\n      75.0168582201004,\n      73.84445126354694,\n      72.79087746143341,\n      71.71804094314575,\n      70.97693882882595,\n      70.44060184061527,\n      69.89843893051147,\n      69.35454525053501,\n      69.04163710772991,\n      68.70432360470295,\n      68.37075608968735,\n      68.20421539247036,\n      68.01852786540985,\n      67.6653740555048,\n      67.27566187083721,\n      67.0398361980915,\n      66.69407051801682,\n      66.9289058893919,\n      67.19844545423985,\n      67.65162572264671,\n      68.30480472743511,\n      69.37090930342674,\n      70.37226051092148,\n      71.57235226035118,\n      72.68855434656143,\n      73.91224025189877,\n      74.65138283371925,\n      75.09161844849586,\n      75.30447003245354,\n      75.04770956933498,\n      74.93723678588867,\n      74.27759975194931,\n      73.82458955049515,\n      73.32358133792877,\n      72.66812674701214,\n      71.75925283133984,\n      71.28871068358421,\n      70.66486597061157,\n      70.06835387647152,\n      69.74887031316757,\n      69.49707941710949,\n      69.26406812667847,\n      68.87126012146473,\n      68.60496838390827,\n      68.39429907500744,\n      68.03596951067448\n    ],\n    ...\n}\n```\n\n## 4. Development\n\nTo run the Flask API app in debug mode, edit `config.py` to set `DEBUG = True` under the application settings. You will\nthen need to rebuild the Docker image (see [step 1](#1-build-the-model)).\n\n## 5. Cleanup\n\nTo stop the Docker container, type `CTRL` + `C` in your terminal.\n\n## Resources and Contributions\n   \nIf you are interested in contributing to the Model Asset Exchange project or have any queries, please follow the instructions [here](https://github.com/CODAIT/max-central-repo).\n","funding_links":[],"categories":["Data \u0026 AI"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIBM%2FMAX-Weather-Forecaster","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FIBM%2FMAX-Weather-Forecaster","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FIBM%2FMAX-Weather-Forecaster/lists"}