1.提交事件模拟代码

This commit is contained in:
panbaolin 2025-11-14 13:32:57 +08:00
parent e663491aa0
commit 9f040231df
3 changed files with 84 additions and 84 deletions

View File

@ -40,7 +40,7 @@ public class EventServerProperties {
private String resultFilePrefix; private String resultFilePrefix;
/** /**
* 气象文件存放目录 * 剂量py存放目录
*/ */
private String pythonPath; private String pythonPath;

View File

@ -46,11 +46,11 @@ public class DiffusionDataServiceImpl implements DiffusionDataService {
Wrf wrf = wrfMapper.selectOne(new LambdaQueryWrapper<Wrf>().eq(Wrf::getEnginId, enginId)); Wrf wrf = wrfMapper.selectOne(new LambdaQueryWrapper<Wrf>().eq(Wrf::getEnginId, enginId));
String resultFilePath = baseAPIService.buildEngineeringFilePath(eventServerProperties.getResultFilePrefix(), engineering.getCreateBy(), engineering.getEngineeringName()); String resultFilePath = baseAPIService.buildEngineeringFilePath(eventServerProperties.getResultFilePrefix(), engineering.getCreateBy(), engineering.getEngineeringName());
String startTime = wrf.getStartTime().substring(0, 10); String startTime = wrf.getStartTime().substring(0, 10).replace("-", "");;
try (NetcdfFile wrfNcFile = getWrfNetcdfFile(resultFilePath, startTime); try (NetcdfFile wrfNcFile = getWrfNetcdfFile(resultFilePath, startTime);
NetcdfFile cmaqNcFile = getCmaqNetcdfFile(resultFilePath, startTime)) { NetcdfFile cmaqNcFile = getCmaqNetcdfFile(resultFilePath, startTime)) {
DiffusionResultVO diffusionResultVO = new DiffusionResultVO(); DiffusionResultVO diffusionResultVO = new DiffusionResultVO();
System.out.println(hour);
List<List<Double>> values = NcUtil.get2DNCByName(cmaqNcFile, "CO", layer, hour); List<List<Double>> values = NcUtil.get2DNCByName(cmaqNcFile, "CO", layer, hour);
List<List<Double>> xlats = NcUtil.get2DNCByName(wrfNcFile, "XLAT", layer, hour); List<List<Double>> xlats = NcUtil.get2DNCByName(wrfNcFile, "XLAT", layer, hour);
List<List<Double>> xlons = NcUtil.get2DNCByName(wrfNcFile, "XLONG", layer, hour); List<List<Double>> xlons = NcUtil.get2DNCByName(wrfNcFile, "XLONG", layer, hour);

View File

@ -10,92 +10,92 @@ public class TestMain {
public static void main(String[] args) { public static void main(String[] args) {
String[] cmd_dep = { // String[] cmd_dep = {
"python", // "python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\sum_dry_wet_to_nc.py", // "E:\\runtimeEnv\\fileSystem\\event\\python\\sum_dry_wet_to_nc.py",
"ASIJ", // "ASIJ",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"out_dep_20181113", // "out_dep_20160701",
"20181113", // "20160701",
"20181114" // "20160702"
}; // };
ProcessBuilder depBuilder = new ProcessBuilder(cmd_dep); // ProcessBuilder depBuilder = new ProcessBuilder(cmd_dep);
ExecutePyUtils.executePythonProcess(depBuilder, "dep"); // ExecutePyUtils.executePythonProcess(depBuilder, "dep");
//
String[] cmd_wrf = { // String[] cmd_wrf = {
"python", // "python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py", // "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
"XLAT,XLONG,HGT,U,V,W", // "XLAT,XLONG,HGT,U,V,W",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"out_wrf_20181113", // "out_wrf_20160701",
"20181113", // "20160701",
"20181114", // "20160702",
"wrfout_d03_{YYYY-MM-DD}_00_00_00" // 使用占位符 // "wrfout_d03_{YYYY-MM-DD}_00_00_00" // 使用占位符
}; // };
ProcessBuilder wrfBuilder = new ProcessBuilder(cmd_wrf); // ProcessBuilder wrfBuilder = new ProcessBuilder(cmd_wrf);
ExecutePyUtils.executePythonProcess(wrfBuilder, "wrf"); // ExecutePyUtils.executePythonProcess(wrfBuilder, "wrf");
//
String[] cmd_cmaq = { // String[] cmd_cmaq = {
"python", // "python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py", // "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
"CO,ASIJ", // "CO,ASIJ",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"out_conc_20181113", // "out_conc_20160701",
"20181113", // "20160701",
"20181114", // "20160702",
"CCTM.CONC.d03.{YYYYMMDD}" // 使用占位符 // "CCTM.CONC.d03.{YYYYMMDD}" // 使用占位符
}; // };
ProcessBuilder concBuilder = new ProcessBuilder(cmd_cmaq); // ProcessBuilder concBuilder = new ProcessBuilder(cmd_cmaq);
ExecutePyUtils.executePythonProcess(concBuilder, "conc"); // ExecutePyUtils.executePythonProcess(concBuilder, "conc");
//
String[] cmd_metcr03d = { // String[] cmd_metcr03d = {
"python", // "python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py", // "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
"TA,PRES", // "TA,PRES",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"out_metcr03d_20181113", // "out_metcr03d_20160701",
"20181113", // "20160701",
"20181114", // "20160702",
"METCRO3D_d03_{YYYYMMDD}" // 使用占位符 // "METCRO3D_d03_{YYYYMMDD}" // 使用占位符
}; // };
ProcessBuilder metcr03dBuilder = new ProcessBuilder(cmd_metcr03d); // ProcessBuilder metcr03dBuilder = new ProcessBuilder(cmd_metcr03d);
ExecutePyUtils.executePythonProcess(metcr03dBuilder, "metcr03d"); // ExecutePyUtils.executePythonProcess(metcr03dBuilder, "metcr03d");
//
String[] cmd_emis = { // String[] cmd_emis = {
"python", // "python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py", // "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
"CO,PSI", // "CO,PSI",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", // "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"out_emis_20181113", // "out_emis_20160701",
"20181113", // "20160701",
"20181114", // "20160702",
"emis_{YYYYMMDD}" // 使用占位符 // "emis_{YYYYMMDD}" // 使用占位符
}; // };
ProcessBuilder emisBuilder = new ProcessBuilder(cmd_emis); // ProcessBuilder emisBuilder = new ProcessBuilder(cmd_emis);
ExecutePyUtils.executePythonProcess(emisBuilder, "emis"); // ExecutePyUtils.executePythonProcess(emisBuilder, "emis");
String[] cmd_dose = { String[] cmd_dose = {
"python", "python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\convert_conc_to_dose.py", "E:\\runtimeEnv\\fileSystem\\event\\python\\convert_conc_to_dose.py",
"20181113", "20160701",
"20181114", "20160702",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113", "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\data_48.xlsx", "E:\\runtimeEnv\\fileSystem\\event\\python\\data_48.xlsx",
"out_dep_20181113", "out_dep_20160701",
"out_wrf_20181113", "out_wrf_20160701",
"out_conc_20181113", "out_conc_20160701",
"out_metcr03d_20181113", "out_metcr03d_20160701",
"out_emis_20181113", "out_emis_20160701",
"out_dose_20181113", "out_dose_20160701",
}; };
ProcessBuilder doseBuilder = new ProcessBuilder(cmd_dose); ProcessBuilder doseBuilder = new ProcessBuilder(cmd_dose);
ExecutePyUtils.executePythonProcess(doseBuilder, "emis"); ExecutePyUtils.executePythonProcess(doseBuilder, "dose");
} }