| | |
| | | throw new ServiceException("转换降雨栅格数据失败,详情:" + e.getMessage()); |
| | | } |
| | | RainfallGridData.Data data = gridData.getData(); |
| | | String fileName = data.getFileName(); |
| | | RainfallGridData.GridInfo gridInfo = data.getGridInfo(); |
| | | List<List<Double>> gridDataList = data.getGridData(); |
| | | if (gridDataList == null || gridDataList.isEmpty()) { |
| | |
| | | List<AttResWithRainfall> attResWithRainfallList = new ArrayList<>(); |
| | | |
| | | for (AttResBase attResBase : attResBases) { |
| | | if (null == attResBase.getCenterLat() || attResBase.getCenterLong() == null) { |
| | | log.warn("过滤掉经度或者纬度为空的水库,水库名称:{}", attResBase.getName()); |
| | | continue; |
| | | } |
| | | // 横向索引(lonIndex):(站点的经度 - 网格最小经度) / 每个网格单元的经度跨度 |
| | | int lonIndex = (int) ((Double.parseDouble(attResBase.getCenterLong()) - lonMin) / lonSpan); |
| | | // 纵向索引(latIndex):(站点的纬度 - 网格最小纬度) / 每个网格单元的纬度跨度 |
| | |
| | | AttResWithRainfall attResWithRainfall = new AttResWithRainfall(); |
| | | BeanUtil.copyProperties(attResBase, attResWithRainfall); |
| | | attResWithRainfall.setRainfall(String.valueOf(rainfall)); |
| | | attResWithRainfall.setFileName(fileName); |
| | | attResWithRainfallList.add(attResWithRainfall); |
| | | } else { |
| | | log.warn("AttRes {} is out of the grid range. centerLong: {}, centerLat: {}", attResBase.getName(), |
| | | log.warn("水库 {} 超出栅格范围. 中心点经度: {}, 中心点纬度: {}", attResBase.getName(), |
| | | attResBase.getCenterLong(), attResBase.getCenterLat()); |
| | | } |
| | | } |