feat: 新增移动优势弱覆盖用户热力图

This commit is contained in:
RBP15P
2026-07-19 23:03:44 +08:00
parent a1903d6284
commit a29d07ca77
7 changed files with 335 additions and 38 deletions
+183 -21
View File
@@ -31,6 +31,7 @@ GIS_PROJECT_SOURCE = MAP_PARK_DIR / "GIS.qgz" # 每个市场网格结果包要
RSRP_FIELD = "ssb_rsrp_dl" # 用于生成热力图的电信 RSRP 字段名。
EXCELLENT_CELL_FIELD = "mro_total_dl" # 用于生成用户量热力图的字段名,值越大越红。
WEAK_COVER_FIELD = "rsrp_lt_neg105_dl" # 用于生成信号差用户量热力图的字段名,值越大越红。
MOBILE_RSRP_FIELD = "ssb_rsrp_yd" # 移动 RSRP 字段名,用于筛选移动信号达到正常水平的 Grid。
MARKET_LAYER = None # 市场网格图层名;None 表示自动使用 GPKG 中第一个 feature 图层。
GRID_LAYER = None # Grid 指标图层名;None 表示自动使用 GPKG 中第一个 feature 图层。
BUILDING_LAYER = None # Building 建筑指标图层名;None 表示自动使用 GPKG 中第一个 feature 图层。
@@ -56,6 +57,10 @@ PROJECT_EXTENT_PADDING_RATIO = 0.05 # QGIS 打开后的画布留白比例;0.0
USER_COUNT_OUTPUT_FILENAME = "用户量.tif" # 采样点数量热力图输出文件名。
WEAK_COVER_OUTPUT_FILENAME = "信号差用户量.tif" # 信号差用户量热力图输出文件名。
WEAK_COVER_RATIO_OUTPUT_FILENAME = "弱覆盖占比.tif" # 弱覆盖采样点占总采样点比例的分级 TIF 输出文件名。
MOBILE_ADVANTAGE_OUTPUT_FILENAME = "移动优势弱覆盖用户.tif" # 移动信号好且电信弱覆盖用户聚集的目标热力图文件名。
MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD = -95.0 # 移动信号门槛;仅 ssb_rsrp_yd 严格大于该值的 Grid 参与目标热力图。
MOBILE_ADVANTAGE_YELLOW_PERCENTILE = 0.75 # 目标热力图黄色锚点百分位;高于该位置的热点逐步由黄色趋向红色。
MOBILE_ADVANTAGE_SMOOTH_RADIUS = 5 # 目标热力图平滑半径;默认 5 以保留定位精度,可改为 10 或其他非负整数。
WEAK_COVER_RATIO_GREEN_ANCHOR = 0.0 # 弱覆盖占比连续色带绿色端点,单位为百分比。
WEAK_COVER_RATIO_BLUE_ANCHOR = 5.0 # 弱覆盖占比连续色带蓝色锚点,单位为百分比。
WEAK_COVER_RATIO_YELLOW_ANCHOR = 10.0 # 弱覆盖占比连续色带黄色锚点,单位为百分比。
@@ -65,7 +70,7 @@ WEAK_COVER_RATIO_BLUE = (0, 112, 255) # 弱覆盖占比偏低档颜色。
WEAK_COVER_RATIO_YELLOW = (255, 255, 0) # 弱覆盖占比偏高档颜色。
WEAK_COVER_RATIO_RED = (255, 0, 0) # 弱覆盖占比高值档颜色。
SUMMARY_OUTPUT_ENABLED = True # 是否额外生成全部市场网格汇总 TIF 结果包。
SUMMARY_OUTPUT_FILENAME = "所有网格汇总.zip" # 汇总结果包文件名,包含四张 TIF、GIS.qgz 和完整 BuildingInfo.gpkg。
SUMMARY_OUTPUT_FILENAME = "所有网格汇总.zip" # 汇总结果包文件名,包含五张 TIF、GIS.qgz 和完整 BuildingInfo.gpkg。
SUMMARY_MARKET_CODE = "所有网格汇总" # 汇总任务在日志和 summary.json 中使用的标识。
SUMMARY_MAX_RASTER_PIXELS = 100_000_000 # 汇总 TIF 最大像元数;提高该值可增强清晰度,但会增加内存、耗时和文件体积。
EXCELLENT_PERCENT_STEPS = (0.25, 0.5, 0.75) # 按最终有效像元降序四等分,取 25%、50%、75% 位置作为结果记录阈值。
@@ -155,6 +160,10 @@ def weak_cover_ratio_raster_filename():
return WEAK_COVER_RATIO_OUTPUT_FILENAME
def mobile_advantage_raster_filename():
return MOBILE_ADVANTAGE_OUTPUT_FILENAME
def set_xml_extent(extent_element, extent):
for tag, value in zip(("xmin", "ymin", "xmax", "ymax"), extent):
child = extent_element.find(tag)
@@ -181,7 +190,7 @@ def serialize_qgis_project(root, original_data):
return bom + (doctype + b"\r\n" if doctype else b"") + xml_data
def copy_gis_project_to_market(source_path, output_path, market, building_extent):
def copy_gis_project_to_market(source_path, output_path, market, building_extent, raster_extent=None):
if output_path.exists() and not OVERWRITE:
return {
"market_code": market.code,
@@ -193,6 +202,7 @@ def copy_gis_project_to_market(source_path, output_path, market, building_extent
extent_source = "building_info" if building_extent is not None else "market"
layer_extent = tuple(building_extent) if building_extent is not None else market.geometry.bounds
raster_layer_extent = tuple(raster_extent) if raster_extent is not None else market.geometry.bounds
canvas_extent = padded_extent(layer_extent, PROJECT_EXTENT_PADDING_RATIO)
temp_output_path = output_path.with_name(f".{output_path.name}.tmp")
if temp_output_path.exists():
@@ -238,16 +248,17 @@ def copy_gis_project_to_market(source_path, output_path, market, building_extent
USER_COUNT_OUTPUT_FILENAME,
WEAK_COVER_OUTPUT_FILENAME,
WEAK_COVER_RATIO_OUTPUT_FILENAME,
MOBILE_ADVANTAGE_OUTPUT_FILENAME,
}
for layer in root.findall(".//projectlayers/maplayer"):
datasource = (layer.findtext("datasource") or "").replace("\\", "/")
if Path(datasource).name not in raster_filenames:
continue
for extent_tag in ("extent", "wgs84extent"):
raster_extent = layer.find(extent_tag)
if raster_extent is None:
raster_extent = ET.SubElement(layer, extent_tag)
set_xml_extent(raster_extent, market.geometry.bounds)
raster_extent_element = layer.find(extent_tag)
if raster_extent_element is None:
raster_extent_element = ET.SubElement(layer, extent_tag)
set_xml_extent(raster_extent_element, raster_layer_extent)
data = serialize_qgis_project(root, data)
target_zip.writestr(info, data)
temp_output_path.replace(output_path)
@@ -264,6 +275,7 @@ def copy_gis_project_to_market(source_path, output_path, market, building_extent
"project_member": project_member,
"extent_source": extent_source,
"building_extent": list(layer_extent),
"raster_extent": list(raster_layer_extent),
"canvas_extent": list(canvas_extent),
"padding_ratio": PROJECT_EXTENT_PADDING_RATIO,
"bytes": output_path.stat().st_size,
@@ -952,6 +964,7 @@ def percentile_scores_for_values(values, data_mask, anchor_scores=(0.0, 0.5, 1.0
unique_values, inverse, counts = np.unique(valid_values, return_inverse=True, return_counts=True)
if unique_values.size == 1:
scores[data_mask] = anchor_scores[len(anchor_scores) // 2]
return scores, [float(unique_values[0])] * len(anchor_scores)
cumulative_before = np.cumsum(counts, dtype=np.int64) - counts
@@ -1025,6 +1038,11 @@ def gaussian_kernel(radius):
return kernel / kernel.sum()
def validate_smoothing_radius(name, radius):
if isinstance(radius, bool) or not isinstance(radius, int) or radius < 0:
raise ValueError(f"{name} 必须是非负整数")
def convolve_axis(array, kernel, axis):
if kernel.size == 1:
return array
@@ -1060,6 +1078,14 @@ def to_float(value):
return None
def mobile_advantage_target_value(mobile_rsrp, weak_cover_users):
if mobile_rsrp is None or weak_cover_users is None:
return None
if mobile_rsrp <= MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD or weak_cover_users <= 0:
return None
return weak_cover_users
def geotiff_extratags(minx, maxy, pixel_width, pixel_height):
model_pixel_scale = (pixel_width, pixel_height, 0.0)
model_tiepoint = (0.0, 0.0, 0.0, minx, maxy, 0.0)
@@ -1143,19 +1169,23 @@ def market_raster_layout(bounds, pixel_width, pixel_height, max_raster_pixels=No
return minx, miny, maxx, maxy, pixel_width, pixel_height, width, height, scale_factor
def smooth_weighted_values(value_sum, value_weight):
def smooth_weighted_values(value_sum, value_weight, radius):
data_mask = value_weight > 0
smoothed_value = np.zeros_like(value_sum)
if np.any(data_mask):
smoothed_sum = gaussian_blur(value_sum, HEATMAP_SMOOTH_RADIUS)
smoothed_weight = gaussian_blur(value_weight, HEATMAP_SMOOTH_RADIUS)
smoothed_sum = gaussian_blur(value_sum, radius)
smoothed_weight = gaussian_blur(value_weight, radius)
np.divide(smoothed_sum, smoothed_weight, out=smoothed_value, where=smoothed_weight > 0)
return smoothed_value, data_mask
def render_signal_raster(state, market, output_path, minx, maxy, pixel_width, pixel_height, width, height, candidates):
image = np.full((height, width, 4), TRANSPARENT_PIXEL, dtype=np.uint8)
smoothed_value, data_mask = smooth_weighted_values(state["value_sum"], state["value_weight"])
smoothed_value, data_mask = smooth_weighted_values(
state["value_sum"],
state["value_weight"],
HEATMAP_SMOOTH_RADIUS,
)
if np.any(data_mask):
image[data_mask, :3] = heatmap_rgb_for_values(smoothed_value)[data_mask]
image[data_mask, 3] = HEATMAP_ALPHA
@@ -1204,16 +1234,22 @@ def render_percentile_heatmap_raster(
width,
height,
candidates,
yellow_percentile,
smooth_radius,
):
image = np.full((height, width, 4), TRANSPARENT_PIXEL, dtype=np.uint8)
smoothed_value, data_mask = smooth_weighted_values(state["value_sum"], state["value_weight"])
smoothed_value, data_mask = smooth_weighted_values(
state["value_sum"],
state["value_weight"],
smooth_radius,
)
anchor_values = []
if np.any(data_mask):
anchor_scores = (0.0, WEAK_COVER_YELLOW_PERCENTILE, 1.0)
anchor_scores = (0.0, yellow_percentile, 1.0)
scores, anchor_values = percentile_scores_for_values(smoothed_value, data_mask, anchor_scores)
image[data_mask, :3] = continuous_heatmap_rgb_for_scores(
scores,
yellow_score=WEAK_COVER_YELLOW_PERCENTILE,
yellow_score=yellow_percentile,
)[data_mask]
image[data_mask, 3] = HEATMAP_ALPHA
@@ -1227,13 +1263,13 @@ def render_percentile_heatmap_raster(
"data_pixels": int(np.count_nonzero(data_mask)),
"skipped_no_value": state["skipped_no_value"],
"color_mode": "continuous_percentile",
"yellow_percentile": WEAK_COVER_YELLOW_PERCENTILE,
"yellow_percentile": yellow_percentile,
"color_anchor_values": {
"green": anchor_values[0],
"yellow": anchor_values[1],
"red": anchor_values[2],
} if anchor_values else None,
"smooth_radius": HEATMAP_SMOOTH_RADIUS,
"smooth_radius": smooth_radius,
"width": width,
"height": height,
"skipped": False,
@@ -1253,7 +1289,11 @@ def render_weak_cover_ratio_raster(
candidates,
):
image = np.full((height, width, 4), TRANSPARENT_PIXEL, dtype=np.uint8)
smoothed_value, data_mask = smooth_weighted_values(state["value_sum"], state["value_weight"])
smoothed_value, data_mask = smooth_weighted_values(
state["value_sum"],
state["value_weight"],
HEATMAP_SMOOTH_RADIUS,
)
if np.any(data_mask):
image[data_mask, :3] = weak_cover_ratio_rgb_for_values(smoothed_value)[data_mask]
image[data_mask, 3] = HEATMAP_ALPHA
@@ -1344,6 +1384,7 @@ def export_market_grid_outputs(
user_count_path,
weak_cover_path,
weak_cover_ratio_path,
mobile_advantage_path,
csv_path,
max_raster_pixels=None,
):
@@ -1353,7 +1394,7 @@ def export_market_grid_outputs(
pixel_height,
max_raster_pixels,
)
raster_fields = (RSRP_FIELD, EXCELLENT_CELL_FIELD, WEAK_COVER_FIELD)
raster_fields = (RSRP_FIELD, EXCELLENT_CELL_FIELD, WEAK_COVER_FIELD, MOBILE_RSRP_FIELD)
skipped_no_value = {field: 0 for field in raster_fields}
painted_cells = {field: 0 for field in raster_fields}
raster_cells = []
@@ -1444,6 +1485,7 @@ def export_market_grid_outputs(
numeric_values[RSRP_FIELD],
numeric_values[EXCELLENT_CELL_FIELD],
numeric_values[WEAK_COVER_FIELD],
numeric_values[MOBILE_RSRP_FIELD],
)
)
finally:
@@ -1500,6 +1542,8 @@ def export_market_grid_outputs(
width,
height,
candidates,
WEAK_COVER_YELLOW_PERCENTILE,
HEATMAP_SMOOTH_RADIUS,
)
del weak_cover_state
@@ -1538,7 +1582,70 @@ def export_market_grid_outputs(
)
del ratio_state, ratio_value_sum, ratio_value_weight
for result in (signal_result, user_count_result, weak_cover_result, weak_cover_ratio_result):
mobile_advantage_value_sum = np.zeros((height, width), dtype=np.float32)
mobile_advantage_value_weight = np.zeros((height, width), dtype=np.uint16)
mobile_advantage_cells = 0
excluded_by_mobile_gate = 0
excluded_without_weak_users = 0
for cell in raster_cells:
mobile_rsrp = cell[7]
weak_cover_users = cell[6]
target_value = mobile_advantage_target_value(mobile_rsrp, weak_cover_users)
if target_value is None:
if mobile_rsrp is None or mobile_rsrp <= MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD:
excluded_by_mobile_gate += 1
else:
excluded_without_weak_users += 1
continue
row_start, row_stop, col_start, col_stop = cell[:4]
mobile_advantage_value_sum[row_start:row_stop, col_start:col_stop] += target_value
mobile_advantage_value_weight[row_start:row_stop, col_start:col_stop] += 1
mobile_advantage_cells += 1
mobile_advantage_state = {
"value_sum": mobile_advantage_value_sum,
"value_weight": mobile_advantage_value_weight,
"painted_cells": mobile_advantage_cells,
"skipped_no_value": excluded_by_mobile_gate + excluded_without_weak_users,
}
mobile_advantage_result = render_percentile_heatmap_raster(
mobile_advantage_state,
market,
mobile_advantage_path,
minx,
maxy,
pixel_width,
pixel_height,
width,
height,
candidates,
MOBILE_ADVANTAGE_YELLOW_PERCENTILE,
MOBILE_ADVANTAGE_SMOOTH_RADIUS,
)
mobile_advantage_result.update({
"gate_field": MOBILE_RSRP_FIELD,
"gate_operator": ">",
"gate_threshold": MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD,
"value_field": WEAK_COVER_FIELD,
"zero_weak_cover_is_transparent": True,
"eligible_cells": mobile_advantage_cells,
"excluded_by_mobile_gate": excluded_by_mobile_gate,
"excluded_without_weak_users": excluded_without_weak_users,
})
del mobile_advantage_state, mobile_advantage_value_sum, mobile_advantage_value_weight
for result in (
signal_result,
user_count_result,
weak_cover_result,
weak_cover_ratio_result,
mobile_advantage_result,
):
result["raster_extent"] = [
minx,
maxy - height * pixel_height,
minx + width * pixel_width,
maxy,
]
result["pixel_width"] = pixel_width
result["pixel_height"] = pixel_height
result["resolution_scale_factor"] = scale_factor
@@ -1552,7 +1659,14 @@ def export_market_grid_outputs(
"row_count": csv_rows,
"skipped": csv_skipped,
}
return signal_result, user_count_result, weak_cover_result, weak_cover_ratio_result, csv_result
return (
signal_result,
user_count_result,
weak_cover_result,
weak_cover_ratio_result,
mobile_advantage_result,
csv_result,
)
def write_heatmap_legend(output_dir, field):
@@ -1605,6 +1719,19 @@ def write_weak_cover_ratio_legend(output_dir):
return legend_path
def write_mobile_advantage_legend(output_dir):
legend_path = output_dir / "mobile_advantage_legend.csv"
with legend_path.open("w", newline="", encoding="utf-8-sig") as file:
writer = csv.writer(file)
writer.writerow(["gate", "value_field", "percentile_anchor", "red", "green", "blue", "alpha", "meaning"])
gate = f"{MOBILE_RSRP_FIELD} > {MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD}"
writer.writerow([gate, WEAK_COVER_FIELD, "highest_value", *CONTINUOUS_HEATMAP_RED, HEATMAP_ALPHA, "most target weak-cover users"])
writer.writerow([gate, WEAK_COVER_FIELD, f"percentile_{MOBILE_ADVANTAGE_YELLOW_PERCENTILE}", *CONTINUOUS_HEATMAP_YELLOW, HEATMAP_ALPHA, "continuous yellow anchor"])
writer.writerow([gate, WEAK_COVER_FIELD, "lowest_positive_value", *CONTINUOUS_HEATMAP_GREEN, HEATMAP_ALPHA, "fewest target weak-cover users"])
writer.writerow([gate, WEAK_COVER_FIELD, "gate_failed_or_zero", 0, 0, 0, 0, "transparent non-target area"])
return legend_path
@contextmanager
def open_read_connection(path):
conn = sqlite3.connect(path)
@@ -1669,9 +1796,17 @@ def process_market(market, pixel_width, pixel_height, output_dir):
user_count_path = market_dir / excellent_heatmap_raster_filename(EXCELLENT_CELL_FIELD)
weak_cover_path = market_dir / weak_cover_heatmap_raster_filename(WEAK_COVER_FIELD)
weak_cover_ratio_path = market_dir / weak_cover_ratio_raster_filename()
mobile_advantage_path = market_dir / mobile_advantage_raster_filename()
grid_metrics_path = market_dir / GRID_METRICS_CSV_FILENAME
grid_started_at = perf_counter()
signal_result, user_count_result, weak_cover_result, weak_cover_ratio_result, grid_metrics_result = export_market_grid_outputs(
(
signal_result,
user_count_result,
weak_cover_result,
weak_cover_ratio_result,
mobile_advantage_result,
grid_metrics_result,
) = export_market_grid_outputs(
grid_conn,
grid_layer,
grid_rtree,
@@ -1682,6 +1817,7 @@ def process_market(market, pixel_width, pixel_height, output_dir):
user_count_path,
weak_cover_path,
weak_cover_ratio_path,
mobile_advantage_path,
grid_metrics_path,
)
grid_elapsed = perf_counter() - grid_started_at
@@ -1700,6 +1836,7 @@ def process_market(market, pixel_width, pixel_height, output_dir):
gis_project_path,
market,
building_info_result["extent"],
signal_result["raster_extent"],
)
building_metrics_path = market_dir / BUILDING_METRICS_CSV_FILENAME
building_metrics_result = export_market_building_metrics_csv(
@@ -1727,6 +1864,7 @@ def process_market(market, pixel_width, pixel_height, output_dir):
"excellent_heatmap_result": rewrite_result_for_zip(user_count_result, zip_path, market_dir),
"weak_cover_heatmap_result": rewrite_result_for_zip(weak_cover_result, zip_path, market_dir),
"weak_cover_ratio_result": rewrite_result_for_zip(weak_cover_ratio_result, zip_path, market_dir),
"mobile_advantage_result": rewrite_result_for_zip(mobile_advantage_result, zip_path, market_dir),
"building_info_result": rewrite_result_for_zip(building_info_result, zip_path, market_dir),
"building_metrics_csv_result": rewrite_result_for_zip(building_metrics_result, zip_path, market_dir),
"grid_metrics_csv_result": rewrite_result_for_zip(grid_metrics_result, zip_path, market_dir),
@@ -1768,7 +1906,15 @@ def process_summary_grid_outputs(markets, pixel_width, pixel_height, output_dir)
user_count_path = summary_dir / excellent_heatmap_raster_filename(EXCELLENT_CELL_FIELD)
weak_cover_path = summary_dir / weak_cover_heatmap_raster_filename(WEAK_COVER_FIELD)
weak_cover_ratio_path = summary_dir / weak_cover_ratio_raster_filename()
signal_result, user_count_result, weak_cover_result, weak_cover_ratio_result, _ = export_market_grid_outputs(
mobile_advantage_path = summary_dir / mobile_advantage_raster_filename()
(
signal_result,
user_count_result,
weak_cover_result,
weak_cover_ratio_result,
mobile_advantage_result,
_,
) = export_market_grid_outputs(
grid_conn,
grid_layer,
grid_rtree,
@@ -1779,6 +1925,7 @@ def process_summary_grid_outputs(markets, pixel_width, pixel_height, output_dir)
user_count_path,
weak_cover_path,
weak_cover_ratio_path,
mobile_advantage_path,
None,
SUMMARY_MAX_RASTER_PIXELS,
)
@@ -1803,6 +1950,7 @@ def process_summary_grid_outputs(markets, pixel_width, pixel_height, output_dir)
gis_project_path,
summary_market,
building_info_extent,
signal_result["raster_extent"],
)
zip_result = write_market_zip(summary_dir, zip_path, summary_market)
return {
@@ -1811,6 +1959,7 @@ def process_summary_grid_outputs(markets, pixel_width, pixel_height, output_dir)
"excellent_heatmap_result": rewrite_result_for_zip(user_count_result, zip_path, summary_dir),
"weak_cover_heatmap_result": rewrite_result_for_zip(weak_cover_result, zip_path, summary_dir),
"weak_cover_ratio_result": rewrite_result_for_zip(weak_cover_ratio_result, zip_path, summary_dir),
"mobile_advantage_result": rewrite_result_for_zip(mobile_advantage_result, zip_path, summary_dir),
"building_info_result": rewrite_result_for_zip(building_info_result, zip_path, summary_dir),
"gis_project_result": rewrite_result_for_zip(gis_project_result, zip_path, summary_dir),
"zip_result": zip_result,
@@ -1831,6 +1980,12 @@ def main():
raise ValueError("RSRP 热力图阈值必须满足 HEATMAP_BAD_RSRP < HEATMAP_MID_RSRP < HEATMAP_GOOD_RSRP")
if not 0 < WEAK_COVER_YELLOW_PERCENTILE < 1:
raise ValueError("WEAK_COVER_YELLOW_PERCENTILE 必须大于 0 且小于 1")
validate_smoothing_radius("HEATMAP_SMOOTH_RADIUS", HEATMAP_SMOOTH_RADIUS)
if not math.isfinite(MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD):
raise ValueError("MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD 必须是有限数值")
if not 0 < MOBILE_ADVANTAGE_YELLOW_PERCENTILE < 1:
raise ValueError("MOBILE_ADVANTAGE_YELLOW_PERCENTILE 必须大于 0 且小于 1")
validate_smoothing_radius("MOBILE_ADVANTAGE_SMOOTH_RADIUS", MOBILE_ADVANTAGE_SMOOTH_RADIUS)
if not 0 <= WEAK_COVER_RATIO_GREEN_ANCHOR < WEAK_COVER_RATIO_BLUE_ANCHOR < WEAK_COVER_RATIO_YELLOW_ANCHOR < WEAK_COVER_RATIO_RED_ANCHOR:
raise ValueError("弱覆盖占比锚点必须满足 0 <= GREEN < BLUE < YELLOW < RED")
if MAX_RASTER_PIXELS is not None and MAX_RASTER_PIXELS <= 0:
@@ -1898,6 +2053,7 @@ def main():
excellent_legend_path = write_excellent_heatmap_legend(OUTPUT_DIR, EXCELLENT_CELL_FIELD)
weak_cover_legend_path = write_weak_cover_heatmap_legend(OUTPUT_DIR, WEAK_COVER_FIELD)
weak_cover_ratio_legend_path = write_weak_cover_ratio_legend(OUTPUT_DIR)
mobile_advantage_legend_path = write_mobile_advantage_legend(OUTPUT_DIR)
worker_count = max(1, min(MAX_WORKERS, len(markets))) if markets else 1
print(f"市场网格数量:{len(markets)}")
print(f"并行进程数:{worker_count}")
@@ -1909,6 +2065,7 @@ def main():
print(f"用户量图例:{excellent_legend_path}")
print(f"信号差用户量图例:{weak_cover_legend_path}")
print(f"弱覆盖占比图例:{weak_cover_ratio_legend_path}")
print(f"移动优势弱覆盖用户图例:{mobile_advantage_legend_path}")
started_at = perf_counter()
outcomes = []
@@ -1958,6 +2115,7 @@ def main():
"excellent_heatmap_results": "excellent_heatmap_result",
"weak_cover_heatmap_results": "weak_cover_heatmap_result",
"weak_cover_ratio_results": "weak_cover_ratio_result",
"mobile_advantage_results": "mobile_advantage_result",
"building_info_results": "building_info_result",
"building_metrics_csv_results": "building_metrics_csv_result",
"grid_metrics_csv_results": "grid_metrics_csv_result",
@@ -1973,6 +2131,10 @@ def main():
"rsrp_field": RSRP_FIELD,
"excellent_cell_field": EXCELLENT_CELL_FIELD,
"weak_cover_field": WEAK_COVER_FIELD,
"mobile_rsrp_field": MOBILE_RSRP_FIELD,
"mobile_advantage_gate": f"{MOBILE_RSRP_FIELD} > {MOBILE_ADVANTAGE_GOOD_RSRP_THRESHOLD}",
"mobile_advantage_value_field": WEAK_COVER_FIELD,
"mobile_advantage_smooth_radius": MOBILE_ADVANTAGE_SMOOTH_RADIUS,
"weak_cover_ratio_formula": f"{WEAK_COVER_FIELD} / {EXCELLENT_CELL_FIELD} * 100",
"clip_mode": CLIP_MODE,
"scale": SCALE,