把c#函数用python重写 #region 测深垂线间平均水深、测深垂线间间距、测深垂线间水道断面面积计算 private void CalculateBetweenDepthLine_AvgDepth_Gap_Area() { for (int i = 0; i < ResultLineList.Count; i++) { if (ResultLineList[i].VLineOrder == -9999) { ResultLineList[i].AvgDepthBetweenDLine = null;//(float)Math.Round((result_LineList[i - 1].Depth + result_LineList[i].Depth) / 2f, 2); ResultLineList[i].GapBetweenDLine = null;//(float)Math.Round(result_LineList[i].InitPointDistance - result_LineList[i-1].InitPointDistance, 1); ResultLineList[i].AreaBetweenDLine = null;// result_LineList[i].AvgDepthBetweenDLine * result_LineList[i].GapBetweenDLine; } else { ResultLineList[i].AvgDepthBetweenDLine = NumValid.PrecisionConvert_Depth((ResultLineList[i - 1].Depth + ResultLineList[i].Depth) / 2f); ResultLineList[i].GapBetweenDLine = NumValid.PrecisionConvert_Width(ResultLineList[i].InitPointDistance - ResultLineList[i - 1].InitPointDistance); ResultLineList[i].AreaBetweenDLine = NumValid.PrecisionConvert_Area((double)(ResultLineList[i].AvgDepthBetweenDLine * ResultLineList[i].GapBetweenDLine)); } } } #endregion
时间: 2024-04-21 09:27:20 浏览: 139
def calculate_between_depth_line_avg_depth_gap_area(result_line_list):
for i in range(len(result_line_list)):
if result_line_list[i].VLineOrder == -9999:
result_line_list[i].AvgDepthBetweenDLine = None
result_line_list[i].GapBetweenDLine = None
result_line_list[i].AreaBetweenDLine = None
else:
result_line_list[i].AvgDepthBetweenDLine = NumValid.PrecisionConvert_Depth((result_line_list[i - 1].Depth + result_line_list[i].Depth) / 2)
result_line_list[i].GapBetweenDLine = NumValid.PrecisionConvert_Width(result_line_list[i].InitPointDistance - result_line_list[i - 1].InitPointDistance)
result_line_list[i].AreaBetweenDLine = NumValid.PrecisionConvert_Area(float(result_line_list[i].AvgDepthBetweenDLine * result_line_list[i].GapBetweenDLine))
阅读全文