@@ -35,21 +35,13 @@ def format_data(data):
35
35
"triple_offshore" : list (
36
36
map (
37
37
float ,
38
- [
39
- data ["TN_Offshore_Low" ],
40
- data ["TN_Offshore_Medium" ],
41
- data ["TN_Offshore_High" ],
42
- ],
38
+ [data ["TN_Offshore_Low" ], data ["TN_Offshore_Medium" ], data ["TN_Offshore_High" ]],
43
39
)
44
40
),
45
41
"triple_inshore" : list (
46
42
map (
47
43
float ,
48
- [
49
- data ["TN_Inshore_Low" ],
50
- data ["TN_Inshore_Medium" ],
51
- data ["TN_Inshore_High" ],
52
- ],
44
+ [data ["TN_Inshore_Low" ], data ["TN_Inshore_Medium" ], data ["TN_Inshore_High" ]],
53
45
)
54
46
),
55
47
},
@@ -64,13 +56,13 @@ def format_data(data):
64
56
"draft" : round (float (data ["Draft" ]), 2 ),
65
57
"displacement" : float (data ["Dspl_Measurement" ]),
66
58
"genoa" : float (data ["Area_Jib" ]),
67
- "main" : float (data ["Area_Main" ]),
68
- "spinnaker" : float (data ["Area_Sym" ]),
69
- "spinnaker_asym" : float (data .get ("Area_Asym" , data .get ("Area_ASym" ))),
59
+ "main" : float (data ["Area_Main" ] or 0 ),
60
+ "spinnaker" : float (data ["Area_Sym" ] or 0 ),
61
+ "spinnaker_asym" : float (data .get ("Area_Asym" , data .get ("Area_ASym" )) or 0.0 ),
70
62
"crew" : float (data ["CrewWT" ]),
71
63
"wetted_surface" : float (data ["WSS" ]),
72
64
},
73
- "stability_index" : float (data ["Stability_Index" ])
65
+ "stability_index" : float (data ["Stability_Index" ]),
74
66
},
75
67
}
76
68
# velocity prediction
@@ -146,11 +138,15 @@ def jsonwriter_extremes(rmsdata):
146
138
long_boats = sorted (data , key = lambda boat : boat ["boat" ]["sizes" ]["loa" ], reverse = True )
147
139
heavy_boats = sorted (data , key = lambda boat : boat ["boat" ]["sizes" ]["displacement" ], reverse = True )
148
140
149
- sailno_vppmax = lambda boats : list ([(boat ["sailnumber" ], boat ["name" ], boat ["boat" ]["type" ], vppmax (boat )) for boat in boats ])
141
+ sailno_vppmax = lambda boats : list (
142
+ [(boat ["sailnumber" ], boat ["name" ], boat ["boat" ]["type" ], vppmax (boat )) for boat in boats ]
143
+ )
150
144
151
145
def sailno_sizekey (key , limit = 10 ):
152
146
boats = sorted (data , key = lambda boat : boat ["boat" ]["sizes" ][key ], reverse = True )[:limit ]
153
- return list ([(boat ["sailnumber" ], boat ["name" ], boat ["boat" ]["type" ], boat ["boat" ]["sizes" ][key ]) for boat in boats ])
147
+ return list (
148
+ [(boat ["sailnumber" ], boat ["name" ], boat ["boat" ]["type" ], boat ["boat" ]["sizes" ][key ]) for boat in boats ]
149
+ )
154
150
155
151
extremes = {}
156
152
extremes ["max_speed" ] = sailno_vppmax (fast_boats [:10 ])
0 commit comments