rsplot 0.3.2.dev37__tar.gz → 0.4.1.dev8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/PKG-INFO +70 -5
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/README.md +69 -4
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/cli.py +98 -10
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/common.py +24 -0
- rsplot-0.4.1.dev8/src/rsplot/commands/exceedance.py +541 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/fnr.py +122 -50
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/meteo.py +4 -10
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/overlay.py +3 -8
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/radius.py +2 -7
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/raster.py +1 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/station.py +4 -13
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/station_trend.py +2 -6
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/config.py +3 -7
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/data_files.py +20 -2
- rsplot-0.4.1.dev8/src/rsplot/exceedance.py +140 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/fnr.py +85 -51
- rsplot-0.4.1.dev8/src/rsplot/plotting/__init__.py +7 -0
- rsplot-0.4.1.dev8/src/rsplot/plotting/exceedance.py +559 -0
- rsplot-0.4.1.dev8/src/rsplot/readers/era5_days.py +263 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/guokong.py +155 -88
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/common.py +102 -0
- rsplot-0.4.1.dev8/src/rsplot/result_builders/exceedance.py +524 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/satellite.py +10 -0
- rsplot-0.4.1.dev8/src/rsplot/result_builders/weather_days.py +231 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/schemas/result.schema.json +209 -10
- rsplot-0.4.1.dev8/src/rsplot/weather_days.py +121 -0
- rsplot-0.3.2.dev37/src/rsplot/plotting/__init__.py +0 -1
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/.gitignore +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/LICENSE +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/pyproject.toml +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/__init__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/__main__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/atomic.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/__init__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/forecast.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/reconstruct.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/commands/sidecar.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/errors.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/geo/__init__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/geo/boundaries.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/geo/footprints.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/geo/gridding.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/geo/processing.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/geo/radius.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/colormap_22.txt +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/colormaps.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/fnr.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/map_frame.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/meteo.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/overlay.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/raster.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/station.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/station_focus.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/station_trend.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/styles.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/plotting/wind.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/__init__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/_tropomi.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/base.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/era5.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/era5_wind.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/forecast.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/gems.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/netcdf.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/reconstruct.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/tropomi_hcho.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/tropomi_no2.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/tropomi_nrti.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/tropomi_o3.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/readers/tropomi_o3pr.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/__init__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/envelope.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/fnr.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/forecast.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/provenance.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/reconstruct.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/series_layer.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/station.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/result_builders/station_layer.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/results.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/stats.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/temporal.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/tiles/__init__.py +0 -0
- {rsplot-0.3.2.dev37 → rsplot-0.4.1.dev8}/src/rsplot/tiles/tianditu.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: rsplot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.1.dev8
|
|
4
4
|
Summary: CLI tool for plotting Remote Sensing data, designed for Agent.
|
|
5
5
|
Project-URL: Repository, https://git.lug.ustc.edu.cn/yaoyhu/rsplot
|
|
6
6
|
Project-URL: GitHub, https://github.com/yaoyhu/rsplot
|
|
@@ -417,6 +417,19 @@ rsplot trend 重庆 20260520 --days 7 --var O3 --region --view mean \
|
|
|
417
417
|
rsplot overlay 合肥 20260414 --product no2 --station-var NO2 \
|
|
418
418
|
--station-datetime 2026041413 --output overlay_hefei_no2.png
|
|
419
419
|
|
|
420
|
+
# Judge every station's daily maximum 8-hour ozone (MDA8) against 160
|
|
421
|
+
# μg/m³; no regional mean. One day draws hourly O3 and 8-hour means, a
|
|
422
|
+
# range draws a station × day heat map with daily exceeding-station counts.
|
|
423
|
+
# Writes <name>.series.nc (value and o3_8h by station and hour) and
|
|
424
|
+
# <name>.mda8.csv (one row per station and day).
|
|
425
|
+
rsplot exceedance 西安市 20260614 --var O3 --output xian_o3_0614.png
|
|
426
|
+
rsplot exceedance 西安市 20260601-20260630 --var O3 --output xian_o3_06.png
|
|
427
|
+
rsplot exceedance 西安市 20260601-20261031 --var O3 --meteo-hours 12-20 --output xian_o3_meteo.png
|
|
428
|
+
# PM2.5, PM10, NO2, SO2, CO: each station's daily mean (at least 20 valid
|
|
429
|
+
# hours) against 60, 120, 80, 150 μg/m³ and 4 mg/m³; writes
|
|
430
|
+
# <name>.daily_mean.csv.
|
|
431
|
+
rsplot exceedance 西安市 20261001-20261031 --var PM2.5 --output xian_pm25_10.png
|
|
432
|
+
|
|
420
433
|
# Plot an FNR regime map over the 7 days ending on a date. The sidecar has
|
|
421
434
|
# no2, hcho and fnr layers (regime counts in the fnr layer's categories),
|
|
422
435
|
# with fnr_hefei.no2.nc, fnr_hefei.hcho.nc and fnr_hefei.fnr.nc.
|
|
@@ -597,9 +610,7 @@ a red upper extension marks this overflow. Equality is not exceedance.
|
|
|
597
610
|
|
|
598
611
|
| Station variable | Threshold (μg/m³) | Colorbar range (μg/m³) |
|
|
599
612
|
| --- | --- | --- |
|
|
600
|
-
| `O3_8h`, `O3_8h_24h` (8h O3 / MDA8 O3) | 160 | 0–180 |
|
|
601
613
|
| `O3` (hourly) | 200 | 0–220 |
|
|
602
|
-
| `O3_24h` (existing hourly-limit mapping) | 200 | 0–220 |
|
|
603
614
|
| `NO2` (hourly) | 200 | 0–220 |
|
|
604
615
|
| `NO2_24h` (daily) | 80 | 0–100 |
|
|
605
616
|
|
|
@@ -610,6 +621,58 @@ Fixed station-scale metadata appears in `render.layers.station` for
|
|
|
610
621
|
`station`, `overlay`, `radius` and `meteo`.
|
|
611
622
|
Original observations, summary statistics and exceedance counts are preserved.
|
|
612
623
|
|
|
624
|
+
## Station exceedance (O3, PM2.5, PM10, NO2, SO2, CO)
|
|
625
|
+
|
|
626
|
+
`rsplot exceedance REGION DATE --var VAR --output PNG` judges every station
|
|
627
|
+
inside the region on its own; there is no regional mean. Comma-separated
|
|
628
|
+
regions are accepted. `--var` is required: `O3` (judged by MDA8), or
|
|
629
|
+
`PM2.5`, `PM10`, `NO2`, `SO2`, `CO` (judged by the daily mean).
|
|
630
|
+
|
|
631
|
+
- MDA8 comes from hourly `O3` only. Day D uses hours D 01 through D+1 00
|
|
632
|
+
(hour 24). An 8-hour mean ending at hour t averages hours t−7..t and needs
|
|
633
|
+
at least 6 valid hours. MDA8 is the largest of the 17 means ending at hours
|
|
634
|
+
08–24 and needs at least 14 valid means; with fewer it is kept only when it
|
|
635
|
+
exceeds the limit, otherwise MDA8 and `exceeded` are empty. Equal maxima
|
|
636
|
+
report the earliest window.
|
|
637
|
+
- A station-day exceeds when MDA8 > 160 μg/m³ (`AQ_LIMITS_2026` O3 8h);
|
|
638
|
+
exactly 160 does not.
|
|
639
|
+
- The other variables use the daily mean of the hourly variable over the
|
|
640
|
+
same day (GB 3095—2026 3.10), which needs at least 20 valid hours
|
|
641
|
+
(table 4); with fewer the day is not judged, whatever its partial mean.
|
|
642
|
+
The limits are the transitional grade II daily limits of `AQ_LIMITS_2026`:
|
|
643
|
+
PM2.5 60, PM10 120, NO2 80, SO2 150 μg/m³ and CO 4 mg/m³ (CO stays in
|
|
644
|
+
mg/m³ everywhere). The files' `*_24h` columns are trailing 24-hour means
|
|
645
|
+
and are not read. One day draws the hourly values above and each
|
|
646
|
+
station's daily mean as bars below with the daily limit; NO2, SO2 and CO
|
|
647
|
+
also show their 1-hour limit (200, 500 μg/m³, 10 mg/m³) on the hourly
|
|
648
|
+
values as a reference, but stations are judged by the daily mean only. The judged layer is
|
|
649
|
+
`daily_mean` (quantity `<VAR>_daily_mean`) with data
|
|
650
|
+
`<name>.daily_mean.csv`; the series NetCDF holds `value` only.
|
|
651
|
+
- `DATE` is one day `YYYYMMDD` (hourly O3 above, 8-hour means below,
|
|
652
|
+
exceeding stations red and up to ten labelled) or a range
|
|
653
|
+
`YYYYMMDD-YYYYMMDD` (station × day MDA8 heat map with each day's count of
|
|
654
|
+
exceeding stations). Ranges read the hourly files in 8 processes. The image
|
|
655
|
+
is drawn whether or not any station exceeds.
|
|
656
|
+
- The sidecar has a `station` series layer (hourly O3) and an `mda8` layer
|
|
657
|
+
of kind `station_days`: `exceedance` counts exceeded over judged
|
|
658
|
+
station-days, `days` gives judged, exceeded and the highest station per
|
|
659
|
+
day, and `render.layers.station.labelled_station_ids` names the labelled
|
|
660
|
+
stations. Missing hourly files raise `missing_hours`; stations without any
|
|
661
|
+
value raise `missing_station_values`.
|
|
662
|
+
- `--meteo-hours A-B` (date ranges only) adds the region's ERA5 weather for
|
|
663
|
+
hours A..B of each day (1–24, hour 24 being the next day's 00), e.g.
|
|
664
|
+
`12-20` for the afternoon in which MDA8 windows usually fall: maximum
|
|
665
|
+
2 m temperature, mean relative humidity, summed shortwave radiation,
|
|
666
|
+
maximum boundary layer height, summed precipitation and mean 10 m wind
|
|
667
|
+
(speed, resultant u/v and the direction it blows from). ERA5 cells whose
|
|
668
|
+
centre lies in the region count equally; a day needs every hour. Panels
|
|
669
|
+
under the heat map shade the days on which any station exceeded. The
|
|
670
|
+
sidecar adds six `region_days` layers, a `<name>.meteo.csv` with one row
|
|
671
|
+
per day, and `relations.exceedance_meteo`, which compares each quantity on
|
|
672
|
+
exceeded and not-exceeded days and gives its Spearman correlation with the
|
|
673
|
+
day's highest judged value (`spearman_day_max`; `correlate_with` names
|
|
674
|
+
MDA8 or the daily mean). Missing ERA5 hours raise `missing_meteo_hours`.
|
|
675
|
+
|
|
613
676
|
## Satellite maps around a monitoring station
|
|
614
677
|
|
|
615
678
|
`radius STATION_ID DATE --km KM` draws a square centered on a national
|
|
@@ -653,7 +716,9 @@ uv run rsplot radius 1379A 202609071245 --km 5 \
|
|
|
653
716
|
Missing hourly files are errors, not a request to select another hour.
|
|
654
717
|
- Station observations are **never averaged across hours**. `NO2`, `O3`,
|
|
655
718
|
`PM2.5`, `PM10`, `SO2`, `CO`, `AQI`, and the existing derived fields are
|
|
656
|
-
supported.
|
|
719
|
+
supported. The files' `O3_8h`, `O3_8h_24h` and `O3_24h` columns do not
|
|
720
|
+
hold what their names say, so no command accepts them; `exceedance`
|
|
721
|
+
computes MDA8 from hourly `O3`.
|
|
657
722
|
The station archive and satellite files come from the configured
|
|
658
723
|
`guokong` and product folders.
|
|
659
724
|
- GEMS dates mean equal-weight averages of the day's available valid scans,
|
|
@@ -707,7 +772,7 @@ uv run rsplot raster \
|
|
|
707
772
|
# The same daily satellite field with observations at 19:00 China time.
|
|
708
773
|
uv run rsplot overlay \
|
|
709
774
|
"中山市/东区街道,中山市/南区街道,中山市/石岐街道" 20260907 \
|
|
710
|
-
--sensor gems --product o3pr --station-var
|
|
775
|
+
--sensor gems --product o3pr --station-var O3 \
|
|
711
776
|
--station-datetime 2026090719 \
|
|
712
777
|
--cf 1 --res 0.075 --smooth 0 --basemap none \
|
|
713
778
|
--output ./logs/zhongshan/three_streets_overlay.png
|
|
@@ -189,6 +189,19 @@ rsplot trend 重庆 20260520 --days 7 --var O3 --region --view mean \
|
|
|
189
189
|
rsplot overlay 合肥 20260414 --product no2 --station-var NO2 \
|
|
190
190
|
--station-datetime 2026041413 --output overlay_hefei_no2.png
|
|
191
191
|
|
|
192
|
+
# Judge every station's daily maximum 8-hour ozone (MDA8) against 160
|
|
193
|
+
# μg/m³; no regional mean. One day draws hourly O3 and 8-hour means, a
|
|
194
|
+
# range draws a station × day heat map with daily exceeding-station counts.
|
|
195
|
+
# Writes <name>.series.nc (value and o3_8h by station and hour) and
|
|
196
|
+
# <name>.mda8.csv (one row per station and day).
|
|
197
|
+
rsplot exceedance 西安市 20260614 --var O3 --output xian_o3_0614.png
|
|
198
|
+
rsplot exceedance 西安市 20260601-20260630 --var O3 --output xian_o3_06.png
|
|
199
|
+
rsplot exceedance 西安市 20260601-20261031 --var O3 --meteo-hours 12-20 --output xian_o3_meteo.png
|
|
200
|
+
# PM2.5, PM10, NO2, SO2, CO: each station's daily mean (at least 20 valid
|
|
201
|
+
# hours) against 60, 120, 80, 150 μg/m³ and 4 mg/m³; writes
|
|
202
|
+
# <name>.daily_mean.csv.
|
|
203
|
+
rsplot exceedance 西安市 20261001-20261031 --var PM2.5 --output xian_pm25_10.png
|
|
204
|
+
|
|
192
205
|
# Plot an FNR regime map over the 7 days ending on a date. The sidecar has
|
|
193
206
|
# no2, hcho and fnr layers (regime counts in the fnr layer's categories),
|
|
194
207
|
# with fnr_hefei.no2.nc, fnr_hefei.hcho.nc and fnr_hefei.fnr.nc.
|
|
@@ -369,9 +382,7 @@ a red upper extension marks this overflow. Equality is not exceedance.
|
|
|
369
382
|
|
|
370
383
|
| Station variable | Threshold (μg/m³) | Colorbar range (μg/m³) |
|
|
371
384
|
| --- | --- | --- |
|
|
372
|
-
| `O3_8h`, `O3_8h_24h` (8h O3 / MDA8 O3) | 160 | 0–180 |
|
|
373
385
|
| `O3` (hourly) | 200 | 0–220 |
|
|
374
|
-
| `O3_24h` (existing hourly-limit mapping) | 200 | 0–220 |
|
|
375
386
|
| `NO2` (hourly) | 200 | 0–220 |
|
|
376
387
|
| `NO2_24h` (daily) | 80 | 0–100 |
|
|
377
388
|
|
|
@@ -382,6 +393,58 @@ Fixed station-scale metadata appears in `render.layers.station` for
|
|
|
382
393
|
`station`, `overlay`, `radius` and `meteo`.
|
|
383
394
|
Original observations, summary statistics and exceedance counts are preserved.
|
|
384
395
|
|
|
396
|
+
## Station exceedance (O3, PM2.5, PM10, NO2, SO2, CO)
|
|
397
|
+
|
|
398
|
+
`rsplot exceedance REGION DATE --var VAR --output PNG` judges every station
|
|
399
|
+
inside the region on its own; there is no regional mean. Comma-separated
|
|
400
|
+
regions are accepted. `--var` is required: `O3` (judged by MDA8), or
|
|
401
|
+
`PM2.5`, `PM10`, `NO2`, `SO2`, `CO` (judged by the daily mean).
|
|
402
|
+
|
|
403
|
+
- MDA8 comes from hourly `O3` only. Day D uses hours D 01 through D+1 00
|
|
404
|
+
(hour 24). An 8-hour mean ending at hour t averages hours t−7..t and needs
|
|
405
|
+
at least 6 valid hours. MDA8 is the largest of the 17 means ending at hours
|
|
406
|
+
08–24 and needs at least 14 valid means; with fewer it is kept only when it
|
|
407
|
+
exceeds the limit, otherwise MDA8 and `exceeded` are empty. Equal maxima
|
|
408
|
+
report the earliest window.
|
|
409
|
+
- A station-day exceeds when MDA8 > 160 μg/m³ (`AQ_LIMITS_2026` O3 8h);
|
|
410
|
+
exactly 160 does not.
|
|
411
|
+
- The other variables use the daily mean of the hourly variable over the
|
|
412
|
+
same day (GB 3095—2026 3.10), which needs at least 20 valid hours
|
|
413
|
+
(table 4); with fewer the day is not judged, whatever its partial mean.
|
|
414
|
+
The limits are the transitional grade II daily limits of `AQ_LIMITS_2026`:
|
|
415
|
+
PM2.5 60, PM10 120, NO2 80, SO2 150 μg/m³ and CO 4 mg/m³ (CO stays in
|
|
416
|
+
mg/m³ everywhere). The files' `*_24h` columns are trailing 24-hour means
|
|
417
|
+
and are not read. One day draws the hourly values above and each
|
|
418
|
+
station's daily mean as bars below with the daily limit; NO2, SO2 and CO
|
|
419
|
+
also show their 1-hour limit (200, 500 μg/m³, 10 mg/m³) on the hourly
|
|
420
|
+
values as a reference, but stations are judged by the daily mean only. The judged layer is
|
|
421
|
+
`daily_mean` (quantity `<VAR>_daily_mean`) with data
|
|
422
|
+
`<name>.daily_mean.csv`; the series NetCDF holds `value` only.
|
|
423
|
+
- `DATE` is one day `YYYYMMDD` (hourly O3 above, 8-hour means below,
|
|
424
|
+
exceeding stations red and up to ten labelled) or a range
|
|
425
|
+
`YYYYMMDD-YYYYMMDD` (station × day MDA8 heat map with each day's count of
|
|
426
|
+
exceeding stations). Ranges read the hourly files in 8 processes. The image
|
|
427
|
+
is drawn whether or not any station exceeds.
|
|
428
|
+
- The sidecar has a `station` series layer (hourly O3) and an `mda8` layer
|
|
429
|
+
of kind `station_days`: `exceedance` counts exceeded over judged
|
|
430
|
+
station-days, `days` gives judged, exceeded and the highest station per
|
|
431
|
+
day, and `render.layers.station.labelled_station_ids` names the labelled
|
|
432
|
+
stations. Missing hourly files raise `missing_hours`; stations without any
|
|
433
|
+
value raise `missing_station_values`.
|
|
434
|
+
- `--meteo-hours A-B` (date ranges only) adds the region's ERA5 weather for
|
|
435
|
+
hours A..B of each day (1–24, hour 24 being the next day's 00), e.g.
|
|
436
|
+
`12-20` for the afternoon in which MDA8 windows usually fall: maximum
|
|
437
|
+
2 m temperature, mean relative humidity, summed shortwave radiation,
|
|
438
|
+
maximum boundary layer height, summed precipitation and mean 10 m wind
|
|
439
|
+
(speed, resultant u/v and the direction it blows from). ERA5 cells whose
|
|
440
|
+
centre lies in the region count equally; a day needs every hour. Panels
|
|
441
|
+
under the heat map shade the days on which any station exceeded. The
|
|
442
|
+
sidecar adds six `region_days` layers, a `<name>.meteo.csv` with one row
|
|
443
|
+
per day, and `relations.exceedance_meteo`, which compares each quantity on
|
|
444
|
+
exceeded and not-exceeded days and gives its Spearman correlation with the
|
|
445
|
+
day's highest judged value (`spearman_day_max`; `correlate_with` names
|
|
446
|
+
MDA8 or the daily mean). Missing ERA5 hours raise `missing_meteo_hours`.
|
|
447
|
+
|
|
385
448
|
## Satellite maps around a monitoring station
|
|
386
449
|
|
|
387
450
|
`radius STATION_ID DATE --km KM` draws a square centered on a national
|
|
@@ -425,7 +488,9 @@ uv run rsplot radius 1379A 202609071245 --km 5 \
|
|
|
425
488
|
Missing hourly files are errors, not a request to select another hour.
|
|
426
489
|
- Station observations are **never averaged across hours**. `NO2`, `O3`,
|
|
427
490
|
`PM2.5`, `PM10`, `SO2`, `CO`, `AQI`, and the existing derived fields are
|
|
428
|
-
supported.
|
|
491
|
+
supported. The files' `O3_8h`, `O3_8h_24h` and `O3_24h` columns do not
|
|
492
|
+
hold what their names say, so no command accepts them; `exceedance`
|
|
493
|
+
computes MDA8 from hourly `O3`.
|
|
429
494
|
The station archive and satellite files come from the configured
|
|
430
495
|
`guokong` and product folders.
|
|
431
496
|
- GEMS dates mean equal-weight averages of the day's available valid scans,
|
|
@@ -479,7 +544,7 @@ uv run rsplot raster \
|
|
|
479
544
|
# The same daily satellite field with observations at 19:00 China time.
|
|
480
545
|
uv run rsplot overlay \
|
|
481
546
|
"中山市/东区街道,中山市/南区街道,中山市/石岐街道" 20260907 \
|
|
482
|
-
--sensor gems --product o3pr --station-var
|
|
547
|
+
--sensor gems --product o3pr --station-var O3 \
|
|
483
548
|
--station-datetime 2026090719 \
|
|
484
549
|
--cf 1 --res 0.075 --smooth 0 --basemap none \
|
|
485
550
|
--output ./logs/zhongshan/three_streets_overlay.png
|
|
@@ -387,7 +387,7 @@ def station(
|
|
|
387
387
|
var: str = typer.Option(
|
|
388
388
|
...,
|
|
389
389
|
"--var",
|
|
390
|
-
help="变量名: AQI, PM2.5, PM2.5_24h, PM10, PM10_24h, SO2, SO2_24h, NO2, NO2_24h, O3,
|
|
390
|
+
help="变量名: AQI, PM2.5, PM2.5_24h, PM10, PM10_24h, SO2, SO2_24h, NO2, NO2_24h, O3, CO, CO_24h",
|
|
391
391
|
),
|
|
392
392
|
output: str = typer.Option(
|
|
393
393
|
...,
|
|
@@ -441,7 +441,7 @@ def trend(
|
|
|
441
441
|
var: str = typer.Option(
|
|
442
442
|
...,
|
|
443
443
|
"--var",
|
|
444
|
-
help="变量名: AQI, PM2.5, PM10, NO2, O3, SO2, CO
|
|
444
|
+
help="变量名: AQI, PM2.5, PM10, NO2, O3, SO2, CO",
|
|
445
445
|
),
|
|
446
446
|
output: str = typer.Option(
|
|
447
447
|
...,
|
|
@@ -507,6 +507,84 @@ def trend(
|
|
|
507
507
|
)
|
|
508
508
|
|
|
509
509
|
|
|
510
|
+
@app.command()
|
|
511
|
+
def exceedance(
|
|
512
|
+
target: str = typer.Argument(
|
|
513
|
+
...,
|
|
514
|
+
help="区域名称(可用逗号分隔);使用 --station 时为站点 ID",
|
|
515
|
+
),
|
|
516
|
+
date_arg: str = typer.Argument(
|
|
517
|
+
...,
|
|
518
|
+
metavar="DATE",
|
|
519
|
+
help="单日 YYYYMMDD(逐小时图)或日期区间 YYYYMMDD-YYYYMMDD(站点×日热图)",
|
|
520
|
+
),
|
|
521
|
+
# --- Required options ---
|
|
522
|
+
var: str = typer.Option(
|
|
523
|
+
...,
|
|
524
|
+
"--var",
|
|
525
|
+
help=(
|
|
526
|
+
"污染物:O3(由逐小时值计算 MDA8,限值 160);PM2.5、PM10、"
|
|
527
|
+
"NO2、SO2、CO(由逐小时值计算日均值,限值 60、120、80、150 "
|
|
528
|
+
"μg/m³ 和 4 mg/m³);all 同时筛查六项污染物"
|
|
529
|
+
),
|
|
530
|
+
),
|
|
531
|
+
output: str = typer.Option(
|
|
532
|
+
...,
|
|
533
|
+
"--output",
|
|
534
|
+
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
535
|
+
),
|
|
536
|
+
station: bool = typer.Option(
|
|
537
|
+
False, "--station", help="按单个国控站点 ID 判断",
|
|
538
|
+
),
|
|
539
|
+
# --- Weather ---
|
|
540
|
+
meteo_hours: str | None = typer.Option(
|
|
541
|
+
None,
|
|
542
|
+
"--meteo-hours",
|
|
543
|
+
help=(
|
|
544
|
+
"加入 ERA5 逐日区域气象:每天 A-B 时(1–24,24 为次日 00 时)"
|
|
545
|
+
"的最高气温、平均相对湿度、短波辐射、最大边界层高度、降水和"
|
|
546
|
+
"10 m 风,并比较超标日与未超标日;仅用于区域、单一污染物和日期区间,如 12-20"
|
|
547
|
+
),
|
|
548
|
+
),
|
|
549
|
+
# --- Plotting ---
|
|
550
|
+
dpi: int | None = typer.Option(300, "--dpi", help="输出 DPI"),
|
|
551
|
+
title: str | None = typer.Option(None, "--title", help="自定义标题"),
|
|
552
|
+
) -> None:
|
|
553
|
+
"""逐站判断 O3 的 MDA8 或其他污染物的日均值是否超过 GB 3095 限值。
|
|
554
|
+
|
|
555
|
+
每个站点单独判断,不计算区域均值。D 日使用 D 日 01 时至次日 00 时。
|
|
556
|
+
O3:8 小时均值至少 6 个有效小时,MDA8 取 08–24 时结束的 17 个均值的
|
|
557
|
+
最大值,至少 14 个有效均值(不足但超过限值时仍判超标),限值 160。
|
|
558
|
+
PM2.5、PM10、NO2、SO2、CO:日均值至少 20 个有效小时(GB 3095—2026
|
|
559
|
+
表 4),限值为过渡阶段二级日均值;不读文件中的 *_24h 滑动均值列。
|
|
560
|
+
NO2、SO2、CO 的 1 小时限值只在单日图中作为参考线。
|
|
561
|
+
--var all 绘制六种污染物的逐日超标站数,灰色表示当天无可判断站点。
|
|
562
|
+
--station 直接按站点 ID 查询;区域模式按行政区汇总超标站日。
|
|
563
|
+
--meteo-hours 为日期区间加入 ERA5 逐日区域气象(中心落在区域内的格点
|
|
564
|
+
等权平均),按"任一站点超标"分组比较超标日与未超标日。
|
|
565
|
+
|
|
566
|
+
示例:
|
|
567
|
+
rsplot exceedance 西安市 20260614 --var O3 --output xian_o3_0614.png
|
|
568
|
+
rsplot exceedance 西安,咸阳 20260601-20260630 --var all --output all.png
|
|
569
|
+
rsplot exceedance 1279A 20260614 --station --var PM2.5 --output pm.png
|
|
570
|
+
rsplot exceedance 西安 20260601-20260630 --var O3 \
|
|
571
|
+
--meteo-hours 12-20 --output w.png
|
|
572
|
+
"""
|
|
573
|
+
from rsplot.commands.exceedance import run_exceedance
|
|
574
|
+
|
|
575
|
+
run_exceedance(
|
|
576
|
+
target=target,
|
|
577
|
+
station=station,
|
|
578
|
+
date_arg=date_arg,
|
|
579
|
+
var=var,
|
|
580
|
+
meteo_hours=meteo_hours,
|
|
581
|
+
output=output,
|
|
582
|
+
dpi=dpi,
|
|
583
|
+
title=title,
|
|
584
|
+
console=console,
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
|
|
510
588
|
@app.command()
|
|
511
589
|
def overlay(
|
|
512
590
|
region: str = typer.Argument(
|
|
@@ -532,7 +610,7 @@ def overlay(
|
|
|
532
610
|
station_var: str = typer.Option(
|
|
533
611
|
...,
|
|
534
612
|
"--station-var",
|
|
535
|
-
help="站点变量名,如 NO2 / O3
|
|
613
|
+
help="站点变量名,如 NO2 / O3;与卫星产品无默认配对",
|
|
536
614
|
),
|
|
537
615
|
output: str = typer.Option(
|
|
538
616
|
...,
|
|
@@ -645,8 +723,11 @@ def fnr(
|
|
|
645
723
|
),
|
|
646
724
|
date_arg: str = typer.Argument(
|
|
647
725
|
...,
|
|
648
|
-
help=
|
|
649
|
-
|
|
726
|
+
help=(
|
|
727
|
+
"TROPOMI: 单日 (YYYYMMDD,配合 --days N) 或范围 "
|
|
728
|
+
"(YYYYMMDD-YYYYMMDD,闭区间);"
|
|
729
|
+
"GEMS 还支持 12 位单次扫描 (YYYYMMDDHHMM)"
|
|
730
|
+
),
|
|
650
731
|
),
|
|
651
732
|
# --- Required options ---
|
|
652
733
|
output: str = typer.Option(
|
|
@@ -655,20 +736,26 @@ def fnr(
|
|
|
655
736
|
help="输出 .png 文件路径(不能是目录),同时写同名 JSON",
|
|
656
737
|
),
|
|
657
738
|
# --- Data selection and processing ---
|
|
739
|
+
sensor: str = typer.Option(
|
|
740
|
+
"tropomi", "--sensor", help="卫星来源: tropomi / gems"
|
|
741
|
+
),
|
|
658
742
|
processing: str | None = typer.Option(
|
|
659
743
|
None,
|
|
660
744
|
"--processing",
|
|
661
|
-
help="TROPOMI 处理流: nrti,同时用于 NO2 与 HCHO",
|
|
745
|
+
help="TROPOMI 处理流: nrti,同时用于 NO2 与 HCHO;GEMS 不适用",
|
|
662
746
|
),
|
|
663
747
|
days: int | None = typer.Option(
|
|
664
748
|
None,
|
|
665
749
|
"--days",
|
|
666
|
-
help=
|
|
750
|
+
help=(
|
|
751
|
+
"以单日 DATE 为结束日的窗口天数;"
|
|
752
|
+
"单日 DATE 必填,日期区间或 GEMS 单次扫描时不可用"
|
|
753
|
+
),
|
|
667
754
|
),
|
|
668
755
|
n_min: int | None = typer.Option(
|
|
669
756
|
None,
|
|
670
757
|
"--n-min",
|
|
671
|
-
help="每像元最少有效天数,默认 max(3, 窗口天数 // 2)",
|
|
758
|
+
help="每像元最少有效天数,默认 max(3, 窗口天数 // 2);单次扫描固定为 1",
|
|
672
759
|
),
|
|
673
760
|
no2_min: float = typer.Option(
|
|
674
761
|
0.5,
|
|
@@ -688,9 +775,9 @@ def fnr(
|
|
|
688
775
|
),
|
|
689
776
|
res: float | None = typer.Option(None, "--res", help="网格分辨率 (度)"),
|
|
690
777
|
qa: float | None = typer.Option(
|
|
691
|
-
|
|
778
|
+
None,
|
|
692
779
|
"--qa",
|
|
693
|
-
help="QA 阈值 (0-1)
|
|
780
|
+
help="TROPOMI QA 阈值 (0-1),默认取配置;GEMS 不适用",
|
|
694
781
|
),
|
|
695
782
|
cf: float = typer.Option(
|
|
696
783
|
0.5,
|
|
@@ -729,6 +816,7 @@ def fnr(
|
|
|
729
816
|
from rsplot.commands.fnr import run_fnr
|
|
730
817
|
|
|
731
818
|
run_fnr(
|
|
819
|
+
sensor=sensor,
|
|
732
820
|
processing=processing,
|
|
733
821
|
region=region,
|
|
734
822
|
date_arg=date_arg,
|
|
@@ -222,3 +222,27 @@ def satellite_errors(function: Callable[_P, _R]) -> Callable[_P, _R]:
|
|
|
222
222
|
raise typer.Exit(1) from error
|
|
223
223
|
|
|
224
224
|
return wrapped
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
# Station-file columns whose contents do not match their names.
|
|
228
|
+
REMOVED_STATION_VARS = ("O3_8h", "O3_8h_24h", "O3_24h")
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def require_station_var(var: str, option: str) -> None:
|
|
232
|
+
"""Reject unknown station variables and the removed ozone summaries."""
|
|
233
|
+
from rsplot.config import STATION_VAR_META
|
|
234
|
+
|
|
235
|
+
if var in REMOVED_STATION_VARS:
|
|
236
|
+
raise RsplotError(
|
|
237
|
+
"invalid_argument",
|
|
238
|
+
f"不再支持 '{var}':站点文件中的该字段与其名称不符。"
|
|
239
|
+
"判断 O3 是否超标请用 exceedance 命令,它由逐小时 O3 计算 MDA8。",
|
|
240
|
+
option=option,
|
|
241
|
+
)
|
|
242
|
+
if var not in STATION_VAR_META:
|
|
243
|
+
noun = "变量" if option == "--var" else "站点变量"
|
|
244
|
+
raise RsplotError(
|
|
245
|
+
"invalid_argument",
|
|
246
|
+
f"未知{noun} '{var}'。可用: {', '.join(STATION_VAR_META)}",
|
|
247
|
+
option=option,
|
|
248
|
+
)
|