This is a Python package to directly interact with the Meetnet Vlaamse Banken api and get the publically available weather data in the Belgian North Sea directly.
Project description
MVBC (Meetnet Vlaamse Banken Client)
The mvbc package is a Python client to interact with the Meetnet Vlaamse Banken API. This package provides easy access to public weather data from the Belgian North Sea directly, and it returns the data in a pandas DataFrame format, making it convenient for further analysis.
Getting Started
1. Create an Account
To use the Meetnet Vlaamse Banken API, you first need to create an account and get credentials:
- Go to the Meetnet Vlaamse Banken registration page.
- Once registered, you will obtain your
MEETNET_USERNAMEandMEETNET_PASSWORD.
2. Set Credentials as Environment Variables
For best security practices, store your credentials in environment variables. You can set them as follows in your terminal:
export MEETNET_USERNAME="your_username"
export MEETNET_PASSWORD="your_password"
3. Install the Package
You can install the mvbc package via pip:
pip install mvbc
4. Using the Package
Once you have the package installed, you can start using it to retrieve weather data. Below is an example on how to use the package to fetch data.
import mvbc
# If you are using environmental variables
mvbc_username = os.getenv('MEETNET_USERNAME') # Replace with your usernam
mvbc_password = os.getenv('MEETNET_PASSWORD') # Replace with your password
# Use the credentials
creds = Credentials(username=mvbc_username, password=mvbc_password)
b=Base(creds)
b.ping()
# Specify the timeframe of interest
dt_start = datetime(2022,9,30,tzinfo=utc) # timestamp with timezone
dt_end = datetime(2022,10,1,tzinfo=utc)
# Get the information about the avialble data points
c = Catalog(credentials=creds)
df_unfiltered = c.data_points()
print(df_unfiltered)
The df_unfiltered DataFrame contains the information about the available data and the weather stations.
There are two main ways to retrieve data:
- By Weather Station Name: You can directly specify the name of the weather station to get data.
weather_station = 'Wandelaar'
df_weather = \
dg.get_data_by_weatherstation(
weather_station,
dt_start,
dt_end,
creds,
df_unfiltered
)
- By Asset Location: You can provide the location (latitude, longitude) of your asset (e.g., an offshore wind turbine) at sea, and the package will fetch data from the closest weather station.
# Replace this with location of interest in the from of [Latitude, Longitude]
location_of_interest = [2.81, 51.69]
df_weather, weatherstation_information, all_wetaherstations = dg.get_longterm_weather_data(location_of_interest, dt_start, dt_end, df=df_unfiltered, credentials=creds)
# Data comes in for every 30min, but you can resample to the time you want (e.g. 10 minutes)
df_weather = df_weather.resample('10T', axis=0).interpolate(method='linear', axis=0, limit=12)
5. Available Data Format
The weather data is returned as a pandas DataFrame (df_weather) with the timestamps in the rows and columns in the format:
mvbc_<weather station>_<Parameter Name>
For example, you might see columns such as:
mvbc_Thorntonbank_Wind_speed
mvbc_Wandelaar_Temperature
mvbc_Westhinder_Wave_height
6. Data and Weather Stations
The additional information about available weather stations and data can be accessed via the df_unfiltered DataFrame. This provides you with metadata about the stations and available parameters.
7. Using Preferred Weather Stations
You can also set a list of preferred weather stations to prioritize fetching data from. The default preferred stations are:
- Thorntonbank
- Wandelaar
- Westhinder
You can provide your own list of preferred stations as follows:
preferred_stations = ["Westhinder", "Nieuwpoort"]
df_preferred = client.get_weather_data(preferred_stations=preferred_stations)
print(df_preferred)
Example Usage
For a full usage example, check out the provided Jupyter notebook (mvbc_tutorial.ipynb) which showcases different ways of fetching data, including using preferred weather stations and fetching data by location.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mvbc-0.1.0.tar.gz.
File metadata
- Download URL: mvbc-0.1.0.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de04f16df83ae4dd1b0f6d21adebb60d9004897c7fd3f01a89d97279a335288f
|
|
| MD5 |
2c5710630ba550ca1719d9f1f7e98556
|
|
| BLAKE2b-256 |
43ebe6fc9ffbe69769d789a351e02ca957f539c1b71aacd056a015168777c08e
|
File details
Details for the file mvbc-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mvbc-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea095c22199bacf10476b6ba092929bf735ae21e488b18eb42c1fb57ad7f9b61
|
|
| MD5 |
9a3c6a4373bdd2131348e73870570c0d
|
|
| BLAKE2b-256 |
30b662d70b2821dd7e69dd6d63a7d5a8e8888050c753396985ac151f77bdb2e6
|