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.
- rsplot/atomic.py +36 -0
- rsplot/cli.py +282 -469
- rsplot/commands/common.py +113 -1
- rsplot/commands/fnr.py +389 -104
- rsplot/commands/forecast.py +24 -7
- rsplot/commands/meteo.py +499 -186
- rsplot/commands/overlay.py +292 -205
- rsplot/commands/radius.py +526 -0
- rsplot/commands/raster.py +479 -230
- rsplot/commands/reconstruct.py +27 -6
- rsplot/commands/sidecar.py +106 -0
- rsplot/commands/station.py +154 -42
- rsplot/commands/station_trend.py +259 -174
- rsplot/config.py +46 -16
- rsplot/data_files.py +253 -0
- rsplot/errors.py +43 -0
- rsplot/fnr.py +38 -46
- rsplot/geo/boundaries.py +317 -11
- rsplot/geo/footprints.py +205 -0
- rsplot/geo/processing.py +84 -5
- rsplot/geo/radius.py +205 -0
- rsplot/plotting/colormap_22.txt +256 -0
- rsplot/plotting/colormaps.py +24 -29
- rsplot/plotting/map_frame.py +203 -9
- rsplot/plotting/meteo.py +10 -3
- rsplot/plotting/overlay.py +36 -40
- rsplot/plotting/raster.py +15 -3
- rsplot/plotting/station.py +86 -33
- rsplot/plotting/station_focus.py +84 -0
- rsplot/plotting/station_trend.py +60 -47
- rsplot/plotting/styles.py +3 -5
- rsplot/readers/__init__.py +89 -7
- rsplot/readers/_tropomi.py +121 -3
- rsplot/readers/base.py +16 -1
- rsplot/readers/era5.py +110 -10
- rsplot/readers/era5_wind.py +3 -2
- rsplot/readers/gems.py +429 -0
- rsplot/readers/guokong.py +125 -39
- rsplot/readers/netcdf.py +32 -0
- rsplot/readers/tropomi_hcho.py +1 -1
- rsplot/readers/tropomi_no2.py +1 -1
- rsplot/readers/tropomi_nrti.py +116 -0
- rsplot/readers/tropomi_o3.py +1 -1
- rsplot/readers/tropomi_o3pr.py +1 -1
- rsplot/result_builders/__init__.py +0 -14
- rsplot/result_builders/common.py +84 -0
- rsplot/result_builders/envelope.py +236 -0
- rsplot/result_builders/fnr.py +47 -131
- rsplot/result_builders/forecast.py +7 -0
- rsplot/result_builders/provenance.py +59 -0
- rsplot/result_builders/reconstruct.py +7 -0
- rsplot/result_builders/satellite.py +240 -0
- rsplot/result_builders/series_layer.py +289 -0
- rsplot/result_builders/station.py +23 -0
- rsplot/result_builders/station_layer.py +326 -0
- rsplot/results.py +0 -12
- rsplot/schemas/result.schema.json +566 -0
- rsplot/temporal.py +146 -16
- rsplot-0.3.2.dev37.dist-info/METADATA +996 -0
- rsplot-0.3.2.dev37.dist-info/RECORD +76 -0
- {rsplot-0.3.1.dev3.dist-info → rsplot-0.3.2.dev37.dist-info}/WHEEL +1 -1
- rsplot/commands/recent.py +0 -164
- rsplot/recent.py +0 -404
- rsplot/result_builders/meteo.py +0 -171
- rsplot/result_builders/overlay.py +0 -75
- rsplot/result_builders/raster.py +0 -72
- rsplot/result_builders/station_trend.py +0 -229
- rsplot-0.3.1.dev3.dist-info/METADATA +0 -477
- rsplot-0.3.1.dev3.dist-info/RECORD +0 -64
- {rsplot-0.3.1.dev3.dist-info → rsplot-0.3.2.dev37.dist-info}/entry_points.txt +0 -0
- {rsplot-0.3.1.dev3.dist-info → rsplot-0.3.2.dev37.dist-info}/licenses/LICENSE +0 -0
rsplot/cli.py
CHANGED
|
@@ -13,6 +13,7 @@ app = typer.Typer(
|
|
|
13
13
|
name="rsplot",
|
|
14
14
|
help="CLI tool for Remote sensing raster plotting.",
|
|
15
15
|
no_args_is_help=True,
|
|
16
|
+
add_completion=False,
|
|
16
17
|
)
|
|
17
18
|
|
|
18
19
|
|
|
@@ -45,82 +46,87 @@ def _callback(
|
|
|
45
46
|
@app.command()
|
|
46
47
|
def raster(
|
|
47
48
|
region: str = typer.Argument(
|
|
48
|
-
...,
|
|
49
|
+
...,
|
|
50
|
+
help="区域名称;支持逗号分隔多个省市县街道,如 '中山市/东区街道,中山市/南区街道',无需配置",
|
|
49
51
|
),
|
|
50
52
|
date_arg: str = typer.Argument(
|
|
51
53
|
...,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
metavar="DATE",
|
|
55
|
+
help=(
|
|
56
|
+
"TROPOMI: YYYYMMDD 按文件名日期合并当天轨道;"
|
|
57
|
+
"GEMS: YYYYMMDD 日均或 YYYYMMDDHHMM 精确扫描。"
|
|
58
|
+
"两者均支持 YYYYMMDD-YYYYMMDD 闭区间,"
|
|
59
|
+
"或结束日期 YYYYMMDD 配合 --days N,逐日等权平均。"
|
|
60
|
+
),
|
|
54
61
|
),
|
|
55
|
-
# ---
|
|
62
|
+
# --- Required options ---
|
|
56
63
|
product: str = typer.Option(
|
|
57
|
-
|
|
64
|
+
...,
|
|
58
65
|
"--product",
|
|
59
|
-
"-p",
|
|
60
66
|
help="产品类型: no2 / o3 / o3pr / hcho",
|
|
61
67
|
),
|
|
62
|
-
|
|
68
|
+
output: str = typer.Option(
|
|
69
|
+
...,
|
|
70
|
+
"--output",
|
|
71
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
72
|
+
),
|
|
73
|
+
# --- Data selection and processing ---
|
|
74
|
+
sensor: str = typer.Option(
|
|
75
|
+
"tropomi", "--sensor", help="卫星来源: tropomi / gems"
|
|
76
|
+
),
|
|
77
|
+
processing: str | None = typer.Option(
|
|
63
78
|
None,
|
|
64
|
-
"--
|
|
65
|
-
help="
|
|
66
|
-
"推荐值: 30 (月均,HCHO 首选) / 7 (周均) / 显式区间用 YYYYMMDD-YYYYMMDD",
|
|
79
|
+
"--processing",
|
|
80
|
+
help="TROPOMI 处理流: nrti(筛选并去重);省略则读取目录内匹配文件",
|
|
67
81
|
),
|
|
68
|
-
|
|
82
|
+
days: int | None = typer.Option(
|
|
69
83
|
None,
|
|
70
|
-
"--
|
|
84
|
+
"--days",
|
|
71
85
|
help=(
|
|
72
|
-
"
|
|
73
|
-
"
|
|
86
|
+
"以 DATE 为结束日期、向前共 N 天(含当天),按日等权平均;"
|
|
87
|
+
"不能与日期区间同时使用。省略时 YYYYMMDD 仅处理当天。"
|
|
74
88
|
),
|
|
75
89
|
),
|
|
76
|
-
|
|
90
|
+
res: float | None = typer.Option(
|
|
77
91
|
None,
|
|
78
|
-
"--
|
|
79
|
-
"
|
|
80
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
92
|
+
"--res",
|
|
93
|
+
help="目标网格间距 (度);GEMS 默认 0.05°,直接重映射原始像元",
|
|
81
94
|
),
|
|
82
|
-
|
|
83
|
-
None,
|
|
84
|
-
"--data-dir",
|
|
85
|
-
"-d",
|
|
86
|
-
help="数据目录 (覆盖配置默认值)",
|
|
95
|
+
qa: float | None = typer.Option(
|
|
96
|
+
None, "--qa", help="TROPOMI QA 阈值 (0-1),默认取配置;GEMS 不适用"
|
|
87
97
|
),
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"--
|
|
91
|
-
|
|
92
|
-
|
|
98
|
+
cf: float = typer.Option(
|
|
99
|
+
0.5,
|
|
100
|
+
"--cf",
|
|
101
|
+
min=0.0,
|
|
102
|
+
max=1.0,
|
|
103
|
+
help="最大云量比例 (0-1),保留 CF <= 该值的卫星像元",
|
|
93
104
|
),
|
|
105
|
+
smooth: float | None = typer.Option(
|
|
106
|
+
None, "--smooth", help="高斯平滑 sigma"
|
|
107
|
+
),
|
|
108
|
+
# --- Plotting ---
|
|
94
109
|
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
95
|
-
res: float | None = typer.Option(None, "--res", help="网格分辨率 (度)"),
|
|
96
110
|
basemap: str | None = typer.Option(
|
|
97
111
|
None,
|
|
98
112
|
"--basemap",
|
|
99
|
-
"-b",
|
|
100
113
|
help="底图控制: satellite / none (覆盖级别默认)",
|
|
101
114
|
),
|
|
102
115
|
vmin: float | None = typer.Option(None, "--vmin", help="Colorbar 最小值"),
|
|
103
116
|
vmax: float | None = typer.Option(None, "--vmax", help="Colorbar 最大值"),
|
|
104
117
|
cmap: str | None = typer.Option(None, "--cmap", help="Colormap 名称"),
|
|
105
|
-
smooth: float | None = typer.Option(
|
|
106
|
-
None, "--smooth", help="高斯平滑 sigma"
|
|
107
|
-
),
|
|
108
118
|
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
109
|
-
qa: float | None = typer.Option(0.5, "--qa", help="QA 阈值 (0-1)"),
|
|
110
|
-
cf: float = typer.Option(
|
|
111
|
-
0.5,
|
|
112
|
-
"--cf",
|
|
113
|
-
min=0.0,
|
|
114
|
-
max=1.0,
|
|
115
|
-
help="最大云量比例 (0-1),保留 CF <= 该值的卫星像元",
|
|
116
|
-
),
|
|
117
119
|
) -> None:
|
|
118
120
|
"""绘制卫星遥感栅格图。
|
|
119
121
|
|
|
122
|
+
TROPOMI 单日合并轨道后网格化;窗口模式先逐日网格化,再对每个网格的
|
|
123
|
+
有效天等权平均(缺测不计为 0,至少一天有效即保留,全无有效天则留空)。
|
|
124
|
+
统计只用有观测的网格;TROPOMI 单日图上的小空洞填补和平滑仅用于显示。
|
|
125
|
+
|
|
120
126
|
示例:
|
|
121
|
-
rsplot raster
|
|
122
|
-
rsplot raster 安徽
|
|
123
|
-
rsplot raster 长三角
|
|
127
|
+
rsplot raster 北京市 20260108 --product no2 --output beijing_no2.png # 单日
|
|
128
|
+
rsplot raster 安徽 20260131 --product hcho --days 30 --output anhui_hcho.png # 30 日窗口
|
|
129
|
+
rsplot raster 长三角 20260101-20260131 --product no2 --output yrd_no2.png # 显式区间
|
|
124
130
|
"""
|
|
125
131
|
from rsplot.commands.raster import run_raster
|
|
126
132
|
|
|
@@ -128,10 +134,9 @@ def raster(
|
|
|
128
134
|
region=region,
|
|
129
135
|
date_arg=date_arg,
|
|
130
136
|
product=product,
|
|
137
|
+
sensor=sensor,
|
|
138
|
+
processing=processing,
|
|
131
139
|
days=days,
|
|
132
|
-
n_min=n_min,
|
|
133
|
-
level=level,
|
|
134
|
-
data_dir=data_dir,
|
|
135
140
|
output=output,
|
|
136
141
|
dpi=dpi,
|
|
137
142
|
res=res,
|
|
@@ -148,190 +153,118 @@ def raster(
|
|
|
148
153
|
|
|
149
154
|
|
|
150
155
|
@app.command()
|
|
151
|
-
def
|
|
152
|
-
|
|
153
|
-
..., help="区域名称,如 中国、安徽、合肥、YRD、合肥/蜀山"
|
|
154
|
-
),
|
|
155
|
-
datetime_str: str = typer.Argument(
|
|
156
|
+
def radius(
|
|
157
|
+
station_id: str = typer.Argument(
|
|
156
158
|
...,
|
|
157
|
-
help="
|
|
158
|
-
),
|
|
159
|
-
var: str = typer.Option(
|
|
160
|
-
"o3",
|
|
161
|
-
"--var",
|
|
162
|
-
"-v",
|
|
163
|
-
help="重构变量: PM2.5 / PM10 / SO2 / NO2 / CO / O3",
|
|
164
|
-
),
|
|
165
|
-
level: str | None = typer.Option(
|
|
166
|
-
None,
|
|
167
|
-
"--level",
|
|
168
|
-
"-l",
|
|
169
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
170
|
-
),
|
|
171
|
-
data_dir: str | None = typer.Option(
|
|
172
|
-
None,
|
|
173
|
-
"--data-dir",
|
|
174
|
-
"-d",
|
|
175
|
-
help="重构数据目录 (覆盖配置中的 reconstruct 路径)",
|
|
176
|
-
),
|
|
177
|
-
output: str | None = typer.Option(
|
|
178
|
-
None,
|
|
179
|
-
"--output",
|
|
180
|
-
"-o",
|
|
181
|
-
help="输出文件路径",
|
|
182
|
-
),
|
|
183
|
-
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
184
|
-
res: float | None = typer.Option(
|
|
185
|
-
None,
|
|
186
|
-
"--res",
|
|
187
|
-
help="输出网格分辨率 (度,须为原生 0.01° 的整数倍)",
|
|
188
|
-
),
|
|
189
|
-
basemap: str | None = typer.Option(
|
|
190
|
-
None,
|
|
191
|
-
"--basemap",
|
|
192
|
-
"-b",
|
|
193
|
-
help="底图控制: satellite / none (覆盖级别默认)",
|
|
159
|
+
help="中心国控站点 ID,如 1379A",
|
|
194
160
|
),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
None,
|
|
200
|
-
"--smooth",
|
|
201
|
-
help="可选高斯平滑 sigma;默认不平滑",
|
|
161
|
+
date_arg: str = typer.Argument(
|
|
162
|
+
...,
|
|
163
|
+
help="GEMS: YYYYMMDDHHMM 精确扫描,YYYYMMDD 日均;单日 YYYYMMDD 走单日路径;带 --days 或写成 YYYYMMDD-YYYYMMDD "
|
|
164
|
+
"时切换为窗口均值(HCHO 单日覆盖率低,月均更可读)",
|
|
202
165
|
),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
示例:
|
|
210
|
-
rsplot reconstruct 安徽 2026051108 --var PM2.5
|
|
211
|
-
rsplot reconstruct 合肥 20260511 --var O3 --res 0.01
|
|
212
|
-
"""
|
|
213
|
-
from rsplot.commands.reconstruct import run_reconstruct
|
|
214
|
-
|
|
215
|
-
run_reconstruct(
|
|
216
|
-
region=region,
|
|
217
|
-
datetime_str=datetime_str,
|
|
218
|
-
var=var,
|
|
219
|
-
level=level,
|
|
220
|
-
data_dir=data_dir,
|
|
221
|
-
output=output,
|
|
222
|
-
dpi=dpi,
|
|
223
|
-
res=res,
|
|
224
|
-
basemap=basemap,
|
|
225
|
-
vmin=vmin,
|
|
226
|
-
vmax=vmax,
|
|
227
|
-
cmap=cmap,
|
|
228
|
-
smooth=smooth,
|
|
229
|
-
title=title,
|
|
230
|
-
console=console,
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
@app.command()
|
|
235
|
-
def forecast(
|
|
236
|
-
region: str = typer.Argument(
|
|
237
|
-
..., help="区域名称,如 中国、安徽、合肥、YRD、合肥/蜀山"
|
|
166
|
+
# --- Required options ---
|
|
167
|
+
product: str = typer.Option(
|
|
168
|
+
...,
|
|
169
|
+
"--product",
|
|
170
|
+
help="产品类型: no2 / o3 / o3pr / hcho",
|
|
238
171
|
),
|
|
239
|
-
|
|
172
|
+
km: float = typer.Option(
|
|
240
173
|
...,
|
|
241
|
-
|
|
174
|
+
"--km",
|
|
175
|
+
help="从站点向上下左右各延伸的公里数,正方形边长为该值的两倍",
|
|
242
176
|
),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"--
|
|
246
|
-
"
|
|
247
|
-
help="预报变量: PM2.5 / PM10 / SO2 / NO2 / CO / O3",
|
|
177
|
+
output: str = typer.Option(
|
|
178
|
+
...,
|
|
179
|
+
"--output",
|
|
180
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
248
181
|
),
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
"--
|
|
252
|
-
help="预报时效: 6 / 12 / 24 / 48 / 72 小时",
|
|
182
|
+
# --- Data selection and processing ---
|
|
183
|
+
sensor: str = typer.Option(
|
|
184
|
+
"tropomi", "--sensor", help="卫星来源: tropomi / gems"
|
|
253
185
|
),
|
|
254
|
-
|
|
186
|
+
processing: str | None = typer.Option(
|
|
255
187
|
None,
|
|
256
|
-
"--
|
|
257
|
-
"
|
|
258
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
188
|
+
"--processing",
|
|
189
|
+
help="TROPOMI 处理流: nrti;省略时沿用原有目录与读取行为",
|
|
259
190
|
),
|
|
260
|
-
|
|
191
|
+
days: int | None = typer.Option(
|
|
261
192
|
None,
|
|
262
|
-
"--
|
|
263
|
-
"
|
|
264
|
-
|
|
265
|
-
),
|
|
266
|
-
station_overlay: bool = typer.Option(
|
|
267
|
-
False,
|
|
268
|
-
"--station-overlay",
|
|
269
|
-
help="叠加同有效时次的国控站点散点",
|
|
193
|
+
"--days",
|
|
194
|
+
help="时间窗口天数;不指定且 DATE 为单日时走单日路径。"
|
|
195
|
+
"推荐值: 30 (月均,HCHO 首选) / 7 (周均) / 显式区间用 YYYYMMDD-YYYYMMDD",
|
|
270
196
|
),
|
|
271
197
|
station_var: str | None = typer.Option(
|
|
272
198
|
None,
|
|
273
199
|
"--station-var",
|
|
274
|
-
help="
|
|
275
|
-
),
|
|
276
|
-
station_data_dir: str | None = typer.Option(
|
|
277
|
-
None,
|
|
278
|
-
"--station-data-dir",
|
|
279
|
-
help="国控站点数据目录 (覆盖配置中的 guokong 路径)",
|
|
200
|
+
help="站点变量,如 NO2 / O3 / PM2.5;省略只标位置",
|
|
280
201
|
),
|
|
281
202
|
station_datetime: str | None = typer.Option(
|
|
282
203
|
None,
|
|
283
204
|
"--station-datetime",
|
|
284
|
-
help="
|
|
205
|
+
help="站点小时 YYYYMMDDHH;只标位置或日均/窗口叠加变量时必填,GEMS 扫描叠加变量时默认匹配最近整点",
|
|
285
206
|
),
|
|
286
|
-
|
|
207
|
+
res: float | None = typer.Option(
|
|
287
208
|
None,
|
|
288
|
-
"--
|
|
289
|
-
"
|
|
290
|
-
|
|
209
|
+
"--res",
|
|
210
|
+
help="目标网格间距 (度);GEMS 默认 0.05°,直接重映射原始像元",
|
|
211
|
+
),
|
|
212
|
+
qa: float | None = typer.Option(
|
|
213
|
+
None, "--qa", help="TROPOMI QA 阈值 (0-1),默认取配置;GEMS 不适用"
|
|
291
214
|
),
|
|
215
|
+
cf: float = typer.Option(
|
|
216
|
+
0.5,
|
|
217
|
+
"--cf",
|
|
218
|
+
min=0.0,
|
|
219
|
+
max=1.0,
|
|
220
|
+
help="最大云量比例 (0-1),保留 CF <= 该值的卫星像元",
|
|
221
|
+
),
|
|
222
|
+
smooth: float | None = typer.Option(
|
|
223
|
+
None, "--smooth", help="高斯平滑 sigma"
|
|
224
|
+
),
|
|
225
|
+
# --- Plotting ---
|
|
292
226
|
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
293
227
|
basemap: str | None = typer.Option(
|
|
294
|
-
|
|
228
|
+
"none",
|
|
295
229
|
"--basemap",
|
|
296
|
-
"-b",
|
|
297
230
|
help="底图控制: satellite / none (覆盖级别默认)",
|
|
298
231
|
),
|
|
299
232
|
vmin: float | None = typer.Option(None, "--vmin", help="Colorbar 最小值"),
|
|
300
233
|
vmax: float | None = typer.Option(None, "--vmax", help="Colorbar 最大值"),
|
|
301
234
|
cmap: str | None = typer.Option(None, "--cmap", help="Colormap 名称"),
|
|
302
|
-
smooth: float | None = typer.Option(
|
|
303
|
-
None, "--smooth", help="高斯平滑 sigma"
|
|
304
|
-
),
|
|
305
235
|
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
306
236
|
) -> None:
|
|
307
|
-
"""
|
|
237
|
+
"""绘制站点居中、上下左右各延伸指定公里数的正方形卫星图,可叠加指定小时的站点变量。
|
|
308
238
|
|
|
309
239
|
示例:
|
|
310
|
-
rsplot
|
|
311
|
-
|
|
312
|
-
rsplot
|
|
240
|
+
rsplot radius 1379A 20260414 --km 30 --product no2 \\
|
|
241
|
+
--station-datetime 2026041413 --output 1379A_no2.png
|
|
242
|
+
rsplot radius 1379A 20260414 --km 30 --product no2 --station-var NO2 \\
|
|
243
|
+
--station-datetime 2026041413 --output 1379A_no2_stations.png
|
|
313
244
|
"""
|
|
314
|
-
from rsplot.commands.
|
|
245
|
+
from rsplot.commands.radius import run_radius
|
|
315
246
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
lead=lead,
|
|
321
|
-
level=level,
|
|
322
|
-
data_dir=data_dir,
|
|
323
|
-
station_overlay=station_overlay,
|
|
247
|
+
run_radius(
|
|
248
|
+
station_id=station_id,
|
|
249
|
+
date_arg=date_arg,
|
|
250
|
+
km=km,
|
|
324
251
|
station_var=station_var,
|
|
325
|
-
station_data_dir=station_data_dir,
|
|
326
252
|
station_datetime=station_datetime,
|
|
253
|
+
sensor=sensor,
|
|
254
|
+
processing=processing,
|
|
255
|
+
product=product,
|
|
256
|
+
days=days,
|
|
327
257
|
output=output,
|
|
328
258
|
dpi=dpi,
|
|
259
|
+
res=res,
|
|
329
260
|
basemap=basemap,
|
|
330
261
|
vmin=vmin,
|
|
331
262
|
vmax=vmax,
|
|
332
263
|
cmap=cmap,
|
|
333
264
|
smooth=smooth,
|
|
334
265
|
title=title,
|
|
266
|
+
qa=qa,
|
|
267
|
+
cf=cf,
|
|
335
268
|
console=console,
|
|
336
269
|
)
|
|
337
270
|
|
|
@@ -343,8 +276,15 @@ def meteo(
|
|
|
343
276
|
),
|
|
344
277
|
datetime_str: str = typer.Argument(
|
|
345
278
|
...,
|
|
346
|
-
help="
|
|
279
|
+
help="YYYYMMDDHH;不接受仅日期,不自动选择最新小时",
|
|
347
280
|
),
|
|
281
|
+
# --- Required options ---
|
|
282
|
+
output: str = typer.Option(
|
|
283
|
+
...,
|
|
284
|
+
"--output",
|
|
285
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
286
|
+
),
|
|
287
|
+
# --- Data selection and processing ---
|
|
348
288
|
temp_level: str | None = typer.Option(
|
|
349
289
|
None,
|
|
350
290
|
"--temp-level",
|
|
@@ -360,41 +300,13 @@ def meteo(
|
|
|
360
300
|
"--station-var",
|
|
361
301
|
help="叠加国控站点变量;必须同时指定 --wind-level",
|
|
362
302
|
),
|
|
363
|
-
|
|
364
|
-
None,
|
|
365
|
-
"--level",
|
|
366
|
-
"-l",
|
|
367
|
-
help="强制指定行政区级别: country/key_region/province/city/county",
|
|
368
|
-
),
|
|
369
|
-
data_dir: str | None = typer.Option(
|
|
370
|
-
None,
|
|
371
|
-
"--data-dir",
|
|
372
|
-
"-d",
|
|
373
|
-
help="ERA5 数据目录 (覆盖配置中的 era5 路径)",
|
|
374
|
-
),
|
|
375
|
-
station_data_dir: str | None = typer.Option(
|
|
376
|
-
None,
|
|
377
|
-
"--station-data-dir",
|
|
378
|
-
help="国控站点数据目录 (覆盖配置中的 guokong 路径)",
|
|
379
|
-
),
|
|
380
|
-
output: str | None = typer.Option(
|
|
381
|
-
None,
|
|
382
|
-
"--output",
|
|
383
|
-
"-o",
|
|
384
|
-
help="输出 PNG 路径;同时写同名 JSON",
|
|
385
|
-
),
|
|
303
|
+
# --- Plotting ---
|
|
386
304
|
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
387
305
|
basemap: str | None = typer.Option(
|
|
388
306
|
None,
|
|
389
307
|
"--basemap",
|
|
390
|
-
"-b",
|
|
391
308
|
help="底图控制: satellite / none",
|
|
392
309
|
),
|
|
393
|
-
cmap: str | None = typer.Option(
|
|
394
|
-
None,
|
|
395
|
-
"--cmap",
|
|
396
|
-
help="温度色标;默认 RdYlBu_r",
|
|
397
|
-
),
|
|
398
310
|
vmin: float | None = typer.Option(
|
|
399
311
|
None,
|
|
400
312
|
"--vmin",
|
|
@@ -405,6 +317,11 @@ def meteo(
|
|
|
405
317
|
"--vmax",
|
|
406
318
|
help="温度色标最大值 (°C),默认区域 98% 分位",
|
|
407
319
|
),
|
|
320
|
+
cmap: str | None = typer.Option(
|
|
321
|
+
None,
|
|
322
|
+
"--cmap",
|
|
323
|
+
help="温度色标;默认 RdYlBu_r",
|
|
324
|
+
),
|
|
408
325
|
wind_stride: int | None = typer.Option(
|
|
409
326
|
None,
|
|
410
327
|
"--wind-stride",
|
|
@@ -428,12 +345,12 @@ def meteo(
|
|
|
428
345
|
) -> None:
|
|
429
346
|
"""绘制温度、黑色风箭头及可选国控站点图层。
|
|
430
347
|
|
|
431
|
-
DATETIME
|
|
348
|
+
DATETIME 为 YYYYMMDDHH:
|
|
432
349
|
|
|
433
|
-
rsplot meteo 南京 2026051115 --temp-level 2m
|
|
434
|
-
rsplot meteo 南京 2026051115 --wind-level 850
|
|
435
|
-
rsplot meteo 南京 2026051115 --temp-level 850 --wind-level 850
|
|
436
|
-
rsplot meteo 南京 2026051115 --station-var O3 --wind-level 850
|
|
350
|
+
rsplot meteo 南京 2026051115 --temp-level 2m --output nanjing_t2m.png
|
|
351
|
+
rsplot meteo 南京 2026051115 --wind-level 850 --output nanjing_wind.png
|
|
352
|
+
rsplot meteo 南京 2026051115 --temp-level 850 --wind-level 850 --output nanjing_850.png
|
|
353
|
+
rsplot meteo 南京 2026051115 --station-var O3 --wind-level 850 --output nanjing_o3.png
|
|
437
354
|
"""
|
|
438
355
|
from rsplot.commands.meteo import run_meteo
|
|
439
356
|
|
|
@@ -443,9 +360,6 @@ def meteo(
|
|
|
443
360
|
temp_level=temp_level,
|
|
444
361
|
wind_level=wind_level,
|
|
445
362
|
station_var=station_var,
|
|
446
|
-
level=level,
|
|
447
|
-
data_dir=data_dir,
|
|
448
|
-
station_data_dir=station_data_dir,
|
|
449
363
|
output=output,
|
|
450
364
|
dpi=dpi,
|
|
451
365
|
basemap=basemap,
|
|
@@ -466,48 +380,38 @@ def station(
|
|
|
466
380
|
..., help="区域名称,如 中国、安徽、合肥、YRD、合肥/蜀山"
|
|
467
381
|
),
|
|
468
382
|
datetime_str: str = typer.Argument(
|
|
469
|
-
...,
|
|
383
|
+
...,
|
|
384
|
+
help="YYYYMMDDHH(必须指定小时,不自动选择最新小时)",
|
|
470
385
|
),
|
|
386
|
+
# --- Required options ---
|
|
471
387
|
var: str = typer.Option(
|
|
472
|
-
|
|
388
|
+
...,
|
|
473
389
|
"--var",
|
|
474
|
-
"
|
|
475
|
-
help="变量名: AQI, PM2.5, PM10, NO2, O3, SO2, CO, O3_8h, *_24h",
|
|
390
|
+
help="变量名: AQI, PM2.5, PM2.5_24h, PM10, PM10_24h, SO2, SO2_24h, NO2, NO2_24h, O3, O3_24h, O3_8h, O3_8h_24h, CO, CO_24h",
|
|
476
391
|
),
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
"--level",
|
|
480
|
-
"-l",
|
|
481
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
482
|
-
),
|
|
483
|
-
data_dir: str | None = typer.Option(
|
|
484
|
-
None,
|
|
485
|
-
"--data-dir",
|
|
486
|
-
"-d",
|
|
487
|
-
help="数据目录 (覆盖配置默认值)",
|
|
488
|
-
),
|
|
489
|
-
output: str | None = typer.Option(
|
|
490
|
-
None,
|
|
392
|
+
output: str = typer.Option(
|
|
393
|
+
...,
|
|
491
394
|
"--output",
|
|
492
|
-
"
|
|
493
|
-
help="输出文件路径",
|
|
395
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
494
396
|
),
|
|
397
|
+
# --- Data selection and processing ---
|
|
398
|
+
# --- Plotting ---
|
|
495
399
|
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
496
400
|
basemap: str | None = typer.Option(
|
|
497
401
|
None,
|
|
498
402
|
"--basemap",
|
|
499
|
-
"-b",
|
|
500
403
|
help="底图控制: satellite / none",
|
|
501
404
|
),
|
|
502
405
|
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
503
406
|
) -> None:
|
|
504
407
|
"""绘制国控站点污染物散点图。
|
|
505
408
|
|
|
409
|
+
时间必须为 YYYYMMDDHH;不接受仅日期或自动选择最新小时。
|
|
410
|
+
|
|
506
411
|
示例:
|
|
507
|
-
rsplot station 安徽
|
|
508
|
-
rsplot station
|
|
509
|
-
rsplot station
|
|
510
|
-
rsplot station YRD 2026041415 --var NO2 -o logs/yrd_no2.png
|
|
412
|
+
rsplot station 安徽 2026041415 --var AQI --output anhui_aqi.png
|
|
413
|
+
rsplot station 中国 2026041415 --var PM2.5_24h --output china_pm25.png
|
|
414
|
+
rsplot station YRD 2026041415 --var NO2 --output yrd_no2.png
|
|
511
415
|
"""
|
|
512
416
|
from rsplot.commands.station import run_station
|
|
513
417
|
|
|
@@ -515,8 +419,6 @@ def station(
|
|
|
515
419
|
region=region,
|
|
516
420
|
datetime_str=datetime_str,
|
|
517
421
|
var=var,
|
|
518
|
-
level=level,
|
|
519
|
-
data_dir=data_dir,
|
|
520
422
|
output=output,
|
|
521
423
|
dpi=dpi,
|
|
522
424
|
basemap=basemap,
|
|
@@ -535,22 +437,36 @@ def trend(
|
|
|
535
437
|
...,
|
|
536
438
|
help="结束日期 YYYYMMDD,或显式范围 YYYYMMDD-YYYYMMDD",
|
|
537
439
|
),
|
|
538
|
-
|
|
539
|
-
7,
|
|
540
|
-
"--days",
|
|
541
|
-
help="最近天数;仅当 DATE 为单日时生效,默认 7",
|
|
542
|
-
),
|
|
440
|
+
# --- Required options ---
|
|
543
441
|
var: str = typer.Option(
|
|
544
|
-
|
|
442
|
+
...,
|
|
545
443
|
"--var",
|
|
546
|
-
"-v",
|
|
547
444
|
help="变量名: AQI, PM2.5, PM10, NO2, O3, SO2, CO, O3_8h, O3_8h_24h",
|
|
548
445
|
),
|
|
446
|
+
output: str = typer.Option(
|
|
447
|
+
...,
|
|
448
|
+
"--output",
|
|
449
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
450
|
+
),
|
|
451
|
+
# --- Data selection and processing ---
|
|
452
|
+
days: int | None = typer.Option(
|
|
453
|
+
None,
|
|
454
|
+
"--days",
|
|
455
|
+
help="以单日 DATE 为结束日的天数;单日 DATE 必填,日期区间时不可用",
|
|
456
|
+
),
|
|
549
457
|
region: bool = typer.Option(
|
|
550
458
|
False,
|
|
551
459
|
"--region",
|
|
552
460
|
help="将 TARGET 作为区域名称,绘制区域站点趋势",
|
|
553
461
|
),
|
|
462
|
+
threshold: float | None = typer.Option(
|
|
463
|
+
None,
|
|
464
|
+
"--threshold",
|
|
465
|
+
min=0.0,
|
|
466
|
+
help="覆盖变量默认超标阈值",
|
|
467
|
+
),
|
|
468
|
+
# --- Plotting ---
|
|
469
|
+
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
554
470
|
view: str = typer.Option(
|
|
555
471
|
"lines",
|
|
556
472
|
"--view",
|
|
@@ -563,39 +479,15 @@ def trend(
|
|
|
563
479
|
help="区域图中重点突出站点 ID;可重复指定",
|
|
564
480
|
),
|
|
565
481
|
] = None,
|
|
566
|
-
threshold: float | None = typer.Option(
|
|
567
|
-
None,
|
|
568
|
-
"--threshold",
|
|
569
|
-
min=0.0,
|
|
570
|
-
help="覆盖变量默认超标阈值",
|
|
571
|
-
),
|
|
572
|
-
level: str | None = typer.Option(
|
|
573
|
-
None,
|
|
574
|
-
"--level",
|
|
575
|
-
"-l",
|
|
576
|
-
help="区域模式强制级别: country / key_region / province / city / county",
|
|
577
|
-
),
|
|
578
|
-
data_dir: str | None = typer.Option(
|
|
579
|
-
None,
|
|
580
|
-
"--data-dir",
|
|
581
|
-
"-d",
|
|
582
|
-
help="国控站点数据目录 (覆盖配置默认值)",
|
|
583
|
-
),
|
|
584
|
-
output: str | None = typer.Option(
|
|
585
|
-
None,
|
|
586
|
-
"--output",
|
|
587
|
-
"-o",
|
|
588
|
-
help="PNG 输出文件路径",
|
|
589
|
-
),
|
|
590
|
-
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
591
482
|
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
592
483
|
) -> None:
|
|
593
484
|
"""绘制单站点或区域国控站点小时观测趋势图。
|
|
594
485
|
|
|
595
486
|
示例:
|
|
596
|
-
rsplot trend 3347A 20260520 --days 7 --var O3
|
|
597
|
-
rsplot trend 安徽 20260520 --days 7 --var O3 --region
|
|
598
|
-
rsplot trend 安徽 20260520 --region --view mean
|
|
487
|
+
rsplot trend 3347A 20260520 --days 7 --var O3 --output 3347A_o3.png
|
|
488
|
+
rsplot trend 安徽 20260520 --days 7 --var O3 --region --output anhui_o3.png
|
|
489
|
+
rsplot trend 安徽 20260514-20260520 --var O3 --region --view mean \\
|
|
490
|
+
--focus-station 3347A --output anhui_o3_mean.png
|
|
599
491
|
"""
|
|
600
492
|
from rsplot.commands.station_trend import run_trend
|
|
601
493
|
|
|
@@ -608,8 +500,6 @@ def trend(
|
|
|
608
500
|
view=view,
|
|
609
501
|
focus_station_ids=focus_station,
|
|
610
502
|
threshold=threshold,
|
|
611
|
-
level=level,
|
|
612
|
-
data_dir=data_dir,
|
|
613
503
|
output=output,
|
|
614
504
|
dpi=dpi,
|
|
615
505
|
title=title,
|
|
@@ -620,56 +510,84 @@ def trend(
|
|
|
620
510
|
@app.command()
|
|
621
511
|
def overlay(
|
|
622
512
|
region: str = typer.Argument(
|
|
623
|
-
...,
|
|
513
|
+
...,
|
|
514
|
+
help="区域名称;支持逗号分隔多个省市县街道,如 '中山市/东区街道,中山市/南区街道',无需配置",
|
|
624
515
|
),
|
|
625
|
-
|
|
516
|
+
date_arg: str = typer.Argument(
|
|
626
517
|
...,
|
|
627
|
-
|
|
628
|
-
|
|
518
|
+
metavar="DATE",
|
|
519
|
+
help=(
|
|
520
|
+
"卫星时间,与 raster 相同。TROPOMI: YYYYMMDD 按文件名日期合并"
|
|
521
|
+
"当天轨道;GEMS: YYYYMMDD 日均或 YYYYMMDDHHMM 精确扫描。"
|
|
522
|
+
"两者均支持 YYYYMMDD-YYYYMMDD 闭区间,或结束日期 YYYYMMDD 配合"
|
|
523
|
+
" --days N,逐日等权平均。"
|
|
524
|
+
),
|
|
629
525
|
),
|
|
630
|
-
# ---
|
|
526
|
+
# --- Required options ---
|
|
631
527
|
product: str = typer.Option(
|
|
632
|
-
|
|
528
|
+
...,
|
|
633
529
|
"--product",
|
|
634
|
-
"-p",
|
|
635
530
|
help="卫星产品类型: no2 / o3 / o3pr / hcho",
|
|
636
531
|
),
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
"
|
|
641
|
-
"-v",
|
|
642
|
-
help="站点变量名,省略时按 product 自动选同名变量 (NO2 / O3)",
|
|
532
|
+
station_var: str = typer.Option(
|
|
533
|
+
...,
|
|
534
|
+
"--station-var",
|
|
535
|
+
help="站点变量名,如 NO2 / O3 / O3_8h_24h;与卫星产品无默认配对",
|
|
643
536
|
),
|
|
644
|
-
|
|
645
|
-
|
|
537
|
+
output: str = typer.Option(
|
|
538
|
+
...,
|
|
539
|
+
"--output",
|
|
540
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
541
|
+
),
|
|
542
|
+
# --- Data selection and processing ---
|
|
543
|
+
sensor: str = typer.Option(
|
|
544
|
+
"tropomi", "--sensor", help="卫星来源: tropomi / gems"
|
|
545
|
+
),
|
|
546
|
+
processing: str | None = typer.Option(
|
|
646
547
|
None,
|
|
647
|
-
"--
|
|
648
|
-
"
|
|
649
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
548
|
+
"--processing",
|
|
549
|
+
help="TROPOMI 处理流: nrti;省略时沿用原有目录与读取行为",
|
|
650
550
|
),
|
|
651
|
-
|
|
551
|
+
days: int | None = typer.Option(
|
|
652
552
|
None,
|
|
653
|
-
"--
|
|
654
|
-
help=
|
|
553
|
+
"--days",
|
|
554
|
+
help=(
|
|
555
|
+
"以 DATE 为结束日期、向前共 N 天(含当天),按日等权平均;"
|
|
556
|
+
"不能与日期区间同时使用。"
|
|
557
|
+
),
|
|
655
558
|
),
|
|
656
|
-
|
|
559
|
+
station_datetime: str | None = typer.Option(
|
|
657
560
|
None,
|
|
658
|
-
"--station-
|
|
659
|
-
help=
|
|
561
|
+
"--station-datetime",
|
|
562
|
+
help=(
|
|
563
|
+
"站点观测小时 YYYYMMDDHH。TROPOMI、GEMS 日均及窗口"
|
|
564
|
+
"均值必须指定;GEMS 精确扫描默认匹配最近整点,也可显式覆盖。"
|
|
565
|
+
"不会自动选择最新小时。"
|
|
566
|
+
),
|
|
660
567
|
),
|
|
661
|
-
|
|
568
|
+
res: float | None = typer.Option(
|
|
662
569
|
None,
|
|
663
|
-
"--
|
|
664
|
-
"
|
|
665
|
-
|
|
570
|
+
"--res",
|
|
571
|
+
help="目标网格间距 (度);GEMS 默认 0.05°,直接重映射原始像元",
|
|
572
|
+
),
|
|
573
|
+
qa: float | None = typer.Option(
|
|
574
|
+
None, "--qa", help="TROPOMI QA 阈值 (0-1),默认取配置;GEMS 不适用"
|
|
575
|
+
),
|
|
576
|
+
cf: float = typer.Option(
|
|
577
|
+
0.5,
|
|
578
|
+
"--cf",
|
|
579
|
+
min=0.0,
|
|
580
|
+
max=1.0,
|
|
581
|
+
help="最大云量比例 (0-1),保留 CF <= 该值的卫星像元",
|
|
582
|
+
),
|
|
583
|
+
smooth: float | None = typer.Option(
|
|
584
|
+
None, "--smooth", help="高斯平滑 sigma"
|
|
666
585
|
),
|
|
586
|
+
# --- Plotting ---
|
|
667
587
|
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
668
|
-
res: float | None = typer.Option(None, "--res", help="网格分辨率 (度)"),
|
|
669
588
|
basemap: str | None = typer.Option(
|
|
670
589
|
None,
|
|
671
590
|
"--basemap",
|
|
672
|
-
"-b",
|
|
673
591
|
help="底图控制: satellite / none (覆盖级别默认)",
|
|
674
592
|
),
|
|
675
593
|
vmin: float | None = typer.Option(
|
|
@@ -679,40 +597,32 @@ def overlay(
|
|
|
679
597
|
None, "--vmax", help="卫星 colorbar 最大值"
|
|
680
598
|
),
|
|
681
599
|
cmap: str | None = typer.Option(None, "--cmap", help="卫星 colormap 名称"),
|
|
682
|
-
smooth: float | None = typer.Option(
|
|
683
|
-
None, "--smooth", help="高斯平滑 sigma"
|
|
684
|
-
),
|
|
685
|
-
qa: float | None = typer.Option(0.5, "--qa", help="QA 阈值 (0-1)"),
|
|
686
|
-
cf: float = typer.Option(
|
|
687
|
-
0.5,
|
|
688
|
-
"--cf",
|
|
689
|
-
min=0.0,
|
|
690
|
-
max=1.0,
|
|
691
|
-
help="最大云量比例 (0-1),保留 CF <= 该值的卫星像元",
|
|
692
|
-
),
|
|
693
600
|
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
694
601
|
) -> None:
|
|
695
602
|
"""叠加绘制卫星栅格+国控站点图。
|
|
696
603
|
|
|
697
604
|
两种数据同时输出到一张 PNG 和一个合并的 JSON sidecar。
|
|
698
|
-
|
|
699
|
-
YYYYMMDD 会自动选当天最新小时的站点数据。
|
|
605
|
+
DATE 只决定卫星时间;站点始终是一个整点,从不做时间平均。
|
|
700
606
|
|
|
701
607
|
示例:
|
|
702
|
-
rsplot overlay YRD
|
|
703
|
-
|
|
704
|
-
rsplot overlay
|
|
608
|
+
rsplot overlay YRD 20260208 --product no2 --station-var NO2 \\
|
|
609
|
+
--station-datetime 2026020813 --output yrd_no2.png
|
|
610
|
+
rsplot overlay 安徽 20260414 --product o3 --days 7 --station-var O3 \\
|
|
611
|
+
--station-datetime 2026041414 --output anhui_o3.png
|
|
612
|
+
rsplot overlay 合肥 202604141200 --sensor gems --product no2 \\
|
|
613
|
+
--station-var NO2 --output hefei_gems_no2.png
|
|
705
614
|
"""
|
|
706
615
|
from rsplot.commands.overlay import run_overlay
|
|
707
616
|
|
|
708
617
|
run_overlay(
|
|
709
618
|
region=region,
|
|
710
|
-
|
|
619
|
+
date_arg=date_arg,
|
|
620
|
+
days=days,
|
|
621
|
+
station_datetime=station_datetime,
|
|
711
622
|
product=product,
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
station_dir=station_dir,
|
|
623
|
+
sensor=sensor,
|
|
624
|
+
processing=processing,
|
|
625
|
+
station_var=station_var,
|
|
716
626
|
output=output,
|
|
717
627
|
dpi=dpi,
|
|
718
628
|
res=res,
|
|
@@ -728,89 +638,6 @@ def overlay(
|
|
|
728
638
|
)
|
|
729
639
|
|
|
730
640
|
|
|
731
|
-
@app.command()
|
|
732
|
-
def recent(
|
|
733
|
-
region: str = typer.Argument(
|
|
734
|
-
..., help="区域名称,如 中国、安徽、合肥、YRD、合肥/蜀山"
|
|
735
|
-
),
|
|
736
|
-
end_date: str = typer.Argument(
|
|
737
|
-
..., help="结束日期 YYYYMMDD,最近 N 天统计以该日期为窗口末端"
|
|
738
|
-
),
|
|
739
|
-
days: int = typer.Option(
|
|
740
|
-
30,
|
|
741
|
-
"--days",
|
|
742
|
-
help="最近天数,如 7 / 30 / 365",
|
|
743
|
-
),
|
|
744
|
-
source: str = typer.Option(
|
|
745
|
-
"raster",
|
|
746
|
-
"--source",
|
|
747
|
-
help="数据源: raster / station",
|
|
748
|
-
),
|
|
749
|
-
product: str = typer.Option(
|
|
750
|
-
"o3",
|
|
751
|
-
"--product",
|
|
752
|
-
"-p",
|
|
753
|
-
help="source=raster 时的产品: no2 / o3 / o3pr / hcho",
|
|
754
|
-
),
|
|
755
|
-
var: str = typer.Option(
|
|
756
|
-
"AQI",
|
|
757
|
-
"--var",
|
|
758
|
-
"-v",
|
|
759
|
-
help="source=station 时的变量名: AQI, PM2.5, PM10, NO2, O3, SO2, CO...",
|
|
760
|
-
),
|
|
761
|
-
level: str | None = typer.Option(
|
|
762
|
-
None,
|
|
763
|
-
"--level",
|
|
764
|
-
"-l",
|
|
765
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
766
|
-
),
|
|
767
|
-
data_dir: str | None = typer.Option(
|
|
768
|
-
None,
|
|
769
|
-
"--data-dir",
|
|
770
|
-
"-d",
|
|
771
|
-
help="数据目录 (覆盖配置默认值)",
|
|
772
|
-
),
|
|
773
|
-
output: str | None = typer.Option(
|
|
774
|
-
None,
|
|
775
|
-
"--output",
|
|
776
|
-
"-o",
|
|
777
|
-
help="输出 JSON 路径",
|
|
778
|
-
),
|
|
779
|
-
res: float | None = typer.Option(None, "--res", help="网格分辨率 (度)"),
|
|
780
|
-
qa: float | None = typer.Option(0.5, "--qa", help="QA 阈值 (0-1)"),
|
|
781
|
-
cf: float = typer.Option(
|
|
782
|
-
0.5,
|
|
783
|
-
"--cf",
|
|
784
|
-
min=0.0,
|
|
785
|
-
max=1.0,
|
|
786
|
-
help="source=raster 时最大云量比例,保留 CF <= 该值的像元",
|
|
787
|
-
),
|
|
788
|
-
) -> None:
|
|
789
|
-
"""输出最近 N 天数据 JSON,用于周/月/年变化对比。
|
|
790
|
-
|
|
791
|
-
示例:
|
|
792
|
-
rsplot recent 合肥 20260428 --days 30 -p hcho -o recent.json
|
|
793
|
-
rsplot recent 安徽 20260428 --days 7 --source station --var O3
|
|
794
|
-
"""
|
|
795
|
-
from rsplot.commands.recent import run_recent
|
|
796
|
-
|
|
797
|
-
run_recent(
|
|
798
|
-
region=region,
|
|
799
|
-
end_date=end_date,
|
|
800
|
-
days=days,
|
|
801
|
-
source=source,
|
|
802
|
-
product=product,
|
|
803
|
-
var=var,
|
|
804
|
-
level=level,
|
|
805
|
-
data_dir=data_dir,
|
|
806
|
-
output=output,
|
|
807
|
-
res=res,
|
|
808
|
-
qa=qa,
|
|
809
|
-
cf=cf,
|
|
810
|
-
console=console,
|
|
811
|
-
)
|
|
812
|
-
|
|
813
|
-
|
|
814
641
|
@app.command()
|
|
815
642
|
def fnr(
|
|
816
643
|
region: str = typer.Argument(
|
|
@@ -821,11 +648,22 @@ def fnr(
|
|
|
821
648
|
help="单日 (YYYYMMDD,默认向前 --days 天) 或范围 "
|
|
822
649
|
"(YYYYMMDD-YYYYMMDD,闭区间)",
|
|
823
650
|
),
|
|
824
|
-
# ---
|
|
825
|
-
|
|
826
|
-
|
|
651
|
+
# --- Required options ---
|
|
652
|
+
output: str = typer.Option(
|
|
653
|
+
...,
|
|
654
|
+
"--output",
|
|
655
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
656
|
+
),
|
|
657
|
+
# --- Data selection and processing ---
|
|
658
|
+
processing: str | None = typer.Option(
|
|
659
|
+
None,
|
|
660
|
+
"--processing",
|
|
661
|
+
help="TROPOMI 处理流: nrti,同时用于 NO2 与 HCHO",
|
|
662
|
+
),
|
|
663
|
+
days: int | None = typer.Option(
|
|
664
|
+
None,
|
|
827
665
|
"--days",
|
|
828
|
-
help="
|
|
666
|
+
help="以单日 DATE 为结束日的窗口天数;单日 DATE 必填,日期区间时不可用",
|
|
829
667
|
),
|
|
830
668
|
n_min: int | None = typer.Option(
|
|
831
669
|
None,
|
|
@@ -848,45 +686,7 @@ def fnr(
|
|
|
848
686
|
"--nox-threshold",
|
|
849
687
|
help="NOx-limited 分级阈值:FNR 大于该值判为 NOx-limited",
|
|
850
688
|
),
|
|
851
|
-
display_max: float = typer.Option(
|
|
852
|
-
6.0,
|
|
853
|
-
"--display-max",
|
|
854
|
-
help="FNR 图例显示上限,必须大于 --nox-threshold",
|
|
855
|
-
),
|
|
856
|
-
# --- overrides ---
|
|
857
|
-
level: str | None = typer.Option(
|
|
858
|
-
None,
|
|
859
|
-
"--level",
|
|
860
|
-
"-l",
|
|
861
|
-
help="强制指定级别: country / key_region / province / city / county",
|
|
862
|
-
),
|
|
863
|
-
raster_dir_no2: str | None = typer.Option(
|
|
864
|
-
None,
|
|
865
|
-
"--no2-dir",
|
|
866
|
-
help="NO2 数据目录 (覆盖配置默认值)",
|
|
867
|
-
),
|
|
868
|
-
raster_dir_hcho: str | None = typer.Option(
|
|
869
|
-
None,
|
|
870
|
-
"--hcho-dir",
|
|
871
|
-
help="HCHO 数据目录 (覆盖配置默认值)",
|
|
872
|
-
),
|
|
873
|
-
output: str | None = typer.Option(
|
|
874
|
-
None,
|
|
875
|
-
"--output",
|
|
876
|
-
"-o",
|
|
877
|
-
help="输出文件路径",
|
|
878
|
-
),
|
|
879
|
-
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
880
689
|
res: float | None = typer.Option(None, "--res", help="网格分辨率 (度)"),
|
|
881
|
-
basemap: str | None = typer.Option(
|
|
882
|
-
None,
|
|
883
|
-
"--basemap",
|
|
884
|
-
"-b",
|
|
885
|
-
help="底图控制: satellite / none",
|
|
886
|
-
),
|
|
887
|
-
smooth: float | None = typer.Option(
|
|
888
|
-
None, "--smooth", help="高斯平滑 sigma"
|
|
889
|
-
),
|
|
890
690
|
qa: float | None = typer.Option(
|
|
891
691
|
0.5,
|
|
892
692
|
"--qa",
|
|
@@ -899,6 +699,21 @@ def fnr(
|
|
|
899
699
|
max=1.0,
|
|
900
700
|
help="最大云量比例,同时应用于 NO2 和 HCHO;保留 CF <= 该值的像元",
|
|
901
701
|
),
|
|
702
|
+
smooth: float | None = typer.Option(
|
|
703
|
+
None, "--smooth", help="高斯平滑 sigma"
|
|
704
|
+
),
|
|
705
|
+
# --- Plotting ---
|
|
706
|
+
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
707
|
+
basemap: str | None = typer.Option(
|
|
708
|
+
None,
|
|
709
|
+
"--basemap",
|
|
710
|
+
help="底图控制: satellite / none",
|
|
711
|
+
),
|
|
712
|
+
display_max: float = typer.Option(
|
|
713
|
+
6.0,
|
|
714
|
+
"--display-max",
|
|
715
|
+
help="FNR 图例显示上限,必须大于 --nox-threshold",
|
|
716
|
+
),
|
|
902
717
|
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
903
718
|
) -> None:
|
|
904
719
|
"""绘制 FNR (HCHO / NO2) 区域控制 regime 图。
|
|
@@ -907,13 +722,14 @@ def fnr(
|
|
|
907
722
|
分级依据 Duncan 2010: FNR<1 VOC-limited, 1~2 过渡, >2 NOx-limited.
|
|
908
723
|
|
|
909
724
|
示例:
|
|
910
|
-
rsplot fnr 合肥
|
|
911
|
-
rsplot fnr 安徽
|
|
912
|
-
rsplot fnr 长三角 20260101-20260130
|
|
725
|
+
rsplot fnr 合肥 20260114 --days 7 --output hefei_fnr.png # 7 日窗口
|
|
726
|
+
rsplot fnr 安徽 20260131 --days 30 --output anhui_fnr.png # 30 日窗口
|
|
727
|
+
rsplot fnr 长三角 20260101-20260130 --output yrd_fnr.png # 显式区间
|
|
913
728
|
"""
|
|
914
729
|
from rsplot.commands.fnr import run_fnr
|
|
915
730
|
|
|
916
731
|
run_fnr(
|
|
732
|
+
processing=processing,
|
|
917
733
|
region=region,
|
|
918
734
|
date_arg=date_arg,
|
|
919
735
|
days=days,
|
|
@@ -922,9 +738,6 @@ def fnr(
|
|
|
922
738
|
voc_threshold=voc_threshold,
|
|
923
739
|
nox_threshold=nox_threshold,
|
|
924
740
|
display_max=display_max,
|
|
925
|
-
level=level,
|
|
926
|
-
raster_dir_no2=raster_dir_no2,
|
|
927
|
-
raster_dir_hcho=raster_dir_hcho,
|
|
928
741
|
output=output,
|
|
929
742
|
dpi=dpi,
|
|
930
743
|
res=res,
|