UNIS Svalbard Weather Information (SWI) is an application to gather the data coming from different weather stations across the archipelago in order to have an overview of the weather conditions.
-
Clone the repository:
git clone https://github.com/LouisPauchet/UNIS_SvalbardWeatherInformation.git
-
Navigate to the project directory:
cd UNIS_SvalbardWeatherInformation
-
Install dependencies:
pip install -r requirements.txt
The application uses JSON configuration files to define the details of mobile and fixed stations.
Example mobile_stations.json
:
[
{
"id": "bard",
"name": "MS Bard",
"project": "IWIN Boat",
"url": "https://thredds.met.no/thredds/dodsC/met.no/observations/unis/mobile_AWS_MSBard/10min/%Y/%m/mobile_AWS_MSBard_Table_10min_%Y%m%d.nc",
"variables": {
"airTemperature": "temperature",
"seaSurfaceTemperature": null,
"windSpeed": "wind_speed_corrected",
"windDirection": "wind_direction_corrected",
"relativeHumidity": "relative_humidity"
},
"icon": "/static/images/boat/bard.png",
"import_function" : "netcdf_boat.netcdf_boat"
},
...
]
Example fixed_stations.json
:
[
{
"id": "bohemanneset",
"name": "Bohemanneset",
"project": "IWIN Lighthouse",
"url": "https://thredds.met.no/thredds/dodsC/met.no/observations/unis/lighthouse_AWS_Bohemanneset/10min/%Y/%m/lighthouse_AWS_Bohemanneset_Table_10min_%Y%m%d.nc",
"variables": {
"airTemperature": "temperature",
"seaSurfaceTemperature": null,
"windSpeed": "wind_speed_corrected",
"windDirection": "wind_direction_corrected",
"relativeHumidity": "relative_humidity"
},
"icon": "/static/images/lighthouse.png",
"lat": 78.38166,
"lon": 14.753,
"import_function" : "netcdf_lighthouse.netcdf_lighthouse"
},
...
]
To run the application in development mode, execute the following command:
python app.py
The application will be accessible at http://127.0.0.1:5000/
.
Route: /
Method: GET
Description: Renders the index.html
template.
Route: /api/mobile-station-data/<station_id>
Method: GET
Description: Fetches data for a specified mobile station.
Query Parameters:
duration
(optional, default=1): Duration for which to fetch data.
Response:
200 OK
: JSON data of the requested station.404 Not Found
: If the station ID does not exist.500 Internal Server Error
: If there is an error processing the request.
Route: /api/fixed-station-data/<station_id>
Method: GET
Description: Fetches data for a specified fixed station.
Query Parameters:
duration
(optional, default=1): Duration for which to fetch data.
Response:
200 OK
: JSON data of the requested station.404 Not Found
: If the station ID does not exist.500 Internal Server Error
: If there is an error processing the request.
The import functions used to fetch and process data are located in the import_functions
folder. Each function is documented within its respective module and a general documentation to help to create import_function
dedicated to certain sources of data is availble how-to-import-function
<project_directory>/
├───data
├───import_functions
├───static
│ ├───config
│ ├───css
│ ├───images
│ │ ├───boat
│ │ ├───old_wind
│ │ └───wind
│ └───js
└───templates
Warning
The folder data
is required in order to store cached data file to reduce the calculation time on the server.
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new pull request.
This project is licensed under the CC0 1.0 Universal. See the LICENSE file for more details.