meteole 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of meteole might be problematic. Click here for more details.
- meteole-0.0.1/LICENCE +177 -0
- meteole-0.0.1/NOTICE +15 -0
- meteole-0.0.1/PKG-INFO +186 -0
- meteole-0.0.1/README.md +140 -0
- meteole-0.0.1/pyproject.toml +100 -0
- meteole-0.0.1/setup.cfg +4 -0
- meteole-0.0.1/src/meteole/__init__.py +28 -0
- meteole-0.0.1/src/meteole/_arome.py +70 -0
- meteole-0.0.1/src/meteole/_arpege.py +119 -0
- meteole-0.0.1/src/meteole/_vigilance.py +153 -0
- meteole-0.0.1/src/meteole/clients.py +228 -0
- meteole-0.0.1/src/meteole/errors.py +53 -0
- meteole-0.0.1/src/meteole/forecast.py +744 -0
- meteole-0.0.1/src/meteole/py.typed +0 -0
- meteole-0.0.1/src/meteole.egg-info/PKG-INFO +186 -0
- meteole-0.0.1/src/meteole.egg-info/SOURCES.txt +20 -0
- meteole-0.0.1/src/meteole.egg-info/dependency_links.txt +1 -0
- meteole-0.0.1/src/meteole.egg-info/requires.txt +24 -0
- meteole-0.0.1/src/meteole.egg-info/top_level.txt +1 -0
- meteole-0.0.1/tests/test_clients.py +122 -0
- meteole-0.0.1/tests/test_forecasts.py +763 -0
- meteole-0.0.1/tests/test_vigilance.py +96 -0
meteole-0.0.1/LICENCE
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
meteole-0.0.1/NOTICE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
This software is licensed under the Apache 2 license, quoted below.
|
|
2
|
+
|
|
3
|
+
Copyright 2024 MAIF and contributors
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
6
|
+
use this file except in compliance with the License. You may obtain a copy of
|
|
7
|
+
the License at
|
|
8
|
+
|
|
9
|
+
[http://www.apache.org/licenses/LICENSE-2.0]
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
14
|
+
License for the specific language governing permissions and limitations under
|
|
15
|
+
the License.
|
meteole-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: meteole
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A Python client library for forecast model APIs (e.g., Météo-France).
|
|
5
|
+
Author: ThomasBouche, develop-cs, GratienDSX
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://maif.github.io/meteole/
|
|
8
|
+
Project-URL: Documentation, https://maif.github.io/meteole/home
|
|
9
|
+
Project-URL: Repository, https://github.com/MAIF/meteole
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Information Technology
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: Programming Language :: Python
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
22
|
+
Requires-Python: >3.8.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENCE
|
|
25
|
+
License-File: NOTICE
|
|
26
|
+
Requires-Dist: pandas>=2.0.0
|
|
27
|
+
Requires-Dist: ecmwflibs>=0.6.3
|
|
28
|
+
Requires-Dist: cfgrib>=0.0.11.0
|
|
29
|
+
Requires-Dist: requests>=2.31.0
|
|
30
|
+
Requires-Dist: xarray>=2024.5.0
|
|
31
|
+
Requires-Dist: xmltodict>=0.13.0
|
|
32
|
+
Requires-Dist: matplotlib>=3.8.4
|
|
33
|
+
Provides-Extra: test
|
|
34
|
+
Requires-Dist: pytest; extra == "test"
|
|
35
|
+
Requires-Dist: coverage; extra == "test"
|
|
36
|
+
Requires-Dist: tox; extra == "test"
|
|
37
|
+
Provides-Extra: doc
|
|
38
|
+
Requires-Dist: mkdocs-material; extra == "doc"
|
|
39
|
+
Requires-Dist: mkdocstrings[python]; extra == "doc"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: mypy; extra == "dev"
|
|
42
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff; extra == "dev"
|
|
44
|
+
Provides-Extra: all
|
|
45
|
+
Requires-Dist: meteole[dev,doc,test]; extra == "all"
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
<a href="https://maif.github.io/meteole"><img src="docs/pages/assets/img/svg/meteole-fond-clair.svg" alt="meteole" width="50%"></a>
|
|
49
|
+
</p>
|
|
50
|
+
<p align="center">
|
|
51
|
+
<em>Easy access to Météo-France weather models and data</em>
|
|
52
|
+
</p>
|
|
53
|
+
<p align="center">
|
|
54
|
+
<img src="https://github.com/MAIF/meteole/actions/workflows/ci-cd.yml/badge.svg?branch=main" alt="CI">
|
|
55
|
+
<img src="https://img.shields.io/badge/coverage-86%25-dark_green" alt="Coverage">
|
|
56
|
+
<img src="https://img.shields.io/pypi/v/meteole" alt="Versions">
|
|
57
|
+
<img src="https://img.shields.io/pypi/pyversions/meteole" alt="Python">
|
|
58
|
+
<img src="https://img.shields.io/pypi/dm/meteole" alt="Downloads">
|
|
59
|
+
</p>
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
**Documentation:** [https://pages.github.com/MAIF/meteole/home](https://pages.github.com/MAIF/meteole/home)
|
|
64
|
+
|
|
65
|
+
**Repository:** [https://github.com/MAIF/meteole](https://github.com/MAIF/meteole)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Overview
|
|
70
|
+
|
|
71
|
+
**Meteole** is a Python library designed to simplify accessing weather data from the Météo-France APIs. It provides:
|
|
72
|
+
|
|
73
|
+
- **Automated token management**: Simplify authentication with a single `application_id`.
|
|
74
|
+
- **Unified model usage**: AROME and ARPEGE forecasts with a consistent interface.
|
|
75
|
+
- **User-friendly parameter handling**: Intuitive management of key weather forecasting parameters.
|
|
76
|
+
- **Seamless data integration**: Directly export forecasts as Pandas DataFrames
|
|
77
|
+
- **Vigilance bulletins**: Retrieve real-time weather warnings across France.
|
|
78
|
+
|
|
79
|
+
Perfect for data scientists, meteorologists, and developers, Meteole helps integrate weather forecasts into projects effortlessly.
|
|
80
|
+
|
|
81
|
+
### Installation
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
pip install meteole
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 🕐 Quickstart
|
|
88
|
+
|
|
89
|
+
### Step 1: Obtain an API token or key
|
|
90
|
+
|
|
91
|
+
Create an account on [the Météo-France API portal](https://portail-api.meteofrance.fr/). Next, subscribe to the desired APIs (Arome, Arpege, etc.). Retrieve the API token (or key) by going to “Mes APIs” and then “Générer token”.
|
|
92
|
+
|
|
93
|
+
### Step 2: Fetch Forecasts from AROME and ARPEGE
|
|
94
|
+
|
|
95
|
+
Meteole allows you to retrieve forecasts for a wide range of weather indicators. Here's how to get started with AROME and ARPEGE:
|
|
96
|
+
|
|
97
|
+
| Characteristics | AROME | ARPEGE |
|
|
98
|
+
|------------------|----------------------|----------------------|
|
|
99
|
+
| Resolution | 1.3 km | 10 km |
|
|
100
|
+
| Update Frequency | Every 3 hours | Every 6 hours |
|
|
101
|
+
| Forecast Range | Up to 51 hours | Up to 114 hours |
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from meteole import AromeForecast
|
|
105
|
+
|
|
106
|
+
# Initialize the AROME forecast client
|
|
107
|
+
arome_client = AromeForecast(application_id=APPLICATION_ID) # APPLICATION_ID found on portail.meteo-france.Fr
|
|
108
|
+
|
|
109
|
+
# Check indicators available
|
|
110
|
+
print(arome_client.indicators)
|
|
111
|
+
|
|
112
|
+
# Fetch weather data
|
|
113
|
+
df_arome = arome_client.get_coverage(
|
|
114
|
+
indicator="V_COMPONENT_OF_WIND_GUST__SPECIFIC_HEIGHT_LEVEL_ABOVE_GROUND", # Optional: if not, you have to fill coverage_id
|
|
115
|
+
run="2025-01-10T00:00:00Z", # Optional: forecast start time
|
|
116
|
+
interval=None, # Optional: time range for predictions
|
|
117
|
+
forecast_horizons=[0, 1, 2], # Optional: prediction times (in hours)
|
|
118
|
+
heights=[10], # Optional: height above ground level
|
|
119
|
+
pressures=None, # Optional: pressure level
|
|
120
|
+
coverage_id=None # Optional: an alternative to indicator/run/interval
|
|
121
|
+
)
|
|
122
|
+
```
|
|
123
|
+
Note: The coverage_id can be used instead of indicator, run, and interval.
|
|
124
|
+
|
|
125
|
+
The usage of ARPEGE is identical to AROME, except that you initialize the `ArpegeForecast` class
|
|
126
|
+
|
|
127
|
+
### Step 3: Explore Parameters and Indicators
|
|
128
|
+
#### Discover Available Indicators
|
|
129
|
+
Use the `get_capabilities()` method to list all available indicators, run times, and intervals:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
indicators = arome_client.get_capabilities()
|
|
133
|
+
print(indicators)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### Fetch Description for a Specific Indicator
|
|
137
|
+
Understand the required parameters (`forecast_horizons`, `heights`, `pressures`) for any indicator using `get_description()`:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
description = arome_client.get_description(coverage_id)
|
|
141
|
+
print(description)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### Geographical Coverage
|
|
145
|
+
The geographical coverage of forecasts can be customized using the lat and long parameters in the get_coverage method. By default, Meteole retrieves data for the entire metropolitan France.
|
|
146
|
+
|
|
147
|
+
#### Fetch Forecasts for Multiple Indicators
|
|
148
|
+
The `get_combined_coverage` method allows you to retrieve weather data for multiple indicators at the same time, streamlining the process of gathering forecasts for different parameters (e.g., temperature, wind speed, etc.). For detailed guidance on using this feature, refer to this [tutorial](./tutorial/Fetch_forecast_for_multiple_indicators.ipynb).
|
|
149
|
+
|
|
150
|
+
Explore detailed examples in the [tutorials folder](./tutorial) to quickly get started with Meteole.
|
|
151
|
+
|
|
152
|
+
### ⚠️ VIGILANCE METEO FRANCE
|
|
153
|
+
Meteo France provides nationwide vigilance bulletins, highlighting potential weather risks. These tools allow you to integrate weather warnings into your workflows, helping trigger targeted actions or models.
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from meteole import Vigilance
|
|
157
|
+
|
|
158
|
+
vigi = Vigilance(application_id=APPLICATION_ID)
|
|
159
|
+
|
|
160
|
+
df_phenomenon, df_timelaps = vigi.get_phenomenon()
|
|
161
|
+
|
|
162
|
+
bulletin = vigi.get_bulletin()
|
|
163
|
+
|
|
164
|
+
vigi.get_vignette()
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
<img src="docs/pages/assets/img/png/vignette_exemple.png" width="600" height="300" alt="vignette de vigilance">
|
|
168
|
+
|
|
169
|
+
To have more documentation from MeteoFrance in Vigilance Bulletin :
|
|
170
|
+
- [Meteo France Documentation](https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=305&id_rubrique=50)
|
|
171
|
+
|
|
172
|
+
## Contributing
|
|
173
|
+
|
|
174
|
+
Contributions are *very* welcome!
|
|
175
|
+
|
|
176
|
+
If you see an issue that you'd like to see fixed, the best way to make it happen is to help out by submitting a pull request implementing it.
|
|
177
|
+
|
|
178
|
+
Refer to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for more details about the workflow,
|
|
179
|
+
and general hints on how to prepare your pull request. You can also ask for clarifications or guidance in GitHub issues directly.
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
This project is Open Source and available under the Apache 2 License.
|
|
184
|
+
|
|
185
|
+
## 🤝 Contributors
|
|
186
|
+
The development of Meteole was inspired by the excellent work in the [meteofranceapi](https://github.com/antoinetavant/meteofranceapi) repository by Antoine Tavant.
|
meteole-0.0.1/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://maif.github.io/meteole"><img src="docs/pages/assets/img/svg/meteole-fond-clair.svg" alt="meteole" width="50%"></a>
|
|
3
|
+
</p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<em>Easy access to Météo-France weather models and data</em>
|
|
6
|
+
</p>
|
|
7
|
+
<p align="center">
|
|
8
|
+
<img src="https://github.com/MAIF/meteole/actions/workflows/ci-cd.yml/badge.svg?branch=main" alt="CI">
|
|
9
|
+
<img src="https://img.shields.io/badge/coverage-86%25-dark_green" alt="Coverage">
|
|
10
|
+
<img src="https://img.shields.io/pypi/v/meteole" alt="Versions">
|
|
11
|
+
<img src="https://img.shields.io/pypi/pyversions/meteole" alt="Python">
|
|
12
|
+
<img src="https://img.shields.io/pypi/dm/meteole" alt="Downloads">
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Documentation:** [https://pages.github.com/MAIF/meteole/home](https://pages.github.com/MAIF/meteole/home)
|
|
18
|
+
|
|
19
|
+
**Repository:** [https://github.com/MAIF/meteole](https://github.com/MAIF/meteole)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Overview
|
|
24
|
+
|
|
25
|
+
**Meteole** is a Python library designed to simplify accessing weather data from the Météo-France APIs. It provides:
|
|
26
|
+
|
|
27
|
+
- **Automated token management**: Simplify authentication with a single `application_id`.
|
|
28
|
+
- **Unified model usage**: AROME and ARPEGE forecasts with a consistent interface.
|
|
29
|
+
- **User-friendly parameter handling**: Intuitive management of key weather forecasting parameters.
|
|
30
|
+
- **Seamless data integration**: Directly export forecasts as Pandas DataFrames
|
|
31
|
+
- **Vigilance bulletins**: Retrieve real-time weather warnings across France.
|
|
32
|
+
|
|
33
|
+
Perfect for data scientists, meteorologists, and developers, Meteole helps integrate weather forecasts into projects effortlessly.
|
|
34
|
+
|
|
35
|
+
### Installation
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
pip install meteole
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🕐 Quickstart
|
|
42
|
+
|
|
43
|
+
### Step 1: Obtain an API token or key
|
|
44
|
+
|
|
45
|
+
Create an account on [the Météo-France API portal](https://portail-api.meteofrance.fr/). Next, subscribe to the desired APIs (Arome, Arpege, etc.). Retrieve the API token (or key) by going to “Mes APIs” and then “Générer token”.
|
|
46
|
+
|
|
47
|
+
### Step 2: Fetch Forecasts from AROME and ARPEGE
|
|
48
|
+
|
|
49
|
+
Meteole allows you to retrieve forecasts for a wide range of weather indicators. Here's how to get started with AROME and ARPEGE:
|
|
50
|
+
|
|
51
|
+
| Characteristics | AROME | ARPEGE |
|
|
52
|
+
|------------------|----------------------|----------------------|
|
|
53
|
+
| Resolution | 1.3 km | 10 km |
|
|
54
|
+
| Update Frequency | Every 3 hours | Every 6 hours |
|
|
55
|
+
| Forecast Range | Up to 51 hours | Up to 114 hours |
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from meteole import AromeForecast
|
|
59
|
+
|
|
60
|
+
# Initialize the AROME forecast client
|
|
61
|
+
arome_client = AromeForecast(application_id=APPLICATION_ID) # APPLICATION_ID found on portail.meteo-france.Fr
|
|
62
|
+
|
|
63
|
+
# Check indicators available
|
|
64
|
+
print(arome_client.indicators)
|
|
65
|
+
|
|
66
|
+
# Fetch weather data
|
|
67
|
+
df_arome = arome_client.get_coverage(
|
|
68
|
+
indicator="V_COMPONENT_OF_WIND_GUST__SPECIFIC_HEIGHT_LEVEL_ABOVE_GROUND", # Optional: if not, you have to fill coverage_id
|
|
69
|
+
run="2025-01-10T00:00:00Z", # Optional: forecast start time
|
|
70
|
+
interval=None, # Optional: time range for predictions
|
|
71
|
+
forecast_horizons=[0, 1, 2], # Optional: prediction times (in hours)
|
|
72
|
+
heights=[10], # Optional: height above ground level
|
|
73
|
+
pressures=None, # Optional: pressure level
|
|
74
|
+
coverage_id=None # Optional: an alternative to indicator/run/interval
|
|
75
|
+
)
|
|
76
|
+
```
|
|
77
|
+
Note: The coverage_id can be used instead of indicator, run, and interval.
|
|
78
|
+
|
|
79
|
+
The usage of ARPEGE is identical to AROME, except that you initialize the `ArpegeForecast` class
|
|
80
|
+
|
|
81
|
+
### Step 3: Explore Parameters and Indicators
|
|
82
|
+
#### Discover Available Indicators
|
|
83
|
+
Use the `get_capabilities()` method to list all available indicators, run times, and intervals:
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
indicators = arome_client.get_capabilities()
|
|
87
|
+
print(indicators)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Fetch Description for a Specific Indicator
|
|
91
|
+
Understand the required parameters (`forecast_horizons`, `heights`, `pressures`) for any indicator using `get_description()`:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
description = arome_client.get_description(coverage_id)
|
|
95
|
+
print(description)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Geographical Coverage
|
|
99
|
+
The geographical coverage of forecasts can be customized using the lat and long parameters in the get_coverage method. By default, Meteole retrieves data for the entire metropolitan France.
|
|
100
|
+
|
|
101
|
+
#### Fetch Forecasts for Multiple Indicators
|
|
102
|
+
The `get_combined_coverage` method allows you to retrieve weather data for multiple indicators at the same time, streamlining the process of gathering forecasts for different parameters (e.g., temperature, wind speed, etc.). For detailed guidance on using this feature, refer to this [tutorial](./tutorial/Fetch_forecast_for_multiple_indicators.ipynb).
|
|
103
|
+
|
|
104
|
+
Explore detailed examples in the [tutorials folder](./tutorial) to quickly get started with Meteole.
|
|
105
|
+
|
|
106
|
+
### ⚠️ VIGILANCE METEO FRANCE
|
|
107
|
+
Meteo France provides nationwide vigilance bulletins, highlighting potential weather risks. These tools allow you to integrate weather warnings into your workflows, helping trigger targeted actions or models.
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
from meteole import Vigilance
|
|
111
|
+
|
|
112
|
+
vigi = Vigilance(application_id=APPLICATION_ID)
|
|
113
|
+
|
|
114
|
+
df_phenomenon, df_timelaps = vigi.get_phenomenon()
|
|
115
|
+
|
|
116
|
+
bulletin = vigi.get_bulletin()
|
|
117
|
+
|
|
118
|
+
vigi.get_vignette()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
<img src="docs/pages/assets/img/png/vignette_exemple.png" width="600" height="300" alt="vignette de vigilance">
|
|
122
|
+
|
|
123
|
+
To have more documentation from MeteoFrance in Vigilance Bulletin :
|
|
124
|
+
- [Meteo France Documentation](https://donneespubliques.meteofrance.fr/?fond=produit&id_produit=305&id_rubrique=50)
|
|
125
|
+
|
|
126
|
+
## Contributing
|
|
127
|
+
|
|
128
|
+
Contributions are *very* welcome!
|
|
129
|
+
|
|
130
|
+
If you see an issue that you'd like to see fixed, the best way to make it happen is to help out by submitting a pull request implementing it.
|
|
131
|
+
|
|
132
|
+
Refer to the [CONTRIBUTING.md](./CONTRIBUTING.md) file for more details about the workflow,
|
|
133
|
+
and general hints on how to prepare your pull request. You can also ask for clarifications or guidance in GitHub issues directly.
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
This project is Open Source and available under the Apache 2 License.
|
|
138
|
+
|
|
139
|
+
## 🤝 Contributors
|
|
140
|
+
The development of Meteole was inspired by the excellent work in the [meteofranceapi](https://github.com/antoinetavant/meteofranceapi) repository by Antoine Tavant.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "meteole"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
requires-python = ">3.8.0"
|
|
9
|
+
description = "A Python client library for forecast model APIs (e.g., Météo-France)."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = {text = "Apache-2.0"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "ThomasBouche"},
|
|
14
|
+
{name = "develop-cs"},
|
|
15
|
+
{name = "GratienDSX"},
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Intended Audience :: Information Technology",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"Programming Language :: Python",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
27
|
+
"Programming Language :: Python :: 3.9",
|
|
28
|
+
"Programming Language :: Python :: 3.10",
|
|
29
|
+
"Programming Language :: Python :: 3.11",
|
|
30
|
+
# "Programming Language :: Python :: 3.12", no wheels 3.12 for dependency ecmwflibs
|
|
31
|
+
"License :: OSI Approved :: Apache Software License",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
dependencies = [
|
|
35
|
+
"pandas>=2.0.0",
|
|
36
|
+
"ecmwflibs>=0.6.3",
|
|
37
|
+
"cfgrib>=0.0.11.0",
|
|
38
|
+
"requests>=2.31.0",
|
|
39
|
+
"xarray>=2024.5.0",
|
|
40
|
+
"xmltodict>=0.13.0",
|
|
41
|
+
"matplotlib>=3.8.4",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://maif.github.io/meteole/"
|
|
46
|
+
Documentation = "https://maif.github.io/meteole/home"
|
|
47
|
+
Repository = "https://github.com/MAIF/meteole"
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
test = ["pytest", "coverage", "tox"]
|
|
51
|
+
doc = ["mkdocs-material", "mkdocstrings[python]"]
|
|
52
|
+
dev = ["mypy", "pre-commit", "ruff"]
|
|
53
|
+
all = ["meteole[test,doc,dev]"]
|
|
54
|
+
|
|
55
|
+
[tool.setuptools]
|
|
56
|
+
package-dir = { "" = "src" }
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.packages.find]
|
|
59
|
+
where = ["src"]
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.package-data]
|
|
62
|
+
"meteole" = ["py.typed"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
pythonpath = ["src"]
|
|
66
|
+
testpaths = ["tests"]
|
|
67
|
+
|
|
68
|
+
[tool.mypy]
|
|
69
|
+
exclude = ["tests"]
|
|
70
|
+
ignore_missing_imports = true
|
|
71
|
+
plugins = ["pydantic.mypy"]
|
|
72
|
+
|
|
73
|
+
[tool.ruff]
|
|
74
|
+
line-length = 120
|
|
75
|
+
extend-include = ["*.ipynb"]
|
|
76
|
+
|
|
77
|
+
[tool.ruff.lint]
|
|
78
|
+
ignore = ["E501", "D2", "D3", "D4", "D104", "D100", "D106", "S311", "UP007"]
|
|
79
|
+
extend-select = [
|
|
80
|
+
"E", # pycodestyle errors
|
|
81
|
+
"F", # pyflakes
|
|
82
|
+
"W", # pycodestyle warnings
|
|
83
|
+
"A", # flake8-builtins
|
|
84
|
+
"PLC", # pylint conventions
|
|
85
|
+
"PLE", # pylint errors
|
|
86
|
+
"PLW", # pylint warnings
|
|
87
|
+
"UP", # pyupgrade
|
|
88
|
+
"S", # flake8-bandit,
|
|
89
|
+
"B", # flake8-bugbear
|
|
90
|
+
"I", # isort
|
|
91
|
+
"D", # pydocstyle
|
|
92
|
+
"NPY", # NumPy-specific rules
|
|
93
|
+
]
|
|
94
|
+
exclude = ["tests/*"]
|
|
95
|
+
|
|
96
|
+
[tool.ruff.format]
|
|
97
|
+
docstring-code-format = true
|
|
98
|
+
|
|
99
|
+
[tool.ruff.lint.pydocstyle]
|
|
100
|
+
convention = "google"
|
meteole-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from importlib.metadata import version
|
|
3
|
+
|
|
4
|
+
from meteole._arome import AromeForecast
|
|
5
|
+
from meteole._arpege import ArpegeForecast
|
|
6
|
+
from meteole._vigilance import Vigilance
|
|
7
|
+
|
|
8
|
+
__all__ = ["AromeForecast", "ArpegeForecast", "Vigilance"]
|
|
9
|
+
|
|
10
|
+
__version__ = version("meteole")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def setup_logger():
|
|
14
|
+
"""Setup logger with proper StreamHandler and formatter"""
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
logger.setLevel(logging.INFO)
|
|
17
|
+
|
|
18
|
+
handler = logging.StreamHandler()
|
|
19
|
+
handler.setLevel(logging.INFO)
|
|
20
|
+
|
|
21
|
+
# formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
22
|
+
formatter = logging.Formatter("%(message)s")
|
|
23
|
+
handler.setFormatter(formatter)
|
|
24
|
+
|
|
25
|
+
return logger.addHandler(handler)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
logger = setup_logger()
|