Skip to content
Snippets Groups Projects
Commit 99bdc2b6 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

doc:Added README

parent e3b8da23
No related branches found
No related tags found
No related merge requests found
Pipeline #483 canceled
<img src="./app/static/images/MaDiPHS_logo.png" style="width: 400px; padding-bottom: 30px;"/>
# Mock weather data source
This a weather data source with no live data. It returns data from 2021 from one virtual location. It can be used for testing the API.
The weather data source returns weather data following the IPM Decisions weather data format.
The parameters provided are [parameter_id in square brackets]:
* Mean air temperature at 2m (°C) [1002]
* Minimum air temperature at 2m (°C) [1003]
* Maximum air temperature at 2m (°C) [1004]
* Mean air temperature at -10cm (°C) [1112]
* Precipitation (mm) [2001]
* Mean relative humidity at 2m (%) [3002]
* Leaf wetness at 2m (minutes/h) [3101]
* Instantaneous wind speed at 2m (m/s) [4002]
* Mean wind speed at 2m (m/s) [4003]
* Solar radiation (W/sqm) [5001]
The log interval is either hourly (default) or daily
## Usage
`/weather_data?latitude=[]&longitude=[]&parameters=[,,]&timeStart=[]&timeEnd=[]&interval=[]`
* latitude and longitude are mandatory parameters. Coordinate system: WGS84 (Decimal degrees). It does however not affect the data returned from this service
* parameters are optional Parameters list
* timeStart and timeEnd are optional. Format: YYYY-mm-dd, e.g. 2021-10-28. If omitted, data from Jan-Dec of 2021 will be returned
* interval is optional. The default value is 3600 (hourly values). To get daily values, set interval=86400.
## Example
`/weather_data?latitude=50.109&longitude=10.961&parameters=1002,2001`
## Development
### Run locally
* The application is built using Flask.
* Running the application using a virtualenv is recommended
```bash
cd [app_folder]
# If first time: Create a virtualenv
python3 -m venv mwdsvenv
# Activate the virtualenv
source init_flask_dev
# Install all dependencies
pip install -r requirements.txt
# Start the app
cd app
flask run
```
If all goes well, this is the approximate output:
```bash
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 135-752-566
```
The application should be active on `http://localhost:5000/`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment