meteostat-cli 0.2.0__tar.gz → 0.4.0__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.
Files changed (48) hide show
  1. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/.claude/skills/meteo/SKILL.md +5 -21
  2. meteostat_cli-0.4.0/PKG-INFO +152 -0
  3. meteostat_cli-0.4.0/README.md +119 -0
  4. meteostat_cli-0.4.0/demo.gif +0 -0
  5. meteostat_cli-0.4.0/demo.yml +266 -0
  6. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/__init__.py +1 -1
  7. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/cli.py +29 -3
  8. meteostat_cli-0.4.0/meteo/commands/contrib/__init__.py +44 -0
  9. meteostat_cli-0.4.0/meteo/commands/contrib/add.py +171 -0
  10. meteostat_cli-0.4.0/meteo/commands/contrib/build.py +48 -0
  11. meteostat_cli-0.4.0/meteo/commands/contrib/delete.py +28 -0
  12. meteostat_cli-0.4.0/meteo/commands/contrib/duplicates.py +64 -0
  13. meteostat_cli-0.4.0/meteo/commands/contrib/edit.py +177 -0
  14. meteostat_cli-0.4.0/meteo/commands/contrib/validate.py +78 -0
  15. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/station.py +57 -12
  16. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/config.py +3 -2
  17. meteostat_cli-0.4.0/meteo/contrib/__init__.py +4 -0
  18. meteostat_cli-0.4.0/meteo/contrib/database.py +103 -0
  19. meteostat_cli-0.4.0/meteo/contrib/duplicates.py +133 -0
  20. meteostat_cli-0.4.0/meteo/contrib/repo.py +181 -0
  21. meteostat_cli-0.4.0/meteo/contrib/validation.py +236 -0
  22. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/utils.py +6 -3
  23. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/pyproject.toml +14 -2
  24. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/tests/conftest.py +4 -2
  25. meteostat_cli-0.4.0/tests/test_contrib.py +597 -0
  26. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/tests/test_utils.py +8 -0
  27. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/uv.lock +440 -96
  28. meteostat_cli-0.2.0/.claude/skills/meteo/examples.md +0 -72
  29. meteostat_cli-0.2.0/PKG-INFO +0 -254
  30. meteostat_cli-0.2.0/README.md +0 -227
  31. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/.github/workflows/lint.yml +0 -0
  32. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/.github/workflows/publish.yml +0 -0
  33. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/.github/workflows/test.yml +0 -0
  34. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/.gitignore +0 -0
  35. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/LICENSE +0 -0
  36. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/__init__.py +0 -0
  37. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/config.py +0 -0
  38. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/daily.py +0 -0
  39. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/hourly.py +0 -0
  40. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/inventory.py +0 -0
  41. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/monthly.py +0 -0
  42. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/nearby.py +0 -0
  43. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/commands/normals.py +0 -0
  44. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/meteo/plotting.py +0 -0
  45. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/tests/__init__.py +0 -0
  46. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/tests/test_cli.py +0 -0
  47. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/tests/test_commands.py +0 -0
  48. {meteostat_cli-0.2.0 → meteostat_cli-0.4.0}/tests/test_config.py +0 -0
@@ -5,34 +5,18 @@ description: Access weather and climate data for thousands of weather stations a
5
5
 
6
6
  # Meteo
7
7
 
8
- ## Usage
9
-
10
- If the `meteo` command is not found, install the tool using:
11
-
12
- ```bash
13
- uv tool install meteostat-cli
14
- ```
15
-
16
- Alternatively, you can use `uvx`:
17
-
18
- ```bash
19
- uvx --from meteostat-cli meteo
20
- ```
21
-
22
8
  ## Commands
23
9
 
24
- Run `meteo --help` to see a list of all available commands and options.
10
+ Meteo is a CLI tool, run `meteo --help` to see a list of all available commands and options.
25
11
 
26
12
  ## Gotchas
27
13
 
28
- - `meteo nearby` requires numeric `LAT,LON` argument — city names are not accepted. Use coordinates directly.
29
- - When looking for stations that match the elevation of a place, use `meteo nearby` without a radius and filter results by elevation.
14
+ - If the `meteo` command is not found, use uvx: `uvx meteostat-cli [YOUR_COMMAND]`
15
+ - `meteo nearby` requires numeric `LAT,LON` argument — city names are not accepted; use coordinates directly
16
+ - When looking for stations that match the elevation of a place, use `meteo nearby` without a radius and filter results by elevation
30
17
  - Pass multiple station IDs in one call instead of looping: `meteo daily D1424 EDEV0 10635 --start 2025 --end 2025`
31
18
  - Fetch only the columns you need with `--parameters` to eliminate post-processing: `--parameters tmax` or `--parameters tmax,prcp`
32
19
  - Aggregate all rows with `--agg` (Pandas `.agg()`): `--agg max`, `--agg mean`, `--agg sum`
33
20
  - `--start` and `--end` accept YYYY-MM-DD, YYYY-MM, YYYY
34
21
  - Machine-readable output for piping: `--format json` or `--format csv`
35
-
36
- ## Additional resources
37
-
38
- - For usage examples, see [examples.md](examples.md)
22
+ - To get the date of extreme values, fetch the parameter without aggregation and filter with `sort` after fetching: `meteo daily D1424 --start 2025-01-01 --end 2025-12-31 --parameters tmax -f csv | awk -F',' 'NR>1' | sort -t',' -k3 -rn | head -1`
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.5
2
+ Name: meteostat-cli
3
+ Version: 0.4.0
4
+ Summary: Access weather and climate data through the terminal.
5
+ Project-URL: Homepage, https://github.com/meteostat/cli
6
+ Project-URL: Repository, https://github.com/meteostat/cli
7
+ Project-URL: Issues, https://github.com/meteostat/cli/issues
8
+ Author-email: Meteostat <info@meteostat.net>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: cli,climate,meteostat,weather
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: meteostat<3,>=2.1.5
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: typer>=0.15.0
24
+ Provides-Extra: contrib
25
+ Requires-Dist: jsonschema>=4.20.0; extra == 'contrib'
26
+ Requires-Dist: pycountry>=24.6.1; extra == 'contrib'
27
+ Provides-Extra: plot
28
+ Requires-Dist: matplotlib>=3.9.0; extra == 'plot'
29
+ Provides-Extra: providers
30
+ Requires-Dist: lxml>=5.3.0; extra == 'providers'
31
+ Requires-Dist: metar>=1.11.0; extra == 'providers'
32
+ Description-Content-Type: text/markdown
33
+
34
+ <!-- PROJECT SHIELDS -->
35
+ <div align="center">
36
+
37
+ [![PyPI Version][pypi-shield]][pypi-url]
38
+ [![Issues][issues-shield]][issues-url]
39
+ [![MIT License][license-shield]][license-url]
40
+
41
+ </div>
42
+
43
+ <!-- PROJECT LOGO -->
44
+ <br />
45
+ <div align="center">
46
+ <a href="https://github.com/meteostat/cli">
47
+ <img src="https://media.meteostat.net/icon.svg" alt="Meteostat Logo" width="80" height="80">
48
+ </a>
49
+
50
+ <h3 align="center">Meteostat CLI</h3>
51
+
52
+ <p align="center">
53
+ Access weather and climate data through the terminal.
54
+ <p>
55
+ <a href="https://dev.meteostat.net/cli"><strong>Explore the docs »</strong></a>
56
+ </p>
57
+ <p>
58
+ <a href="https://meteostat.net">Visit Website</a>
59
+ &middot;
60
+ <a href="https://github.com/meteostat/cli/issues">Report Bug</a>
61
+ &middot;
62
+ <a href="https://github.com/orgs/meteostat/discussions">Request Feature</a>
63
+ </p>
64
+ </p>
65
+ </div>
66
+
67
+ ![](demo.gif)
68
+
69
+ ## 📚 Installation
70
+
71
+ ```bash
72
+ uv tool install meteostat-cli
73
+ ```
74
+
75
+ For plotting capabilities (`png` and `svg` output), install the `plot` extra:
76
+
77
+ ```bash
78
+ uv tool install "meteostat-cli[plot]"
79
+ ```
80
+
81
+ To [contribute to the weather stations directory](https://dev.meteostat.net/cli/stations/contributing) using `meteo station add`, `edit`, `validate` and `build`, install the `contrib` extra:
82
+
83
+ ```bash
84
+ uv tool install "meteostat-cli[contrib]"
85
+ ```
86
+
87
+ For full provider support, use:
88
+
89
+ ```bash
90
+ uv tool install "meteostat-cli[providers]"
91
+ ```
92
+
93
+ Alternatively, you can use `uvx`:
94
+
95
+ ```bash
96
+ uvx meteostat-cli [YOUR_COMMAND]
97
+ ```
98
+
99
+ ### ⚡ Shell Completion
100
+
101
+ ```bash
102
+ meteo --install-completion # Bash, Zsh, Fish, PowerShell
103
+ ```
104
+
105
+ ## 🚀 Usage
106
+
107
+ Want to know the hottest temperature of 2024 at Frankfurt Airport (station `10637`)? Run the following command:
108
+
109
+ ```bash
110
+ meteo daily 10637 -s 2024-01-01 -e 2024-12-31 -p tmax --agg max
111
+ ```
112
+
113
+ This will yield the following output:
114
+
115
+ ```
116
+ tmax
117
+ station
118
+ 10637 35.9
119
+ ```
120
+
121
+ ## 📖 Documentation
122
+
123
+ Please refer to the [official documentation](https://dev.meteostat.net/cli) for detailed usage instructions and examples.
124
+
125
+ ## 🤝 Contributing
126
+
127
+ Please read our [contributing guidelines](https://dev.meteostat.net/contributing) for details on how to contribute to Meteostat.
128
+
129
+ ### Local Development
130
+
131
+ ```bash
132
+ uv tool install --force -e ".[plot,contrib,providers]"
133
+ ```
134
+
135
+ You can now run the CLI locally using:
136
+
137
+ ```bash
138
+ meteo [YOUR_COMMAND]
139
+ ```
140
+
141
+ ## 📄 License
142
+
143
+ The Meteostat CLI is licensed under the [**MIT License**](https://github.com/meteostat/cli/blob/main/LICENSE). Data provided by Meteostat is licensed under [**Creative Commons Attribution 4.0 International (CC BY 4.0)**](https://creativecommons.org/licenses/by/4.0). See the [documentation](https://dev.meteostat.net/license) for details.
144
+
145
+ <!-- MARKDOWN LINKS & IMAGES -->
146
+
147
+ [pypi-shield]: https://img.shields.io/pypi/v/meteostat-cli
148
+ [pypi-url]: https://pypi.org/project/meteostat-cli/
149
+ [issues-shield]: https://img.shields.io/github/issues/meteostat/cli.svg
150
+ [issues-url]: https://github.com/meteostat/cli/issues
151
+ [license-shield]: https://img.shields.io/github/license/meteostat/cli.svg
152
+ [license-url]: https://github.com/meteostat/cli/blob/main/LICENSE
@@ -0,0 +1,119 @@
1
+ <!-- PROJECT SHIELDS -->
2
+ <div align="center">
3
+
4
+ [![PyPI Version][pypi-shield]][pypi-url]
5
+ [![Issues][issues-shield]][issues-url]
6
+ [![MIT License][license-shield]][license-url]
7
+
8
+ </div>
9
+
10
+ <!-- PROJECT LOGO -->
11
+ <br />
12
+ <div align="center">
13
+ <a href="https://github.com/meteostat/cli">
14
+ <img src="https://media.meteostat.net/icon.svg" alt="Meteostat Logo" width="80" height="80">
15
+ </a>
16
+
17
+ <h3 align="center">Meteostat CLI</h3>
18
+
19
+ <p align="center">
20
+ Access weather and climate data through the terminal.
21
+ <p>
22
+ <a href="https://dev.meteostat.net/cli"><strong>Explore the docs »</strong></a>
23
+ </p>
24
+ <p>
25
+ <a href="https://meteostat.net">Visit Website</a>
26
+ &middot;
27
+ <a href="https://github.com/meteostat/cli/issues">Report Bug</a>
28
+ &middot;
29
+ <a href="https://github.com/orgs/meteostat/discussions">Request Feature</a>
30
+ </p>
31
+ </p>
32
+ </div>
33
+
34
+ ![](demo.gif)
35
+
36
+ ## 📚 Installation
37
+
38
+ ```bash
39
+ uv tool install meteostat-cli
40
+ ```
41
+
42
+ For plotting capabilities (`png` and `svg` output), install the `plot` extra:
43
+
44
+ ```bash
45
+ uv tool install "meteostat-cli[plot]"
46
+ ```
47
+
48
+ To [contribute to the weather stations directory](https://dev.meteostat.net/cli/stations/contributing) using `meteo station add`, `edit`, `validate` and `build`, install the `contrib` extra:
49
+
50
+ ```bash
51
+ uv tool install "meteostat-cli[contrib]"
52
+ ```
53
+
54
+ For full provider support, use:
55
+
56
+ ```bash
57
+ uv tool install "meteostat-cli[providers]"
58
+ ```
59
+
60
+ Alternatively, you can use `uvx`:
61
+
62
+ ```bash
63
+ uvx meteostat-cli [YOUR_COMMAND]
64
+ ```
65
+
66
+ ### ⚡ Shell Completion
67
+
68
+ ```bash
69
+ meteo --install-completion # Bash, Zsh, Fish, PowerShell
70
+ ```
71
+
72
+ ## 🚀 Usage
73
+
74
+ Want to know the hottest temperature of 2024 at Frankfurt Airport (station `10637`)? Run the following command:
75
+
76
+ ```bash
77
+ meteo daily 10637 -s 2024-01-01 -e 2024-12-31 -p tmax --agg max
78
+ ```
79
+
80
+ This will yield the following output:
81
+
82
+ ```
83
+ tmax
84
+ station
85
+ 10637 35.9
86
+ ```
87
+
88
+ ## 📖 Documentation
89
+
90
+ Please refer to the [official documentation](https://dev.meteostat.net/cli) for detailed usage instructions and examples.
91
+
92
+ ## 🤝 Contributing
93
+
94
+ Please read our [contributing guidelines](https://dev.meteostat.net/contributing) for details on how to contribute to Meteostat.
95
+
96
+ ### Local Development
97
+
98
+ ```bash
99
+ uv tool install --force -e ".[plot,contrib,providers]"
100
+ ```
101
+
102
+ You can now run the CLI locally using:
103
+
104
+ ```bash
105
+ meteo [YOUR_COMMAND]
106
+ ```
107
+
108
+ ## 📄 License
109
+
110
+ The Meteostat CLI is licensed under the [**MIT License**](https://github.com/meteostat/cli/blob/main/LICENSE). Data provided by Meteostat is licensed under [**Creative Commons Attribution 4.0 International (CC BY 4.0)**](https://creativecommons.org/licenses/by/4.0). See the [documentation](https://dev.meteostat.net/license) for details.
111
+
112
+ <!-- MARKDOWN LINKS & IMAGES -->
113
+
114
+ [pypi-shield]: https://img.shields.io/pypi/v/meteostat-cli
115
+ [pypi-url]: https://pypi.org/project/meteostat-cli/
116
+ [issues-shield]: https://img.shields.io/github/issues/meteostat/cli.svg
117
+ [issues-url]: https://github.com/meteostat/cli/issues
118
+ [license-shield]: https://img.shields.io/github/license/meteostat/cli.svg
119
+ [license-url]: https://github.com/meteostat/cli/blob/main/LICENSE
Binary file
@@ -0,0 +1,266 @@
1
+ # The configurations that used for the recording, feel free to edit them
2
+ config:
3
+
4
+ # Specify a command to be executed
5
+ # like `/bin/bash -l`, `ls`, or any other commands
6
+ # the default is bash for Linux
7
+ # or powershell.exe for Windows
8
+ command: bash -l
9
+
10
+ # Specify the current working directory path
11
+ # the default is the current working directory path
12
+ cwd: /Users/chris/Meteostat/cli
13
+
14
+ # Export additional ENV variables
15
+ env:
16
+ recording: true
17
+
18
+ # Explicitly set the number of columns
19
+ # or use `auto` to take the current
20
+ # number of columns of your shell
21
+ cols: 120
22
+
23
+ # Explicitly set the number of rows
24
+ # or use `auto` to take the current
25
+ # number of rows of your shell
26
+ rows: 20
27
+
28
+ # Amount of times to repeat GIF
29
+ # If value is -1, play once
30
+ # If value is 0, loop indefinitely
31
+ # If value is a positive number, loop n times
32
+ repeat: -1
33
+
34
+ # Quality
35
+ # 1 - 100
36
+ quality: 100
37
+
38
+ # Delay between frames in ms
39
+ # If the value is `auto` use the actual recording delays
40
+ frameDelay: auto
41
+
42
+ # Maximum delay between frames in ms
43
+ # Ignored if the `frameDelay` isn't set to `auto`
44
+ # Set to `auto` to prevent limiting the max idle time
45
+ maxIdleTime: 2000
46
+
47
+ # The surrounding frame box
48
+ # The `type` can be null, window, floating, or solid`
49
+ # To hide the title use the value null
50
+ # Don't forget to add a backgroundColor style with a null as type
51
+ frameBox:
52
+ type: null
53
+ title: Meteostat
54
+ style:
55
+ border: 0px black solid
56
+ backgroundColor: "#1D1D1D"
57
+ # boxShadow: none
58
+ padding: 10px
59
+
60
+ # Add a watermark image to the rendered gif
61
+ # You need to specify an absolute path for
62
+ # the image on your machine or a URL, and you can also
63
+ # add your own CSS styles
64
+ watermark:
65
+ imagePath: null
66
+ style:
67
+ position: absolute
68
+ right: 15px
69
+ bottom: 15px
70
+ width: 100px
71
+ opacity: 0.9
72
+
73
+ # Cursor style can be one of
74
+ # `block`, `underline`, or `bar`
75
+ cursorStyle: block
76
+
77
+ # Font family
78
+ # You can use any font that is installed on your machine
79
+ # in CSS-like syntax
80
+ fontFamily: "Monaco, Lucida Console, Ubuntu Mono, Monospace"
81
+
82
+ # The size of the font
83
+ fontSize: 14
84
+
85
+ # The height of lines
86
+ lineHeight: 1
87
+
88
+ # The spacing between letters
89
+ letterSpacing: 0
90
+
91
+ # Theme
92
+ theme:
93
+ background: "transparent"
94
+ foreground: "#afafaf"
95
+ cursor: "#c7c7c7"
96
+ black: "#232628"
97
+ red: "#fc4384"
98
+ green: "#b3e33b"
99
+ yellow: "#ffa727"
100
+ blue: "#75dff2"
101
+ magenta: "#ae89fe"
102
+ cyan: "#708387"
103
+ white: "#d5d5d0"
104
+ brightBlack: "#626566"
105
+ brightRed: "#ff7fac"
106
+ brightGreen: "#c8ed71"
107
+ brightYellow: "#ebdf86"
108
+ brightBlue: "#75dff2"
109
+ brightMagenta: "#ae89fe"
110
+ brightCyan: "#b1c6ca"
111
+ brightWhite: "#f9f9f4"
112
+
113
+ # Records, feel free to edit them
114
+ records:
115
+ - delay: 151
116
+ content: "$ "
117
+ - delay: 200
118
+ content: m
119
+ - delay: 220
120
+ content: e
121
+ - delay: 103
122
+ content: t
123
+ - delay: 100
124
+ content: e
125
+ - delay: 200
126
+ content: o
127
+ - delay: 167
128
+ content: ' '
129
+ - delay: 100
130
+ content: 'n'
131
+ - delay: 150
132
+ content: e
133
+ - delay: 90
134
+ content: a
135
+ - delay: 200
136
+ content: r
137
+ - delay: 150
138
+ content: b
139
+ - delay: 140
140
+ content: 'y'
141
+ - delay: 110
142
+ content: ' '
143
+ - delay: 200
144
+ content: '5'
145
+ - delay: 170
146
+ content: '0'
147
+ - delay: 100
148
+ content: ','
149
+ - delay: 200
150
+ content: '8'
151
+ - delay: 138
152
+ content: .
153
+ - delay: 209
154
+ content: '6'
155
+ - delay: 200
156
+ content: "\r\n"
157
+ - delay: 103
158
+ content: " name country region latitude longitude elevation timezone distance\r\nid \r\nEDFE0 Egelsbach / Erzhausen DE HE 49.9620 8.6447 117 Europe/Berlin 5298.1\r\n10637 Frankfurt Airport DE HE 50.0500 8.6000 111 Europe/Berlin 5559.7\r\nD4090 Raunheim DE HE 50.0056 8.4291 89 Europe/Berlin 12230.2\r\nD0917 Darmstadt DE HE 49.8809 8.6779 162 Europe/Berlin 14368.8\r\nD1424 Frankfurt Westend DE HE 50.1269 8.6694 124 Europe/Berlin 14954.9\r\n"
159
+ - delay: 38
160
+ content: "$ "
161
+ - delay: 1011
162
+ content: m
163
+ - delay: 168
164
+ content: e
165
+ - delay: 137
166
+ content: t
167
+ - delay: 100
168
+ content: e
169
+ - delay: 200
170
+ content: o
171
+ - delay: 100
172
+ content: ' '
173
+ - delay: 200
174
+ content: d
175
+ - delay: 90
176
+ content: a
177
+ - delay: 200
178
+ content: i
179
+ - delay: 109
180
+ content: l
181
+ - delay: 200
182
+ content: 'y'
183
+ - delay: 123
184
+ content: ' '
185
+ - delay: 200
186
+ content: '1'
187
+ - delay: 200
188
+ content: '0'
189
+ - delay: 188
190
+ content: '6'
191
+ - delay: 150
192
+ content: '3'
193
+ - delay: 174
194
+ content: '7'
195
+ - delay: 145
196
+ content: ' '
197
+ - delay: 200
198
+ content: '-'
199
+ - delay: 130
200
+ content: '-'
201
+ - delay: 200
202
+ content: s
203
+ - delay: 150
204
+ content: t
205
+ - delay: 158
206
+ content: a
207
+ - delay: 142
208
+ content: r
209
+ - delay: 90
210
+ content: t
211
+ - delay: 130
212
+ content: ' '
213
+ - delay: 200
214
+ content: '2'
215
+ - delay: 150
216
+ content: '0'
217
+ - delay: 140
218
+ content: '2'
219
+ - delay: 200
220
+ content: '0'
221
+ - delay: 171
222
+ content: ' '
223
+ - delay: 200
224
+ content: '-'
225
+ - delay: 88
226
+ content: '-'
227
+ - delay: 130
228
+ content: e
229
+ - delay: 200
230
+ content: 'n'
231
+ - delay: 170
232
+ content: d
233
+ - delay: 100
234
+ content: ' '
235
+ - delay: 200
236
+ content: '2'
237
+ - delay: 200
238
+ content: '0'
239
+ - delay: 150
240
+ content: '2'
241
+ - delay: 90
242
+ content: '5'
243
+ - delay: 119
244
+ content: ' '
245
+ - delay: 200
246
+ content: '-'
247
+ - delay: 124
248
+ content: '-'
249
+ - delay: 200
250
+ content: a
251
+ - delay: 140
252
+ content: g
253
+ - delay: 130
254
+ content: g
255
+ - delay: 150
256
+ content: ' '
257
+ - delay: 130
258
+ content: m
259
+ - delay: 120
260
+ content: a
261
+ - delay: 150
262
+ content: x
263
+ - delay: 250
264
+ content: "\r\n"
265
+ - delay: 733
266
+ content: " temp tmin tmax rhum prcp snwd wspd wpgt pres tsun cldc\r\nstation \r\n10637 30.1 22.6 38.4 100 62.5 60 39.6 126.0 1047.5 942 8\r\n"
@@ -1,3 +1,3 @@
1
1
  """Meteostat CLI — Access weather and climate data through the terminal."""
2
2
 
3
- __version__ = "0.2.0"
3
+ __version__ = "0.4.0"
@@ -35,20 +35,46 @@ def callback(
35
35
  apply_config()
36
36
 
37
37
 
38
+ STATION_EPILOG = (
39
+ "Contributor commands: add, edit, delete, validate, duplicates, build. "
40
+ "Run 'meteo station COMMAND --help' for details."
41
+ )
42
+
43
+
38
44
  def _register_commands() -> None:
39
45
  """Register all command modules with the Typer app."""
40
46
  from meteo.commands.config import config_cmd
47
+ from meteo.commands.contrib.add import add_cmd
48
+ from meteo.commands.contrib.build import build_cmd
49
+ from meteo.commands.contrib.delete import delete_cmd
50
+ from meteo.commands.contrib.duplicates import duplicates_cmd
51
+ from meteo.commands.contrib.edit import edit_cmd
52
+ from meteo.commands.contrib.validate import validate_cmd
41
53
  from meteo.commands.daily import daily_cmd, daily_cmd_alias
42
54
  from meteo.commands.hourly import hourly_cmd, hourly_cmd_alias
43
55
  from meteo.commands.inventory import inventory_cmd, inventory_cmd_alias
44
56
  from meteo.commands.monthly import monthly_cmd, monthly_cmd_alias
45
57
  from meteo.commands.nearby import nearby_cmd
46
58
  from meteo.commands.normals import normals_cmd, normals_cmd_alias
47
- from meteo.commands.station import station_cmd
59
+ from meteo.commands.station import LookupCommand, StationGroup, station_cmd
60
+
61
+ station_app = typer.Typer(cls=StationGroup)
62
+ station_app.command(
63
+ StationGroup.default_command,
64
+ cls=LookupCommand,
65
+ hidden=True,
66
+ epilog=STATION_EPILOG,
67
+ )(station_cmd)
68
+ station_app.command("add")(add_cmd)
69
+ station_app.command("edit")(edit_cmd)
70
+ station_app.command("delete")(delete_cmd)
71
+ station_app.command("validate")(validate_cmd)
72
+ station_app.command("duplicates")(duplicates_cmd)
73
+ station_app.command("build")(build_cmd)
48
74
 
49
75
  app.command("config")(config_cmd)
50
- app.command("station")(station_cmd)
51
- app.command("s", hidden=True)(station_cmd)
76
+ app.add_typer(station_app, name="station", help=station_cmd.__doc__)
77
+ app.add_typer(station_app, name="s", hidden=True)
52
78
  app.command("nearby")(nearby_cmd)
53
79
  app.command("inventory")(inventory_cmd)
54
80
  app.command("i", hidden=True)(inventory_cmd_alias)
@@ -0,0 +1,44 @@
1
+ """Contributor commands for the weather stations repository."""
2
+
3
+ from typing import Any
4
+
5
+ import typer
6
+
7
+ from meteo.contrib.validation import Report
8
+
9
+ REPO_HELP = "Path to the stations repository (overrides stations_repo)."
10
+
11
+
12
+ def echo_report(report: Report, quiet: bool = False) -> None:
13
+ """Print the validation result of a station."""
14
+ for error in report.errors:
15
+ typer.echo(f"{typer.style('✗', fg='red')} {report.station_id} {error}")
16
+ for warning in report.warnings:
17
+ typer.echo(f"{typer.style('!', fg='yellow')} {report.station_id} {warning}")
18
+ if report.valid and not report.warnings and not quiet:
19
+ typer.echo(f"{typer.style('✓', fg='green')} {report.station_id}")
20
+
21
+
22
+ def plural(count: int, word: str) -> str:
23
+ return f"{count} {word}" if count == 1 else f"{count} {word}s"
24
+
25
+
26
+ def print_station(data: dict[str, Any]) -> None:
27
+ """Print a station record in the same way as `meteo station ID`."""
28
+ from meteo.commands.station import print_metadata
29
+
30
+ location = data.get("location") or {}
31
+ names = data.get("name") or {}
32
+ print_metadata(
33
+ {
34
+ "id": data.get("id"),
35
+ "name": names.get("en"),
36
+ "country": data.get("country"),
37
+ "region": data.get("region"),
38
+ "latitude": location.get("latitude"),
39
+ "longitude": location.get("longitude"),
40
+ "elevation": location.get("elevation"),
41
+ "timezone": data.get("timezone"),
42
+ **(data.get("identifiers") or {}),
43
+ }
44
+ )