add feature

This commit is contained in:
baol 2024-11-10 09:30:14 +08:00
parent 16a92dcbe0
commit 89ebc990ed
8 changed files with 627915 additions and 509825 deletions

Binary file not shown.

View File

@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://shudfile.ghdc.ac.cn/download/lzRTM/output/lz.out/
HostUrl=https://shudfile.ghdc.ac.cn/download/lzRTM/output/lz.out/lz.SHUD

View File

@ -1,4 +0,0 @@
[ZoneTransfer]
ZoneId=3
ReferrerUrl=https://shudfile.ghdc.ac.cn/download/lzRTM/output/lz.out/
HostUrl=https://shudfile.ghdc.ac.cn/download/lzRTM/output/lz.out/lz.time.csv

24
main.py
View File

@ -75,7 +75,7 @@ def format_time(dt):
return dt.strftime("%Y-%m-%dT%H:%M:%SZ") return dt.strftime("%Y-%m-%dT%H:%M:%SZ")
def generate_river_czml(river_df, runoff_df, start_time=None): def generate_river_czml(river_df, runoff_df, level=4, start_time=None):
""" """
生成河网径流时序变化的CZML文件 生成河网径流时序变化的CZML文件
@ -96,11 +96,6 @@ def generate_river_czml(river_df, runoff_df, start_time=None):
if start_time is None: if start_time is None:
start_time = datetime(2010, 7, 20) start_time = datetime(2010, 7, 20)
# 计算径流量的最小值和最大值,用于颜色映射
min_runoff = runoff_df.values.min()
max_runoff = runoff_df.values.max()
print(min_runoff, max_runoff)
# 创建CZML文档 # 创建CZML文档
czml = [ czml = [
{ {
@ -128,13 +123,10 @@ def generate_river_czml(river_df, runoff_df, start_time=None):
new_coords = [] new_coords = []
for coord in coords: for coord in coords:
new_coords.extend([[x, y, 0] for x, y in coord]) new_coords.extend([[x, y, 0] for x, y in coord])
# new_coords.extend([coord[0], coord[1], 0])
# new_coords = convert_coordinates(coords)
# print(new_coords)
# 获取该河段的所有时间点的径流数据 # 获取该河段的所有时间点的径流数据
river_runoff = runoff_df[idx].values
river_runoff = runoff_df.iloc[:, idx - 1].values river_runoff = runoff_df.iloc[:, idx - 1].values
max_runoff = max(river_runoff)
# # 创建时间序列的颜色数据 # # 创建时间序列的颜色数据
color_property = {"epoch": format_time(start_time), "rgba": []} color_property = {"epoch": format_time(start_time), "rgba": []}
@ -155,7 +147,7 @@ def generate_river_czml(river_df, runoff_df, start_time=None):
] ]
}, },
"material": {"solidColor": {"color": color_property}}, "material": {"solidColor": {"color": color_property}},
"width": 3, "width": level * 2,
"clampToGround": True, # 贴地显示 "clampToGround": True, # 贴地显示
"classificationType": "BOTH", # 同时在地形和3D切片上显示 "classificationType": "BOTH", # 同时在地形和3D切片上显示
"zIndex": 1, # 控制叠加顺序 "zIndex": 1, # 控制叠加顺序
@ -188,11 +180,11 @@ save_czml(czml_data, 'river_flow.czml')
if __name__ == "__main__": if __name__ == "__main__":
level = 4
# 读取文件 # 读取文件
river_df = read_shp("lz.in/1.geojson", 1) river_df = read_shp("lz.in/1.geojson", level)
runoff_df = read_binary_file("lz.out/lz.rivqdown.dat") runoff_df = read_binary_file("lz.out/lz.rivqdown.dat")
czml_data = generate_river_czml(river_df, runoff_df) czml_data = generate_river_czml(river_df, runoff_df, level)
save_czml(czml_data, "river_flow_1.czml") save_czml(czml_data, f"river_flow_{level}.czml")
print("CZML文件已生成river_flow.czml") print(f"CZML文件已生成river_flow_{level}.czml")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

118106
river_flow_4.czml Normal file

File diff suppressed because it is too large Load Diff