add feature
This commit is contained in:
parent
16a92dcbe0
commit
89ebc990ed
BIN
lz.in/lz.in.zip
BIN
lz.in/lz.in.zip
Binary file not shown.
@ -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
|
@ -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
24
main.py
@ -75,7 +75,7 @@ def format_time(dt):
|
||||
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文件
|
||||
|
||||
@ -96,11 +96,6 @@ def generate_river_czml(river_df, runoff_df, start_time=None):
|
||||
if start_time is None:
|
||||
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 = [
|
||||
{
|
||||
@ -128,13 +123,10 @@ def generate_river_czml(river_df, runoff_df, start_time=None):
|
||||
new_coords = []
|
||||
for coord in coords:
|
||||
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
|
||||
max_runoff = max(river_runoff)
|
||||
|
||||
# # 创建时间序列的颜色数据
|
||||
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}},
|
||||
"width": 3,
|
||||
"width": level * 2,
|
||||
"clampToGround": True, # 贴地显示
|
||||
"classificationType": "BOTH", # 同时在地形和3D切片上显示
|
||||
"zIndex": 1, # 控制叠加顺序
|
||||
@ -188,11 +180,11 @@ save_czml(czml_data, 'river_flow.czml')
|
||||
|
||||
|
||||
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")
|
||||
czml_data = generate_river_czml(river_df, runoff_df)
|
||||
save_czml(czml_data, "river_flow_1.czml")
|
||||
czml_data = generate_river_czml(river_df, runoff_df, level)
|
||||
save_czml(czml_data, f"river_flow_{level}.czml")
|
||||
|
||||
print("CZML文件已生成:river_flow.czml")
|
||||
print(f"CZML文件已生成:river_flow_{level}.czml")
|
||||
|
557144
river_flow_1.czml
557144
river_flow_1.czml
File diff suppressed because it is too large
Load Diff
287230
river_flow_2.czml
287230
river_flow_2.czml
File diff suppressed because it is too large
Load Diff
175228
river_flow_3.czml
175228
river_flow_3.czml
File diff suppressed because it is too large
Load Diff
118106
river_flow_4.czml
Normal file
118106
river_flow_4.czml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user