1
13693261870
2024-10-16 94bc1777d6005c380278de054a68bfceac92636b
src/main/java/com/se/simu/service/UwService.java
@@ -26,12 +26,28 @@
    @Resource
    PropertiesConfig config;
    /**
     * 创建降雨文件
     * <p>
     * https://blog.csdn.net/Dark_Drgon/article/details/139739924
     * C:\Program Files\matlab\R2020a\runtime\win64
     */
    public void createRainFile(DataPo data) throws Exception {
        String filePath = config.getInPath() + File.separator + data.getInPath() + File.separator + config.getRaingage();
        String startTime = StringHelper.YMDHMS_FORMAT.format(data.getStartTime());
        //MWCharArray file = new MWCharArray(filePath);
        //MWCharArray station = new MWCharArray(config.getRainStation());
        //MWCharArray time = new MWCharArray(startTime);
        Rainfall rainfall = new Rainfall();
        rainfall.rainfall(filePath, config.getRainStation(), startTime, data.getDuration(), 0.5, config.getRainPeriod());
        //rainfall('D:\simu\in\RainGage.dat','Tongzhou','2024-09-29 00:00:00',60,0.5,10)
        Object[] rs = rainfall.rainfall(filePath, config.getRainStation(), startTime,
                Double.valueOf(data.getDuration()), 0.5, config.getRainPeriod());
        // file.dispose();
        //station.dispose();
        //time.dispose();
    }
    public void createConfig(DataPo data) throws IOException {
@@ -61,8 +77,8 @@
        try {
            // new String[] { "/bin/sh", "-c", cmd }
            process = Runtime.getRuntime().exec(cmd);
            nr = new BufferedReader(new InputStreamReader(process.getInputStream()));
            er = new BufferedReader(new InputStreamReader(process.getErrorStream()));
            nr = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"));
            er = new BufferedReader(new InputStreamReader(process.getErrorStream(), "GBK"));
            String errorLine;
            while ((errorLine = er.readLine()) != null) {
@@ -112,7 +128,13 @@
        //
    }
    public void copeDrainFiles() {
        //
    public String copeDrainFiles(DataPo data) throws Exception {
        String time = StringHelper.YMDHMS_FORMAT.format(data.getStartTime());
        String inPath = config.getInPath() + File.separator + data.getInPath();
        String sww = inPath + File.separator + ".save" + File.separator + data.getInPath() + ".sww";
        String cmd = config.getSww2tifBat() + " " + sww + " '" + time + "' " + data.getEpsg() + " " + inPath;
        return exec(cmd);
    }
}