rsplot 0.3.1.dev3__py3-none-any.whl → 0.3.2.dev37__py3-none-any.whl

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 (71) hide show
  1. rsplot/atomic.py +36 -0
  2. rsplot/cli.py +282 -469
  3. rsplot/commands/common.py +113 -1
  4. rsplot/commands/fnr.py +389 -104
  5. rsplot/commands/forecast.py +24 -7
  6. rsplot/commands/meteo.py +499 -186
  7. rsplot/commands/overlay.py +292 -205
  8. rsplot/commands/radius.py +526 -0
  9. rsplot/commands/raster.py +479 -230
  10. rsplot/commands/reconstruct.py +27 -6
  11. rsplot/commands/sidecar.py +106 -0
  12. rsplot/commands/station.py +154 -42
  13. rsplot/commands/station_trend.py +259 -174
  14. rsplot/config.py +46 -16
  15. rsplot/data_files.py +253 -0
  16. rsplot/errors.py +43 -0
  17. rsplot/fnr.py +38 -46
  18. rsplot/geo/boundaries.py +317 -11
  19. rsplot/geo/footprints.py +205 -0
  20. rsplot/geo/processing.py +84 -5
  21. rsplot/geo/radius.py +205 -0
  22. rsplot/plotting/colormap_22.txt +256 -0
  23. rsplot/plotting/colormaps.py +24 -29
  24. rsplot/plotting/map_frame.py +203 -9
  25. rsplot/plotting/meteo.py +10 -3
  26. rsplot/plotting/overlay.py +36 -40
  27. rsplot/plotting/raster.py +15 -3
  28. rsplot/plotting/station.py +86 -33
  29. rsplot/plotting/station_focus.py +84 -0
  30. rsplot/plotting/station_trend.py +60 -47
  31. rsplot/plotting/styles.py +3 -5
  32. rsplot/readers/__init__.py +89 -7
  33. rsplot/readers/_tropomi.py +121 -3
  34. rsplot/readers/base.py +16 -1
  35. rsplot/readers/era5.py +110 -10
  36. rsplot/readers/era5_wind.py +3 -2
  37. rsplot/readers/gems.py +429 -0
  38. rsplot/readers/guokong.py +125 -39
  39. rsplot/readers/netcdf.py +32 -0
  40. rsplot/readers/tropomi_hcho.py +1 -1
  41. rsplot/readers/tropomi_no2.py +1 -1
  42. rsplot/readers/tropomi_nrti.py +116 -0
  43. rsplot/readers/tropomi_o3.py +1 -1
  44. rsplot/readers/tropomi_o3pr.py +1 -1
  45. rsplot/result_builders/__init__.py +0 -14
  46. rsplot/result_builders/common.py +84 -0
  47. rsplot/result_builders/envelope.py +236 -0
  48. rsplot/result_builders/fnr.py +47 -131
  49. rsplot/result_builders/forecast.py +7 -0
  50. rsplot/result_builders/provenance.py +59 -0
  51. rsplot/result_builders/reconstruct.py +7 -0
  52. rsplot/result_builders/satellite.py +240 -0
  53. rsplot/result_builders/series_layer.py +289 -0
  54. rsplot/result_builders/station.py +23 -0
  55. rsplot/result_builders/station_layer.py +326 -0
  56. rsplot/results.py +0 -12
  57. rsplot/schemas/result.schema.json +566 -0
  58. rsplot/temporal.py +146 -16
  59. rsplot-0.3.2.dev37.dist-info/METADATA +996 -0
  60. rsplot-0.3.2.dev37.dist-info/RECORD +76 -0
  61. {rsplot-0.3.1.dev3.dist-info → rsplot-0.3.2.dev37.dist-info}/WHEEL +1 -1
  62. rsplot/commands/recent.py +0 -164
  63. rsplot/recent.py +0 -404
  64. rsplot/result_builders/meteo.py +0 -171
  65. rsplot/result_builders/overlay.py +0 -75
  66. rsplot/result_builders/raster.py +0 -72
  67. rsplot/result_builders/station_trend.py +0 -229
  68. rsplot-0.3.1.dev3.dist-info/METADATA +0 -477
  69. rsplot-0.3.1.dev3.dist-info/RECORD +0 -64
  70. {rsplot-0.3.1.dev3.dist-info → rsplot-0.3.2.dev37.dist-info}/entry_points.txt +0 -0
  71. {rsplot-0.3.1.dev3.dist-info → rsplot-0.3.2.dev37.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,996 @@
1
+ Metadata-Version: 2.5
2
+ Name: rsplot
3
+ Version: 0.3.2.dev37
4
+ Summary: CLI tool for plotting Remote Sensing data, designed for Agent.
5
+ Project-URL: Repository, https://git.lug.ustc.edu.cn/yaoyhu/rsplot
6
+ Project-URL: GitHub, https://github.com/yaoyhu/rsplot
7
+ Author-email: Yaoyao Hu <yaoyhu@mail.ustc.edu.cn>
8
+ License: Apache License
9
+ Version 2.0, January 2004
10
+ http://www.apache.org/licenses/
11
+
12
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
13
+
14
+ 1. Definitions.
15
+
16
+ "License" shall mean the terms and conditions for use, reproduction,
17
+ and distribution as defined by Sections 1 through 9 of this document.
18
+
19
+ "Licensor" shall mean the copyright owner or entity authorized by
20
+ the copyright owner that is granting the License.
21
+
22
+ "Legal Entity" shall mean the union of the acting entity and all
23
+ other entities that control, are controlled by, or are under common
24
+ control with that entity. For the purposes of this definition,
25
+ "control" means (i) the power, direct or indirect, to cause the
26
+ direction or management of such entity, whether by contract or
27
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
28
+ outstanding shares, or (iii) beneficial ownership of such entity.
29
+
30
+ "You" (or "Your") shall mean an individual or Legal Entity
31
+ exercising permissions granted by this License.
32
+
33
+ "Source" form shall mean the preferred form for making modifications,
34
+ including but not limited to software source code, documentation
35
+ source, and configuration files.
36
+
37
+ "Object" form shall mean any form resulting from mechanical
38
+ transformation or translation of a Source form, including but
39
+ not limited to compiled object code, generated documentation,
40
+ and conversions to other media types.
41
+
42
+ "Work" shall mean the work of authorship, whether in Source or
43
+ Object form, made available under the License, as indicated by a
44
+ copyright notice that is included in or attached to the work
45
+ (an example is provided in the Appendix below).
46
+
47
+ "Derivative Works" shall mean any work, whether in Source or Object
48
+ form, that is based on (or derived from) the Work and for which the
49
+ editorial revisions, annotations, elaborations, or other modifications
50
+ represent, as a whole, an original work of authorship. For the purposes
51
+ of this License, Derivative Works shall not include works that remain
52
+ separable from, or merely link (or bind by name) to the interfaces of,
53
+ the Work and Derivative Works thereof.
54
+
55
+ "Contribution" shall mean any work of authorship, including
56
+ the original version of the Work and any modifications or additions
57
+ to that Work or Derivative Works thereof, that is intentionally
58
+ submitted to Licensor for inclusion in the Work by the copyright owner
59
+ or by an individual or Legal Entity authorized to submit on behalf of
60
+ the copyright owner. For the purposes of this definition, "submitted"
61
+ means any form of electronic, verbal, or written communication sent
62
+ to the Licensor or its representatives, including but not limited to
63
+ communication on electronic mailing lists, source code control systems,
64
+ and issue tracking systems that are managed by, or on behalf of, the
65
+ Licensor for the purpose of discussing and improving the Work, but
66
+ excluding communication that is conspicuously marked or otherwise
67
+ designated in writing by the copyright owner as "Not a Contribution."
68
+
69
+ "Contributor" shall mean Licensor and any individual or Legal Entity
70
+ on behalf of whom a Contribution has been received by Licensor and
71
+ subsequently incorporated within the Work.
72
+
73
+ 2. Grant of Copyright License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ copyright license to reproduce, prepare Derivative Works of,
77
+ publicly display, publicly perform, sublicense, and distribute the
78
+ Work and such Derivative Works in Source or Object form.
79
+
80
+ 3. Grant of Patent License. Subject to the terms and conditions of
81
+ this License, each Contributor hereby grants to You a perpetual,
82
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
83
+ (except as stated in this section) patent license to make, have made,
84
+ use, offer to sell, sell, import, and otherwise transfer the Work,
85
+ where such license applies only to those patent claims licensable
86
+ by such Contributor that are necessarily infringed by their
87
+ Contribution(s) alone or by combination of their Contribution(s)
88
+ with the Work to which such Contribution(s) was submitted. If You
89
+ institute patent litigation against any entity (including a
90
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
91
+ or a Contribution incorporated within the Work constitutes direct
92
+ or contributory patent infringement, then any patent licenses
93
+ granted to You under this License for that Work shall terminate
94
+ as of the date such litigation is filed.
95
+
96
+ 4. Redistribution. You may reproduce and distribute copies of the
97
+ Work or Derivative Works thereof in any medium, with or without
98
+ modifications, and in Source or Object form, provided that You
99
+ meet the following conditions:
100
+
101
+ (a) You must give any other recipients of the Work or
102
+ Derivative Works a copy of this License; and
103
+
104
+ (b) You must cause any modified files to carry prominent notices
105
+ stating that You changed the files; and
106
+
107
+ (c) You must retain, in the Source form of any Derivative Works
108
+ that You distribute, all copyright, patent, trademark, and
109
+ attribution notices from the Source form of the Work,
110
+ excluding those notices that do not pertain to any part of
111
+ the Derivative Works; and
112
+
113
+ (d) If the Work includes a "NOTICE" text file as part of its
114
+ distribution, then any Derivative Works that You distribute must
115
+ include a readable copy of the attribution notices contained
116
+ within such NOTICE file, excluding those notices that do not
117
+ pertain to any part of the Derivative Works, in at least one
118
+ of the following places: within a NOTICE text file distributed
119
+ as part of the Derivative Works; within the Source form or
120
+ documentation, if provided along with the Derivative Works; or,
121
+ within a display generated by the Derivative Works, if and
122
+ wherever such third-party notices normally appear. The contents
123
+ of the NOTICE file are for informational purposes only and
124
+ do not modify the License. You may add Your own attribution
125
+ notices within Derivative Works that You distribute, alongside
126
+ or as an addendum to the NOTICE text from the Work, provided
127
+ that such additional attribution notices cannot be construed
128
+ as modifying the License.
129
+
130
+ You may add Your own copyright statement to Your modifications and
131
+ may provide additional or different license terms and conditions
132
+ for use, reproduction, or distribution of Your modifications, or
133
+ for any such Derivative Works as a whole, provided Your use,
134
+ reproduction, and distribution of the Work otherwise complies with
135
+ the conditions stated in this License.
136
+
137
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
138
+ any Contribution intentionally submitted for inclusion in the Work
139
+ by You to the Licensor shall be under the terms and conditions of
140
+ this License, without any additional terms or conditions.
141
+ Notwithstanding the above, nothing herein shall supersede or modify
142
+ the terms of any separate license agreement you may have executed
143
+ with Licensor regarding such Contributions.
144
+
145
+ 6. Trademarks. This License does not grant permission to use the trade
146
+ names, trademarks, service marks, or product names of the Licensor,
147
+ except as required for reasonable and customary use in describing the
148
+ origin of the Work and reproducing the content of the NOTICE file.
149
+
150
+ 7. Disclaimer of Warranty. Unless required by applicable law or
151
+ agreed to in writing, Licensor provides the Work (and each
152
+ Contributor provides its Contributions) on an "AS IS" BASIS,
153
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
154
+ implied, including, without limitation, any warranties or conditions
155
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
156
+ PARTICULAR PURPOSE. You are solely responsible for determining the
157
+ appropriateness of using or redistributing the Work and assume any
158
+ risks associated with Your exercise of permissions under this License.
159
+
160
+ 8. Limitation of Liability. In no event and under no legal theory,
161
+ whether in tort (including negligence), contract, or otherwise,
162
+ unless required by applicable law (such as deliberate and grossly
163
+ negligent acts) or agreed to in writing, shall any Contributor be
164
+ liable to You for damages, including any direct, indirect, special,
165
+ incidental, or consequential damages of any character arising as a
166
+ result of this License or out of the use or inability to use the
167
+ Work (including but not limited to damages for loss of goodwill,
168
+ work stoppage, computer failure or malfunction, or any and all
169
+ other commercial damages or losses), even if such Contributor
170
+ has been advised of the possibility of such damages.
171
+
172
+ 9. Accepting Warranty or Additional Liability. While redistributing
173
+ the Work or Derivative Works thereof, You may choose to offer,
174
+ and charge a fee for, acceptance of support, warranty, indemnity,
175
+ or other liability obligations and/or rights consistent with this
176
+ License. However, in accepting such obligations, You may act only
177
+ on Your own behalf and on Your sole responsibility, not on behalf
178
+ of any other Contributor, and only if You agree to indemnify,
179
+ defend, and hold each Contributor harmless for any liability
180
+ incurred by, or claims asserted against, such Contributor by reason
181
+ of your accepting any such warranty or additional liability.
182
+
183
+ END OF TERMS AND CONDITIONS
184
+
185
+ APPENDIX: How to apply the Apache License to your work.
186
+
187
+ To apply the Apache License to your work, attach the following
188
+ boilerplate notice, with the fields enclosed by brackets "[]"
189
+ replaced with your own identifying information. (Don't include
190
+ the brackets!) The text should be enclosed in the appropriate
191
+ comment syntax for the file format. We also recommend that a
192
+ file or class name and description of purpose be included on the
193
+ same "printed page" as the copyright notice for easier
194
+ identification within third-party archives.
195
+
196
+ Copyright [yyyy] [name of copyright owner]
197
+
198
+ Licensed under the Apache License, Version 2.0 (the "License");
199
+ you may not use this file except in compliance with the License.
200
+ You may obtain a copy of the License at
201
+
202
+ http://www.apache.org/licenses/LICENSE-2.0
203
+
204
+ Unless required by applicable law or agreed to in writing, software
205
+ distributed under the License is distributed on an "AS IS" BASIS,
206
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
207
+ See the License for the specific language governing permissions and
208
+ limitations under the License.
209
+ License-File: LICENSE
210
+ Classifier: Intended Audience :: Developers
211
+ Classifier: Programming Language :: Python :: 3
212
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
213
+ Requires-Python: <3.14,>=3.10
214
+ Requires-Dist: astropy>=5.3
215
+ Requires-Dist: cartopy>=0.21
216
+ Requires-Dist: geopandas>=0.13
217
+ Requires-Dist: matplotlib>=3.7
218
+ Requires-Dist: netcdf4>=1.7.3
219
+ Requires-Dist: numpy>=1.24
220
+ Requires-Dist: pyproj>=3.1
221
+ Requires-Dist: rich>=13.0.0
222
+ Requires-Dist: scipy>=1.10
223
+ Requires-Dist: shapely>=2.0
224
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
225
+ Requires-Dist: typer>=0.9.0
226
+ Requires-Dist: xarray>=2023.0
227
+ Description-Content-Type: text/markdown
228
+
229
+ # rsplot
230
+
231
+ `rsplot` is a command-line tool for agents to analyze multi-source
232
+ spatiotemporal remote-sensing and air-quality data: TROPOMI and GEMS
233
+ satellite retrievals, national monitoring stations and ERA5. Each command
234
+ writes a machine-readable JSON result with statistics,
235
+ quality flags and data files, plus a map for inspection. It provides a
236
+ small, stable CLI surface for
237
+ [tianpu-agent](https://git.lug.ustc.edu.cn/yaoyhu/tianpu-agent).
238
+
239
+
240
+ ## Installation
241
+
242
+ Run directly with `uvx`:
243
+
244
+ ```bash
245
+ uvx rsplot --help
246
+ ```
247
+
248
+ Or install it in a project environment:
249
+
250
+ ```bash
251
+ uv add rsplot
252
+ uv run rsplot --help
253
+ ```
254
+
255
+ ### Development releases
256
+
257
+ Every push to `main` publishes a PEP 440 development release such as
258
+ `0.3.1.dev4`. Stable installs continue to ignore these releases. To follow the
259
+ latest development build, opt in once:
260
+
261
+ ```bash
262
+ uv tool install rsplot --prerelease allow
263
+ uv tool upgrade rsplot
264
+ ```
265
+
266
+ The prerelease setting is retained by later `uv tool upgrade` commands.
267
+
268
+ For local development:
269
+
270
+ ```bash
271
+ git clone https://github.com/yaoyhu/rsplot.git
272
+ cd rsplot
273
+ uv sync
274
+ uv run rsplot --help
275
+ ```
276
+
277
+ ## Configuration
278
+
279
+ Satellite HCHO, O3, and O3PR use the bundled `colormap_22.txt` by
280
+ default; NO2 uses the built-in nine-color gradient. These defaults apply to
281
+ both TROPOMI and GEMS. Use `--cmap` to select another registered colormap.
282
+
283
+ `rsplot` does not ship site-specific data paths. Configure local satellite,
284
+ station, boundary, and font paths with a TOML file:
285
+
286
+ ```bash
287
+ mkdir -p ~/.config/rsplot
288
+ cp config.example.toml ~/.config/rsplot/config.toml
289
+ ```
290
+
291
+ Then edit `~/.config/rsplot/config.toml`:
292
+
293
+ ```toml
294
+ [paths]
295
+ geojson_dir = "/path/to/geojson"
296
+ font_dir = "/path/to/fonts"
297
+
298
+ [paths.data_dirs]
299
+ no2 = "/path/to/NO2"
300
+ o3 = "/path/to/O3"
301
+ o3pr = "/path/to/O3PR"
302
+ hcho = "/path/to/HCHO"
303
+ guokong = "/path/to/guokong_combine"
304
+ era5 = "/path/to/era5"
305
+ forecast = "/path/to/forecast"
306
+ reconstruct = "/path/to/reconstruct"
307
+
308
+ # Optional lower-level boundary override for a direct-administered city.
309
+ # [subdivision_overrides."中山市"]
310
+ # path = "/path/to/中山市镇街界线.shp"
311
+ # name_field = "镇街名称"
312
+ # level = "township"
313
+
314
+ # Optional satellite basemap key. Leave commented unless you have a real key.
315
+ # [tianditu]
316
+ # api_key = "your-real-key"
317
+ ```
318
+
319
+ You can also point to a different config file:
320
+
321
+ ```bash
322
+ export RSPLOT_CONFIG="/path/to/rsplot.toml"
323
+ ```
324
+
325
+ Environment variables override TOML values:
326
+
327
+ ```bash
328
+ export TIANDITU_API_KEY="your-key"
329
+ export RSPLOT_GEOJSON_DIR="/path/to/geojson"
330
+ export RSPLOT_FONT_DIR="/path/to/fonts"
331
+ export RSPLOT_DATA_DIR_NO2="/path/to/NO2"
332
+ export RSPLOT_DATA_DIR_O3="/path/to/O3"
333
+ export RSPLOT_DATA_DIR_O3PR="/path/to/O3PR"
334
+ export RSPLOT_DATA_DIR_HCHO="/path/to/HCHO"
335
+ export RSPLOT_DATA_DIR_GUOKONG="/path/to/guokong_combine"
336
+ export RSPLOT_DATA_DIR_ERA5="/path/to/era5"
337
+ export RSPLOT_DATA_DIR_FORECAST="/path/to/forecast"
338
+ export RSPLOT_DATA_DIR_RECONSTRUCT="/path/to/reconstruct"
339
+ ```
340
+
341
+ Data folders come from configuration only; commands have no directory
342
+ options. If no TianDiTu API key is configured, use `--basemap none`
343
+ to avoid requesting satellite tiles.
344
+
345
+ City subdivision overrides replace the county layer only for the configured
346
+ city. Their source CRS is converted to the CRS of the standard city boundary.
347
+ This lets direct-administered towns or streets appear in maps and spatial
348
+ summaries, and makes qualified inputs such as `中山/板芙` resolvable.
349
+
350
+ ## Usage
351
+
352
+ The examples below assume data paths are configured and readable.
353
+
354
+ ```bash
355
+ # Show available commands and options.
356
+ rsplot --help
357
+
358
+ # Plot a single-day TROPOMI raster.
359
+ rsplot raster 合肥 20260115 --product no2 --output ./logs/hcho/raster_city_jiujiang_hcho.png
360
+
361
+ # Plot a 30-day TROPOMI window mean.
362
+ rsplot raster 安徽 20260131 --product hcho --days 30 --output hcho_anhui_202601.png
363
+
364
+ # Plot a TROPOMI ozone-profile tropospheric column raster.
365
+ rsplot raster 安徽 20260227 --product o3pr --output o3pr_anhui_20260227.png
366
+
367
+ # Plot an explicit TROPOMI date range.
368
+ rsplot raster 长三角 20260101-20260131 --product no2 --output no2_yrd_202601.png
369
+
370
+ # Plot ERA5 2 m temperature. Input hours are China standard time; rsplot
371
+ # converts them to the matching UTC archive day and hour automatically.
372
+ # meteo needs an exact China-time hour (YYYYMMDDHH) in every mode. Each
373
+ # layer writes a data file, e.g. meteo_nanjing_t2m.temperature.nc.
374
+ rsplot meteo 南京 2026051115 --temp-level 2m --output meteo_nanjing_t2m.png
375
+
376
+ # Plot black 850 hPa wind arrows; length represents speed and no wind
377
+ # colorbar is drawn. The reference arrow gives the speed scale.
378
+ rsplot meteo 南京 2026051115 --wind-level 850 --output meteo_nanjing_wind850.png
379
+
380
+ # Overlay black wind arrows on a temperature background. Only the temperature
381
+ # colorbar is drawn.
382
+ rsplot meteo 南京 2026051115 --temp-level 850 \
383
+ --wind-level 850 --output meteo_nanjing_t850_wind850.png
384
+
385
+ # Overlay station observations with black wind arrows.
386
+ rsplot meteo 南京 2026051115 --station-var O3 \
387
+ --wind-level 850 --output meteo_nanjing_o3_wind850.png
388
+
389
+ # Temperature, stations, and wind can be combined. The two colorbars describe
390
+ # temperature and station concentration; wind magnitude is encoded by length.
391
+ rsplot meteo 南京 2026051115 --temp-level 850 --station-var O3 \
392
+ --wind-level 850 --output meteo_nanjing_t850_o3_wind850.png
393
+
394
+ # Plot national monitoring station observations at an explicit China-time hour.
395
+ rsplot station 合肥 2026041415 --var O3 --output station_hefei_o3.png
396
+
397
+ # Plot one station's hourly observations over the latest seven days.
398
+ rsplot trend 3347A 20260520 --days 7 --var O3 --output trend_3347A_o3_7d.png
399
+
400
+ # A single day and an explicit date range are also supported.
401
+ rsplot trend 3347A 20260520 --days 1 --var O3 --output trend_3347A_o3_day.png
402
+ rsplot trend 3347A 20260501-20260507 --var PM2.5 --output trend_3347A_pm25.png
403
+
404
+ # Plot all regional stations as grey lines plus the hourly station mean.
405
+ rsplot trend 重庆 20260520 --days 7 --var O3 --region --output trend_chongqing_o3.png
406
+
407
+ # Plot only the regional mean and highlight one or more explicit stations.
408
+ rsplot trend 重庆 20260520 --days 7 --var O3 --region --view mean \
409
+ --focus-station 3347A --threshold 200 --output trend_chongqing_focus.png
410
+ # Each trend also writes <name>.series.nc: value(station, time), whose
411
+ # time decodes to the requested hours, plus regional_mean and n_stations
412
+ # in region mode. The
413
+ # sidecar's station (or regional_mean) layer adds `daily` rows (hours, mean,
414
+ # min, max per China-time day) and 24 `diurnal` rows (mean per hour of day).
415
+
416
+ # Overlay satellite raster data and station observations.
417
+ rsplot overlay 合肥 20260414 --product no2 --station-var NO2 \
418
+ --station-datetime 2026041413 --output overlay_hefei_no2.png
419
+
420
+ # Plot an FNR regime map over the 7 days ending on a date. The sidecar has
421
+ # no2, hcho and fnr layers (regime counts in the fnr layer's categories),
422
+ # with fnr_hefei.no2.nc, fnr_hefei.hcho.nc and fnr_hefei.fnr.nc.
423
+ rsplot fnr 合肥 20260114 --days 7 --output fnr_hefei.png
424
+
425
+ # Plot an FNR regime map with an explicit date range.
426
+ rsplot fnr 长三角 20260101-20260130 --output fnr_yrd_202601.png
427
+
428
+ # Override FNR regime thresholds for agent-driven sensitivity tests.
429
+ rsplot fnr 合肥 20260114 --days 7 --voc-threshold 0.8 --nox-threshold 1.8 \
430
+ --display-max 5 --output fnr_hefei_sensitivity.png
431
+ ```
432
+
433
+ `--output` is required and must name a `.png` file (case-insensitive),
434
+ not a directory. Invalid output paths are rejected before reading data or
435
+ writing artifacts. `rsplot` writes the image to that exact path and a JSON
436
+ sidecar with the same base name. Nothing that selects data is implied:
437
+ `--product` (satellite maps), `--var` (`station`, `trend`), `--station-var`
438
+ (`overlay`) and the window length (`--days` with a single end date for
439
+ `trend` and `fnr`, or a `YYYYMMDD-YYYYMMDD` range) must be given.
440
+
441
+ Regions are named in Chinese; there is no `--level` option and no pinyin.
442
+ A full name selects its own level (`吉林市` is the city, `吉林省` the
443
+ province). A short name that fits different places at two levels, such as
444
+ `吉林` or `海南` (海南省 and 海南藏族自治州), is rejected with error code
445
+ `region_ambiguous` and the candidate full names. Autonomous areas can be
446
+ named without their ethnic groups: `广西`, `新疆`, `宁夏`, `楚雄`. 北京市, 上海市 and 天津市 are mapped as cities and 重庆市 as a
447
+ province. Counties and townships are written with their city, e.g.
448
+ `合肥/蜀山`. `中国`/`China` and the key regions (`长三角`/`YRD`, `京津冀`/`BTH`,
449
+ `珠三角`/`PRD`, `成渝`/`SCB`) are also accepted.
450
+
451
+ ### Result sidecars
452
+
453
+ Every successful command writes the agent-oriented sidecar specified in
454
+ [docs/result-schema.md](docs/result-schema.md) and validated by the shipped
455
+ JSON Schema `src/rsplot/schemas/result.schema.json`. `rsplot_version` names
456
+ the release that wrote it; there is no separate format number.
457
+
458
+ ```bash
459
+ rsplot raster 合肥 20260919 --product no2 --days 7 --output out/hefei_no2_week.png
460
+ # out/hefei_no2_week.png image
461
+ # out/hefei_no2_week.json sidecar
462
+ # out/hefei_no2_week.satellite.nc statistical grid: value, counted, valid_days
463
+ ```
464
+
465
+ | Question an agent asks | Where to read it |
466
+ | --- | --- |
467
+ | Did it work? | Exit 0 and a sidecar; on failure exit 1 and one `rsplot error <code>` line on stderr |
468
+ | How far can I trust it? | `layers[0].coverage` and `quality.flags` (code, severity and the measured `evidence`; no prose verdict) |
469
+ | What was measured, in which unit? | `layers[0].quantity` (`unit` and `scale`) |
470
+ | Over which time? | `layers[0].time`, including `days` for windows |
471
+ | From which files? | `layers[0].source` (`data_root`, `files_total`, `failed_files`; names are not listed) |
472
+ | How was it processed? | `layers[0].method` |
473
+ | Regional result | `layers[0].coverage`, `stats`, `by_admin`, `by_member`, `extremes` |
474
+ | Full values | the NetCDF in `layers[0].data` / `artifacts.data` |
475
+ | How to reproduce it | `request`, the command on one line; effective values that change the numbers are in `method` |
476
+
477
+ A failed run exits 1, prints one line such as
478
+ `rsplot error region_ambiguous: … {"region": "吉林", "candidates": ["吉林省", "吉林市"]}`
479
+ on stderr, and leaves no PNG, JSON or data file. For example, the real
480
+ Hefei 7-day NO2 window above
481
+ covers only 2.9 % of the city's cells, so it carries a critical
482
+ `very_low_coverage` flag with evidence `valid` 35, `total` 1209, `fraction`
483
+ 0.029 and `threshold` 0.1.
484
+
485
+ The `forecast` and `reconstruct` commands are disabled and no longer part of
486
+ the CLI. Their `forecast` and `reconstruct` data-directory keys remain valid
487
+ in configuration but are unused.
488
+
489
+ `station REGION YYYYMMDDHH` requires an exact hour in China standard time
490
+ (`Asia/Shanghai`). Date-only input (`YYYYMMDD`), invalid dates, and hours outside
491
+ 00–23 are rejected with exit code 1 before configuration or data access.
492
+ The command reads only the requested hour; it never selects the latest hour
493
+ or falls back to another file when that hour is missing. Existing date-only
494
+ `station` calls must supply an explicit hour. Its sidecar
495
+ has one `station` layer (statistics over in-region stations, exceedances,
496
+ per-district rows, and AQI bands in `categories` for AQI) and a
497
+ `<name>.station.csv` listing every station read around the region with
498
+ `in_region`.
499
+
500
+ ## Raster dates and temporal aggregation
501
+
502
+ `rsplot raster REGION DATE` defaults to TROPOMI. `DATE` selects satellite
503
+ observations, not a ground-station hour:
504
+
505
+ | Input | TROPOMI | GEMS (`--sensor gems`) |
506
+ | --- | --- | --- |
507
+ | `YYYYMMDD` | Merge matching orbit files for that filename date, then grid their pixels | Equal-scan daily mean for that date in China standard time |
508
+ | `YYYYMMDD --days N` | Average daily grids over N days ending on DATE, including DATE | Average daily scan means over the same inclusive window |
509
+ | `YYYYMMDD-YYYYMMDD` | Average daily grids over the inclusive date range | Average daily scan means over the inclusive date range |
510
+ | `YYYYMMDDHHMM` | Not supported | One exact nominal scan in China standard time |
511
+
512
+ A date range and `--days` cannot be used together. TROPOMI dates match the
513
+ UTC start date in standard S5P filenames; they do not select an hourly
514
+ observation or convert a China-time day into an observation-time window.
515
+ Without `--processing`, all matching files in the selected directory are
516
+ eligible. `--processing nrti` restricts selection to NRTI and deduplicates
517
+ overlapping observations using orbit, observation time and ground-pixel ID.
518
+
519
+ TROPOMI processing filters QA/clouds and invalid values, converts units, and
520
+ averages pixels in each target grid cell. Window mode grids each day, then
521
+ averages valid daily values with equal day weights. Statistics, coverage,
522
+ extremes, station colocation and the `.satellite.nc` data file use observed
523
+ cells only, for every sensor and time mode. Gap filling and smoothing are
524
+ display-only: a single TROPOMI day fills small gaps (nearest neighbour
525
+ within 3 cells) in the image alone, and `--smooth` never changes a number in
526
+ the sidecar. `render.layers.satellite` records `display_gap_fill` and
527
+ `display_smoothing_sigma`.
528
+
529
+ A window keeps every cell with at least one valid day: its value is the
530
+ mean of that cell's valid daily values, each weighted equally. Missing or
531
+ invalid days are skipped, never treated as zero-valued observations, and a
532
+ cell with no valid day stays nodata. There is no minimum-valid-days option;
533
+ `time.days.valid_days_per_cell` in the sidecar shows how many days support
534
+ each cell, and missing days are recorded in `time.days.failed`.
535
+
536
+ `raster` always saves an image, a same-basename JSON sidecar and a
537
+ `<name>.satellite.nc` data file. Use `-o` for an explicit PNG path; otherwise
538
+ files are saved under `/tmp`.
539
+
540
+ ## Satellite and station overlays
541
+
542
+ `rsplot overlay REGION DATE` draws one satellite layer and one hour of
543
+ national monitoring-station observations on the same map. `DATE` selects
544
+ satellite time exactly as `raster` does, including `YYYYMMDD-YYYYMMDD`,
545
+ `--days N`, and GEMS `YYYYMMDDHHMM` scans. TROPOMI remains daily:
546
+ the orbits for one filename date are merged, and there is no hourly
547
+ TROPOMI selector.
548
+
549
+ Station observations are always one concrete China-time hour, never a
550
+ temporal mean. rsplot never picks the latest available hour and never falls
551
+ back to another file.
552
+
553
+ | Satellite request | Station hour |
554
+ | --- | --- |
555
+ | TROPOMI day or window | `--station-datetime YYYYMMDDHH` is required |
556
+ | GEMS daily mean or window | `--station-datetime YYYYMMDDHH` is required |
557
+ | GEMS scan `YYYYMMDDHHMM` | Nearest station hour (at most 30 minutes, ties forward); `--station-datetime` overrides it |
558
+
559
+ ```bash
560
+ # TROPOMI 7-day NO2 mean with 13:00 China-time station observations.
561
+ rsplot overlay 合肥 20260919 --product no2 --days 7 --station-var NO2 \
562
+ --station-datetime 2026091913 --output overlay_hefei_no2_week.png
563
+ ```
564
+
565
+ `--station-var` is required and names the station variable explicitly;
566
+ there is no product-to-station-variable default.
567
+ Satellite columns and station concentrations keep independent colorbars and
568
+ units; the map shows spatial juxtaposition, not a column-to-surface
569
+ conversion.
570
+
571
+ The sidecar has two layers. `satellite` is the same layer
572
+ `raster` writes, with its period in `time` (calendar days, like every rsplot
573
+ time in China time). `station` holds the station hour in
574
+ `time.at`, statistics over in-region stations, exceedances against the
575
+ variable's limit, and per-district rows. Next to the image are
576
+ `<name>.satellite.nc` and `<name>.station.csv`; the CSV lists every station
577
+ read around the region with `in_region`, its value, and the satellite value
578
+ of the cell it falls in.
579
+
580
+ `relations.time_matching` says how the two times were paired:
581
+ `nominal_scan_time` for GEMS scans (with the difference in minutes),
582
+ `daily_mean_with_explicit_station_hour` for GEMS daily means, and
583
+ `period_mean_with_explicit_station_hour` for TROPOMI days and all windows
584
+ (difference null, because a daily or window mean has no single observation
585
+ time). `relations.colocation` counts stations that fall in a valid satellite
586
+ cell and gives the Spearman rank correlation of satellite and station values
587
+ (null with fewer than 3 pairs). It measures spatial agreement only;
588
+ `comparable_units` is always false.
589
+
590
+ ## Station map color scales
591
+
592
+ Station layers in `station`, `overlay`, `meteo`, and
593
+ `radius --station-var` share fixed O3 and NO2 color scales. Concentrations
594
+ at or below the threshold use a green–yellow–orange gradient. Values strictly
595
+ above the threshold are red, including values beyond the colorbar maximum;
596
+ a red upper extension marks this overflow. Equality is not exceedance.
597
+
598
+ | Station variable | Threshold (μg/m³) | Colorbar range (μg/m³) |
599
+ | --- | --- | --- |
600
+ | `O3_8h`, `O3_8h_24h` (8h O3 / MDA8 O3) | 160 | 0–180 |
601
+ | `O3` (hourly) | 200 | 0–220 |
602
+ | `O3_24h` (existing hourly-limit mapping) | 200 | 0–220 |
603
+ | `NO2` (hourly) | 200 | 0–220 |
604
+ | `NO2_24h` (daily) | 80 | 0–100 |
605
+
606
+ AQI retains its existing discrete bands. Other station variables retain their
607
+ P5–P95 scales. These station rules do not change satellite or temperature
608
+ colorbars. No station `--vmin` or `--vmax` options are added.
609
+ Fixed station-scale metadata appears in `render.layers.station` for
610
+ `station`, `overlay`, `radius` and `meteo`.
611
+ Original observations, summary statistics and exceedance counts are preserved.
612
+
613
+ ## Satellite maps around a monitoring station
614
+
615
+ `radius STATION_ID DATE --km KM` draws a square centered on a national
616
+ monitoring station, extending KM kilometers north, south, east, and west.
617
+ For example, `--km 5` produces a 10 km × 10 km square in a station-centered
618
+ WGS84 azimuthal equidistant projection. All stations within the square,
619
+ including its corners, use the same markers and ID labels. The square fills
620
+ the map axes without exterior padding or an extra dashed outline. City boundaries
621
+ and county/township names remain visible across administrative borders;
622
+ configured city-specific township layers are reused.
623
+
624
+ ```bash
625
+ # GEMS daily satellite mean, station locations from one explicit hour
626
+ uv run rsplot radius 1379A 20260907 --km 5 \
627
+ --sensor gems --product no2 --station-datetime 2026090713 \
628
+ --output /tmp/radius_positions.png
629
+
630
+ # The same satellite mean plus ONE station observation hour
631
+ uv run rsplot radius 1379A 20260907 --km 5 \
632
+ --sensor gems --product no2 \
633
+ --station-var NO2 --station-datetime 2026090713 \
634
+ --output /tmp/radius_no2.png
635
+
636
+ # Exact GEMS scan: 12:45 China time matches the 13:00 station file
637
+ uv run rsplot radius 1379A 202609071245 --km 5 \
638
+ --sensor gems --product no2 --station-var NO2 \
639
+ --output /tmp/radius_scan.png
640
+ ```
641
+
642
+ - `--km` is required and accepts positive fractional kilometers measured
643
+ from the center to each side, not the full side length. Satellite
644
+ options (`--sensor`, `--product`, `--days`, `--res`, `--cf`,
645
+ `--qa`, color limits and smoothing) follow `raster`. Defaults are
646
+ TROPOMI/O3, county product plotting settings, and `--basemap none`.
647
+ - Without `--station-var`, only station IDs and coordinates are read, from
648
+ the hour given by the required `--station-datetime YYYYMMDDHH`; rsplot
649
+ never picks the latest hour. No pollutant field is needed.
650
+ - With `--station-var`, daily/window satellite maps require an explicit
651
+ station hour. GEMS exact scans automatically match the nearest hour,
652
+ with half-hour ties rounded forward; an explicit hour overrides this.
653
+ Missing hourly files are errors, not a request to select another hour.
654
+ - Station observations are **never averaged across hours**. `NO2`, `O3`,
655
+ `PM2.5`, `PM10`, `SO2`, `CO`, `AQI`, and the existing derived fields are
656
+ supported. Fields such as `O3_8h` are read as stored in the selected file.
657
+ The station archive and satellite files come from the configured
658
+ `guokong` and product folders.
659
+ - GEMS dates mean equal-weight averages of the day's available valid scans,
660
+ not a 24-hour mean. Actual scan counts vary; archive filenames are UTC,
661
+ while command dates and station hours are China time. Titles distinguish
662
+ satellite aggregation from the selected station hour. Scan matching uses
663
+ the nominal scan time, not each pixel's actual observation time.
664
+ - Satellite and station values have independent colorbars and units.
665
+ Missing station values retain hollow location markers. No extra center
666
+ ring or lower-right legend is drawn. No station colorbar is drawn when all
667
+ observations are missing.
668
+ - Statistics count strictly interior grid centers; intersecting valid cells
669
+ are displayed and clipped to the square. GEMS defaults to 0.05° and `--res`
670
+ changes both analysis and display spacing. Small squares can contain no grid
671
+ centers while still showing portions of intersecting cells: counts are
672
+ then zero and statistical summaries null. Coverage is a center count,
673
+ not a fraction of polygon area.
674
+
675
+ A PNG, a sidecar, `<name>.satellite.nc` and
676
+ `<name>.station.csv` are saved (under `/tmp` by default). The region has
677
+ `kind: station_radius` and a `radius` block: `center_station`, centre
678
+ coordinates, `km` (the centre-to-side distance), `side_length_km` (twice
679
+ that), `shape: square`, and `administrative_context` (cities containing the
680
+ centre, visible cities and subdivisions). The `satellite` layer matches
681
+ `raster`. The `station` layer is `location` without `--station-var` (no
682
+ values, no relations) or the chosen variable with statistics, exceedances,
683
+ `relations.time_matching` and `relations.colocation`, as for `overlay`. The
684
+ station CSV lists the stations in the square with `is_center`,
685
+ `distance_km` (geodesic, so corner stations can exceed `--km`) and the
686
+ east/north offsets `dx_km`/`dy_km` used for selection. Daily/window versus
687
+ hourly comparisons have a null time difference; scan comparisons record the
688
+ nominal time difference.
689
+
690
+ ## Select multiple regions without configuration
691
+
692
+ `raster`, `overlay`, `station`, `meteo` and `fnr` accept a quoted,
693
+ comma-separated region argument.
694
+ Use English or Chinese commas; surrounding whitespace and embedded line
695
+ breaks are ignored in a list. Province, city, and qualified county/township
696
+ names can be mixed. County and township names still require their city,
697
+ e.g. `中山市/东区街道`. `trend --region` summarizes one region per run
698
+ and rejects a list; run it once per region.
699
+
700
+ ```bash
701
+ # One map covering three selected townships.
702
+ uv run rsplot raster \
703
+ "中山市/东区街道,中山市/南区街道,中山市/石岐街道" 20260907 \
704
+ --sensor gems --product o3pr --cf 1 --res 0.075 --smooth 0 \
705
+ --basemap none --output ./logs/zhongshan/three_streets_raster.png
706
+
707
+ # The same daily satellite field with observations at 19:00 China time.
708
+ uv run rsplot overlay \
709
+ "中山市/东区街道,中山市/南区街道,中山市/石岐街道" 20260907 \
710
+ --sensor gems --product o3pr --station-var O3_8h_24h \
711
+ --station-datetime 2026090719 \
712
+ --cf 1 --res 0.075 --smooth 0 --basemap none \
713
+ --output ./logs/zhongshan/three_streets_overlay.png
714
+ ```
715
+
716
+ These examples use your configured product/station data paths; no named
717
+ region group needs to be added to configuration.
718
+
719
+ Every member is resolved before reading data. Repeated aliases are removed
720
+ in first-occurrence order; empty items and unknown names fail with an explicit
721
+ error instead of silently omitting regions. The map reads and processes the
722
+ combined extent once, but colors only the union of the selected geometries,
723
+ preserving holes and gaps between disconnected regions. Each member retains
724
+ its boundary and label. Defaults use the coarsest selected level; combined
725
+ maps use automatic geographic ticks. Explicit plot options still take
726
+ precedence. Far-apart selections share one map with intervening whitespace.
727
+
728
+ Combined maps use `联合区域(N个)` as their default name. The JSON adds
729
+ `region.members` with canonical qualified names, administrative levels and
730
+ extents. Existing overall statistics operate on the geometric union, without
731
+ double-counting parent/child overlaps. `raster` summarizes each selected
732
+ member in the satellite layer's `by_member`, using that same statistical grid;
733
+ overlay also adds `by_member` to its station layer. A member with no valid data
734
+ remains in the list with zero valid counts and null numeric summaries.
735
+ Members may overlap, so their counts must not be added to recover the union
736
+ count. Grid centers exactly on a member boundary are excluded from that
737
+ member's statistics, even if they lie inside the combined region. Station
738
+ selection retains the existing boundary-tolerance rule. `spatial_summary`
739
+ continues to describe subdivisions, independently of selected-member stats.
740
+ Single-region inputs retain their existing output contract.
741
+
742
+ ## Raster boundaries and regional statistics
743
+
744
+ `raster` and `overlay` prepare separate display and statistics grids:
745
+
746
+ - **Display:** retain valid grid cells that intersect the administrative
747
+ geometry, even when their centers are outside. Clip the colored layer to
748
+ the actual boundary, including holes and disconnected islands. Display
749
+ smoothing uses surrounding values but preserves the input valid-cell mask.
750
+ - **Statistics:** select grid centers **strictly inside** the geometry;
751
+ centers exactly on the boundary are excluded. Each valid selected cell has
752
+ equal weight. Coverage is the valid selected-cell count divided by the
753
+ total selected-cell count, not the percentage of colored land area.
754
+ Statistics use the observed grid: no gap filling and no smoothing.
755
+
756
+ `raster` records the statistics rules in the satellite layer's `method`
757
+ (`cell_selection`, `cell_weighting`) and the display rules in
758
+ `render.layers.satellite` (`display_selection`, `display_clip`,
759
+ `display_valid_cells`); `overlay` and `radius` record the same fields for
760
+ their satellite layer.
761
+ A small region can display overlapping cells while having no interior grid
762
+ centers: its statistics then report zero valid cells and null summaries.
763
+ This change does not increase the satellite's native resolution or fill
764
+ missing observations.
765
+
766
+ ## TROPOMI NRTI processing stream
767
+
768
+ Use `--processing nrti` with `raster`, `radius`, `overlay`, or `fnr`.
769
+ Keep `--sensor tropomi` for commands with
770
+ a sensor option; FNR is already TROPOMI-only and has no sensor option. All four
771
+ products are supported: `no2`, `hcho`, `o3`, and `o3pr`. Omitting
772
+ `--processing` preserves the existing directories and reading behavior.
773
+ The NRTI option cannot be combined with GEMS.
774
+
775
+ Configure independent archive roots under `[paths.data_dirs]`:
776
+
777
+ ```toml
778
+ [paths.data_dirs]
779
+ tropomi_nrti_no2 = "/path/to/NO2/NRT"
780
+ tropomi_nrti_hcho = "/path/to/HCHO/NRT"
781
+ tropomi_nrti_o3 = "/path/to/O3/NRT"
782
+ tropomi_nrti_o3pr = "/path/to/O3PR/NRT"
783
+ ```
784
+
785
+ The corresponding environment variables are `RSPLOT_DATA_DIR_TROPOMI_NRTI_NO2`,
786
+ `RSPLOT_DATA_DIR_TROPOMI_NRTI_HCHO`, `RSPLOT_DATA_DIR_TROPOMI_NRTI_O3`, and
787
+ `RSPLOT_DATA_DIR_TROPOMI_NRTI_O3PR`. Missing NRTI configuration or files
788
+ produce an error; rsplot does not fall back to another processing stream.
789
+
790
+ Each root directly contains `S5P_NRTI_L2__*.nc` or `.nc.zip` files. The checked
791
+ NRT archive's `.nc.zip` files are HDF5/NetCDF containers despite the extension;
792
+ rsplot opens them directly, without ZIP extraction. Dates retain the existing
793
+ TROPOMI filename-start-date selection in UTC. NRTI does not introduce an
794
+ hourly satellite selector; overlay/radius station-hour rules stay unchanged.
795
+
796
+ ```bash
797
+ rsplot raster 安徽 20260918 --product no2 --processing nrti \
798
+ --basemap none --output /tmp/anhui_no2_nrti.png
799
+
800
+ rsplot overlay 安徽 20260918 --product no2 --processing nrti \
801
+ --station-var NO2 --station-datetime 2026091812 --basemap none --output /tmp/anhui_no2_nrti_overlay.png
802
+
803
+ rsplot radius 1379A 20260918 --km 20 --product no2 --processing nrti \
804
+ --station-var NO2 --station-datetime 2026091812 \
805
+ --basemap none --output /tmp/station_no2_nrti.png
806
+
807
+ rsplot fnr 安徽 20260917-20260919 --processing nrti --n-min 1 \
808
+ --basemap none --output /tmp/anhui_fnr_nrti.png
809
+ ```
810
+
811
+ NRTI uses the existing TROPOMI QA/cloud filters, unit conversions, plotting
812
+ settings and statistical masks. Before gridding, overlapping granules are
813
+ deduplicated by orbit, UTC observation time and ground-pixel index. Among
814
+ valid copies of an observation, the newest file production time wins; ties
815
+ use ascending filename order. Observations from different orbits remain
816
+ separate. Negative valid retrievals remain available to the existing science
817
+ rules. Missing identity fields cause a file failure, not unverified merging.
818
+
819
+ Daily grids average the deduplicated pixels; windows weight valid daily grids
820
+ equally. FNR still averages NO2 and HCHO separately before division. The latest
821
+ date may contain only the granules received so far: a successful read does not
822
+ mean the archive contains a complete day, and results can change as files arrive.
823
+
824
+ In `raster` and `overlay` sidecars, NRTI appears as
825
+ `source.processing: "nrti"`, with the deduplication rule and
826
+ `duplicates_removed` in the satellite layer's `method`. The other commands'
827
+ sidecars identify `sensor: "tropomi"` and `processing: "nrti"`. Swath/daily metadata records source files, failed
828
+ files, processor/product versions, retained observation time range, valid
829
+ pixel counts before and after deduplication, and `n_duplicates_removed`.
830
+ Window results retain daily diagnostics; FNR records `window.daily_no2` and
831
+ `window.daily_hcho`. Default titles and output filenames identify NRTI;
832
+ explicit `--title` and `--output` still take precedence.
833
+
834
+ ## GEMS satellite products
835
+
836
+ Use `--sensor gems` with `raster`, `radius`, and `overlay`. Omitting
837
+ `--sensor` retains TROPOMI behavior. GEMS FNR and satellite trend curves are
838
+ not included in this release.
839
+
840
+ Configure the three archive roots in `[paths.data_dirs]`:
841
+
842
+ ```toml
843
+ gems_no2 = "/path/to/GEMS/NO2"
844
+ gems_hcho = "/path/to/GEMS/HCHO"
845
+ gems_o3 = "/path/to/GEMS/O3"
846
+ ```
847
+
848
+ Alternatively set `RSPLOT_DATA_DIR_GEMS_NO2`, `RSPLOT_DATA_DIR_GEMS_HCHO`,
849
+ and `RSPLOT_DATA_DIR_GEMS_O3`. Each root contains `YYYYMM/DD/*.nc`.
850
+
851
+ | Product | GEMS variable | Display unit |
852
+ | --- | --- | --- |
853
+ | `no2` | `Data Fields/ColumnAmountNO2Trop` | 10¹⁵ molecules/cm² |
854
+ | `hcho` | `Data Fields/ColumnAmount` | 10¹⁵ molecules/cm² |
855
+ | `o3` | `product/total_ozone_column` | DU |
856
+ | `o3pr` | `product/troposphere_ozone_column` | DU |
857
+
858
+ Both ozone quantities use the O3P files in `gems_o3`; `o3pr` reads the
859
+ provided tropospheric column without reintegrating the profile. Neither
860
+ quantity represents surface ozone concentration.
861
+
862
+ GEMS dates and scan requests use **Asia/Shanghai**. `YYYYMMDDHHMM` selects
863
+ an exact nominal scan; `YYYYMMDD` computes the day's valid-scan mean.
864
+ For example, `202609010845` selects the `20260901_0045` UTC archive scan.
865
+ The filename is the nominal scan time, not a simultaneous observation time
866
+ for every pixel: GEMS scans begin at :45 UTC and take about 30 minutes
867
+ ([NESC operation schedule](https://nesc.nier.go.kr/en/html/satellite/operation.do)).
868
+ Missing scan requests report available local times instead of selecting a
869
+ replacement. Duplicate files for one nominal scan are rejected; use a root
870
+ containing one archive version.
871
+
872
+ ```bash
873
+ # Exact scan, daily mean, and multi-day mean.
874
+ rsplot raster 安徽 202609011145 --sensor gems --product no2 \
875
+ --basemap none --output /tmp/gems_no2_scan.png
876
+ rsplot raster 安徽 20260901 --sensor gems --product hcho \
877
+ --basemap none --output /tmp/gems_hcho_daily.png
878
+ rsplot raster 安徽 20260901-20260902 --sensor gems --product o3pr \
879
+ --basemap none --output /tmp/gems_o3pr_window.png
880
+
881
+ # 11:45 China-time scan with observations at the nearest hour, 12:00.
882
+ rsplot overlay 安徽 202609011145 --sensor gems --product no2 \
883
+ --station-var NO2 --basemap none --output /tmp/gems_no2_overlay.png
884
+ # Use --station-datetime YYYYMMDDHH for an intentional time override.
885
+ ```
886
+
887
+ Each scan is first remapped by pixel/target overlap area in the equal-area
888
+ EPSG:6933 projection, directly onto a **globally aligned target grid selected
889
+ by `--res`**. GEMS defaults to 0.05° at every administrative level. This is
890
+ numerical grid spacing, not native satellite resolution; finer grids cannot
891
+ recover variation within a native pixel. Daily means
892
+ weight valid scans equally at each grid cell; multi-day means then weight
893
+ valid days equally. A daily cell needs at least one valid scan, and a window
894
+ cell at least one valid day. These are means of available daytime scans,
895
+ not full 24-hour means. Empty scans and failed files do not contribute zeros.
896
+
897
+ For GEMS `raster`, `radius`, and `overlay`, **`--res` controls the actual
898
+ analysis grid**. No fixed 0.05° intermediate grid is used. Raster and overlay
899
+ draw that grid directly, clipped to its valid-cell union and the administrative
900
+ boundary. Changing `--res` may change grid-center selection, coverage, and
901
+ regional statistics; use the same spacing for comparisons. `--smooth` affects
902
+ display only and preserves the target grid's valid mask; statistics remain
903
+ unfilled and unsmoothed. DPI and map graticules are independent of grid spacing.
904
+ TROPOMI keeps its existing resolution behavior.
905
+
906
+ For example, compare Zhongshan O3PR at two target spacings without smoothing:
907
+
908
+ ```bash
909
+ rsplot raster 中山市 20260907 --sensor gems --product o3pr --cf 1 \
910
+ --res 0.05 --smooth 0 --basemap none --output /tmp/gems_o3pr_res005.png
911
+ rsplot raster 中山市 20260907 --sensor gems --product o3pr --cf 1 \
912
+ --res 0.01 --smooth 0 --basemap none --output /tmp/gems_o3pr_res001.png
913
+ ```
914
+
915
+ When available, GEMS pixel boundaries use file `CornerLongitude` and
916
+ `CornerLatitude` arrays. The checked O3P and NO2 files have centers only;
917
+ their quadrilateral boundaries are **estimates from adjacent unfiltered
918
+ native centers**, with linear extrapolation at the outer scan edge. Missing
919
+ geolocation is not interpolated, and rejected retrievals do not contribute
920
+ values. This is not a recovery of official footprints or extra observations.
921
+ Analysis cells need positive-area overlap with valid footprints; their
922
+ coverage percentage counts valid analysis centers, not precisely observed
923
+ land area. Gaps smaller than the selected target cells remain unresolved.
924
+
925
+ Sidecars record `footprint_source` per scan, `spatial_aggregation`,
926
+ `area_crs`, `analysis_resolution_deg`, `display_resolution_deg`, and
927
+ `display_support`. The compatibility `swath.resolution_deg` describes the
928
+ analysis grid; `analysis_resolution_deg` and `display_resolution_deg` both
929
+ record the selected target spacing. `display_support` is `analysis_valid_cells`.
930
+ Statistics may change with `--res`, but remain unchanged by smoothing or DPI.
931
+
932
+ The initial GEMS filter retains final quality flag **0**, finite coordinates
933
+ and columns, SZA/VZA below 70°, and a nonnegative cloud measure no greater
934
+ than `--cf` (default 0.5). The cloud measures differ: NO2 uses `CloudFraction`,
935
+ HCHO uses `CloudRadianceFraction`, and O3P uses `effective_cloud_fraction`.
936
+ `--qa` applies only to TROPOMI and is rejected for GEMS. Quality-filtered
937
+ negative columns are retained; HCHO gap-filled flag classes are excluded.
938
+ This explicit filter is recorded with each file's version and variable in
939
+ JSON; quality flag meanings must not be transferred between products.
940
+
941
+ In `raster` and `overlay` sidecars, GEMS scan counts, footprint source, area CRS and
942
+ spatial aggregation are in the satellite layer's `method`, and the scan or
943
+ day in its `time`; the field names in this section describe the other
944
+ commands' sidecars.
945
+
946
+ GEMS JSON statistics, spatial summaries, and hotspots use the **unfilled,
947
+ unsmoothed** regional grid. Smoothing affects the map only and cannot create
948
+ new valid cells. Sidecars include `sensor`, `quantity`, the requested local
949
+ time, nominal UTC/local scan times, actual observation time ranges, filter
950
+ settings, file failures, and scan-count summaries. Window metadata retains
951
+ per-day diagnostics. Existing TROPOMI fields remain compatible; the boundary
952
+ policy block described above is additive.
953
+
954
+ GEMS `overlay` accepts an exact scan, a daily mean or a window. Station-hour
955
+ rules, default station variables and `time_matching` are described in
956
+ [Satellite and station overlays](#satellite-and-station-overlays).
957
+
958
+ ## License
959
+
960
+ This project is distributed under the license in `LICENSE`.
961
+
962
+ ## Publishing
963
+
964
+ The package version is derived from Git by `hatch-vcs`; do not add a static
965
+ `project.version` or make version-bump commits. The latest `vX.Y.Z` tag is the
966
+ stable version. Commits after it build as the next patch development series:
967
+
968
+ ```text
969
+ v0.3.0 -> 0.3.0
970
+ first commit -> 0.3.1.dev1
971
+ second commit -> 0.3.1.dev2
972
+ v0.3.1 -> 0.3.1
973
+ ```
974
+
975
+ GitHub Actions publishes every `main` push through the `pypi-dev` environment
976
+ and every `v*` tag through `pypi`. Configure two PyPI Trusted Publishers with
977
+ the same owner, repository, and workflow, differing only by environment:
978
+
979
+ ```text
980
+ Owner: yaoyhu
981
+ Repository: rsplot
982
+ Workflow: publish.yml
983
+ Environment: pypi-dev
984
+ Environment: pypi
985
+ ```
986
+
987
+ Leave `pypi-dev` automatic for continuous development uploads. Protect the
988
+ `pypi` GitHub environment with required reviewers so stable releases need an
989
+ explicit approval.
990
+
991
+ To make a stable release after the desired commit is on GitHub:
992
+
993
+ ```bash
994
+ git tag -a v0.3.1 -m v0.3.1
995
+ git push github v0.3.1
996
+ ```