Skip to content

Commit

Permalink
修订STI返回的JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
pysoer committed Dec 3, 2023
1 parent 1b53eab commit 8e628b6
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions cinrad/io/level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -922,13 +922,37 @@ def _parse_sti_fmt(self):
)
his = [[his_lon[i, 0], his_lat[i, 0]] for i in range(history_positon_count)]
history.append(his)
self.sti_attributes = []
self.sti_components = []
if sti_count > 0:
self.sti_attributes = np.frombuffer(self.f.read(60), L3_sti_attribute)
self.sti_components = np.frombuffer(self.f.read(12), L3_sti_component)
for _ in range(track_count):
self.sti_attributes.append(
np.frombuffer(self.f.read(60), L3_sti_attribute)
)
for _ in range(track_count):
self.sti_components.append(
np.frombuffer(self.f.read(12), L3_sti_component)
)
self.sti_adaptation = np.frombuffer(self.f.read(40), L3_sti_adaptation)
sti_id = [attr["id"] for attr in self.sti_attributes]
max_ref = [attr["max_ref"] for attr in self.sti_attributes]
max_ref_height = [attr["max_ref_height"] for attr in self.sti_attributes]
vil = [attr["vil"] for attr in self.sti_attributes]
top_height = [attr["top_height"] for attr in self.sti_attributes]
sti_data = [
[{"curr": c, "fore": f, "his": h}]
for c, f, h in zip(curr, forecast, history)
{
"id": str(sti_id[i][0]),
"current_position": [curr[i][0], curr[i][1]],
"current_speed": curr[i][2],
"current_direction": curr[i][3],
"forecast_position": forecast[i],
"history_position": history[i],
"max_ref": max_ref[i][0],
"max_ref_height": max_ref_height[i][0],
"vil": vil[i][0],
"top_height": top_height[i][0],
}
for i in range(track_count)
]
attrs = {
"scan_time": self.scantime.strftime("%Y-%m-%d %H:%M:%S"),
Expand Down

0 comments on commit 8e628b6

Please sign in to comment.