| | |
| | | String terrainFile = inPath + File.separator + config.getTerrainFile(); |
| | | |
| | | Dataset dsDem = gdal.Open(terrainTif, gdalconstConstants.GA_ReadOnly); |
| | | ComHelper.Resample(dsDem, null, terrainFile, null, wkt, null, null); |
| | | ComHelper.cutAndResample(dsDem, null, terrainFile, null, wkt, null, null); |
| | | dsDem.delete(); |
| | | |
| | | String landuseFile = inPath + File.separator + config.getLanduseFile(); |
| | | |
| | | Dataset dsLanduse = gdal.Open(landuseTif, gdalconstConstants.GA_ReadOnly); |
| | | ComHelper.Resample(dsLanduse, null, landuseFile, null, wkt, null, null); |
| | | ComHelper.cutAndResample(dsLanduse, null, landuseFile, null, wkt, null, null); |
| | | dsLanduse.delete(); |
| | | |
| | | if (stationTif != null) { |
| | | String stationFile = inPath + File.separator + "Station.tif"; |
| | | Dataset dsStation = gdal.Open(stationTif, gdalconstConstants.GA_ReadOnly); |
| | | ComHelper.Resample(dsStation, null, stationFile, null, wkt, null, null); |
| | | ComHelper.cutAndResample(dsStation, null, stationFile, null, wkt, null, null); |
| | | dsStation.delete(); |
| | | } |
| | | } |
| | |
| | | * 调用UWSolver |
| | | */ |
| | | public String callUwSolver(Simu simu, SimuData data) throws Exception { |
| | | File uwBat = new File(config.getUwSolverBat()); |
| | | |
| | | int duration = 3600 * data.getDuration(); // 秒数 |
| | | if (null != data.getRainfalls() && data.getRainfalls().size() > 1) { |
| | | List<Rainfall> rainfalls = data.getRainfalls(); |
| | |
| | | String startTime = TimeFormatUtil.formatDate(data.getStartTime()); |
| | | ConfigVo vo = new ConfigVo(terrainFile, landuseFile, terrainFile, rainfallFile, |
| | | saveName, duration, saveFrames, saveMode, startTime); |
| | | vo.getResult().setSave_filter(config.getSaveFilter()); |
| | | String configFile = config.getInPath() + File.separator + data.getInPath() + File.separator + data.getInPath() + ".json"; |
| | | // ComHelper.writeJson(configFile, JSON.toJSONString(vo)); |
| | | mapper.writeValue(new File(configFile), vo); |
| | |
| | | } |
| | | |
| | | private List<Double> getValues(String csvPath) throws Exception { |
| | | if (!new File(csvPath).exists()) return null; |
| | | if (!new File(csvPath).exists()) return Collections.emptyList(); |
| | | |
| | | List<String> list = Files.readAllLines(Paths.get(csvPath)); |
| | | list.remove(0); |
| | | //list.remove(list.size() - 1); |
| | | |
| | | return list.stream() |
| | | .map(s -> new BigDecimal(s).setScale(6, RoundingMode.HALF_DOWN).doubleValue()) |
| | |
| | | File dem = new File(serviceNameDir, "DEM.tif"); |
| | | resultDto.setTerrainFile(dem.getAbsolutePath()); |
| | | File newDepthDir = new File(serviceNameDir + File.separator + "depth_" + currentTime); |
| | | File[] files = newDepthDir.listFiles(); |
| | | resultDto.setWaterPath(newDepthDir.getAbsolutePath()); |
| | | LayerDto layerDto = new LayerDto(config.getVer(), 4548, config.getSizes()); |
| | | String newLayerJsonName = "layer_" + currentTime + ".json"; |