洪水预报优化

master
cxw 2024-10-18 14:45:26 +08:00
parent 978ef94780
commit 49cef18716
1 changed files with 30 additions and 20 deletions

View File

@ -406,6 +406,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
tm = eightSdf.format(now); tm = eightSdf.format(now);
} }
tm = tm.replaceAll(" ", "").replaceAll("-", ""); tm = tm.replaceAll(" ", "").replaceAll("-", "");
try {
List<RainGrib2Layer> gribList = forecastService.getGribData(tm, false); List<RainGrib2Layer> gribList = forecastService.getGribData(tm, false);
//24小时每个网格的总量 //24小时每个网格的总量
List<RainGrib2Layer> total = gribList.stream().filter(o -> o.getTmRange().getInterval() == 24).collect(Collectors.toList()); List<RainGrib2Layer> total = gribList.stream().filter(o -> o.getTmRange().getInterval() == 24).collect(Collectors.toList());
@ -419,7 +420,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
// 2024-10-14 改为获取水库整个面的降雨 // 2024-10-14 改为获取水库整个面的降雨
ForeRainStatVo vo = new ForeRainStatVo(); ForeRainStatVo vo = new ForeRainStatVo();
String[] paramValue = forecastUseparam.getParamValue().split(",");// x1,y1,x2,y2 String[] paramValue = forecastUseparam.getParamValue().split(",");// x1,y1,x2,y2
vo.setGeom(buildRectangleGeoJson(Double.parseDouble(paramValue[0]), Double.parseDouble(paramValue[1]), Double.parseDouble(paramValue[2]), Double.parseDouble(paramValue[3]))); vo.setGeom(buildRectangleGeoJson(Double.parseDouble(paramValue[0]), Double.parseDouble(paramValue[1]), Double.parseDouble(paramValue[2]), Double.parseDouble(paramValue[3]), total.get(0)));
List<ForeRainTimeVo> data = forecastService.getAreaData(vo, total, detail); List<ForeRainTimeVo> data = forecastService.getAreaData(vo, total, detail);
if (CollectionUtils.isNotEmpty(data)) { if (CollectionUtils.isNotEmpty(data)) {
for (ForeRainTimeVo foreRainTimeVo : data) { for (ForeRainTimeVo foreRainTimeVo : data) {
@ -433,6 +434,9 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
} }
} }
} }
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
return pptnRFutureList; return pptnRFutureList;
} }
@ -683,7 +687,13 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
} }
} }
public static String buildRectangleGeoJson(double x1, double y1, double x2, double y2) { public static String buildRectangleGeoJson(double x1, double y1, double x2, double y2, RainGrib2Layer layer) {
// x1,y1和x2,y2的间隔必须要大于网格的最小长宽才能相交
BigDecimal dh = layer.getDh();// 单位高度
BigDecimal dw = layer.getDw();// 单位宽度
if(dw.compareTo(BigDecimal.valueOf(x2 - x1)) > 0 || dh.compareTo(BigDecimal.valueOf(y2 - y1)) > 0){
throw new IllegalArgumentException("Geom参数区域范围不足预测降雨网格最小单位");
}
// 校验数据是否在最大允许范围(预测降雨所划定区域) // 校验数据是否在最大允许范围(预测降雨所划定区域)
Double x11 = ForecastService.x1; Double x11 = ForecastService.x1;
Double y11 = ForecastService.y1; Double y11 = ForecastService.y1;