Skip to content

Commit

Permalink
IRI模型3维echarts展示
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorineko committed Dec 17, 2023
1 parent 2aff610 commit 50d5fd3
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,41 @@
async def root():
return {"message": "Hello IRI"}

# 获取测试数据
@app.post("/test_ne")
async def test_ne(information: dict):
# 获取2D测试数据
@app.post("/get_2D_info")
async def get_2D_info(information: dict):
time = information['time']
altitude_start = int(information['artitude_start'])
altitude_stop = int(information['artitude_stop'])
altitude_stepsize = int(information['artitude_stepsize'])
altitude_start = int(information['altitude_start'])
altitude_stop = int(information['altitude_stop'])
altitude_stepsize = int(information['altitude_stepsize'])
longitude = int(information['longitude'])
latitude = int(information['latitude'])

arr = iri2016.IRI(time, (altitude_start, altitude_stop, altitude_stepsize), longitude, latitude)
arr_ne = arr['ne'].to_numpy().tolist()
arr_nOp = arr['nO+'].to_numpy().tolist()
return {"ne": arr_ne, "nOp": arr_nOp}

# 获取3D测试数据
@app.post("/get_3D_info")
async def get_3D_info(information_3d: dict):
try:
time = information_3d['time']
altitude = int(information_3d['altitude'])
longitude_start = int(information_3d['longitude_start'])
longitude_stop = int(information_3d['longitude_stop'])
latitude_start = int(information_3d['latitude_start'])
latitude_stop = int(information_3d['latitude_stop'])
position_stepsize = int(information_3d['position_stepsize'])
ne_data = []
# 循环遍历经纬度范围,获取Ne数据
for lon in range(longitude_start, longitude_stop + 1, position_stepsize):
for lat in range(latitude_start, latitude_stop + 1, position_stepsize):
arr = iri2016.IRI(time, (altitude, altitude+1, 1), lon, lat)
ne_value = arr['ne'].values[0]
# 将 Ne 浓度数据添加到数组中
ne_data.append([lon,lat,ne_value])
return {"neData": ne_data}
except Exception as e:
print("Error in get_3D_info:", str(e))
raise

0 comments on commit 50d5fd3

Please sign in to comment.