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;
/**
* 气象文件存放目录
* 剂量py存放目录
*/
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));
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);
NetcdfFile cmaqNcFile = getCmaqNetcdfFile(resultFilePath, startTime)) {
DiffusionResultVO diffusionResultVO = new DiffusionResultVO();
System.out.println(hour);
List<List<Double>> values = NcUtil.get2DNCByName(cmaqNcFile, "CO", layer, hour);
List<List<Double>> xlats = NcUtil.get2DNCByName(wrfNcFile, "XLAT", 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) {
String[] cmd_dep = {
"python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\sum_dry_wet_to_nc.py",
"ASIJ",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"out_dep_20181113",
"20181113",
"20181114"
};
ProcessBuilder depBuilder = new ProcessBuilder(cmd_dep);
ExecutePyUtils.executePythonProcess(depBuilder, "dep");
String[] cmd_wrf = {
"python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py",
"XLAT,XLONG,HGT,U,V,W",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"out_wrf_20181113",
"20181113",
"20181114",
"wrfout_d03_{YYYY-MM-DD}_00_00_00" // 使用占位符
};
ProcessBuilder wrfBuilder = new ProcessBuilder(cmd_wrf);
ExecutePyUtils.executePythonProcess(wrfBuilder, "wrf");
String[] cmd_cmaq = {
"python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py",
"CO,ASIJ",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"out_conc_20181113",
"20181113",
"20181114",
"CCTM.CONC.d03.{YYYYMMDD}" // 使用占位符
};
ProcessBuilder concBuilder = new ProcessBuilder(cmd_cmaq);
ExecutePyUtils.executePythonProcess(concBuilder, "conc");
String[] cmd_metcr03d = {
"python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py",
"TA,PRES",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"out_metcr03d_20181113",
"20181113",
"20181114",
"METCRO3D_d03_{YYYYMMDD}" // 使用占位符
};
ProcessBuilder metcr03dBuilder = new ProcessBuilder(cmd_metcr03d);
ExecutePyUtils.executePythonProcess(metcr03dBuilder, "metcr03d");
String[] cmd_emis = {
"python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\merge_results_to_nc.py",
"CO,PSI",
"D:\\hky_word\\Projectlibrary\\resultFile\\admin\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"out_emis_20181113",
"20181113",
"20181114",
"emis_{YYYYMMDD}" // 使用占位符
};
ProcessBuilder emisBuilder = new ProcessBuilder(cmd_emis);
ExecutePyUtils.executePythonProcess(emisBuilder, "emis");
// String[] cmd_dep = {
// "python",
// "E:\\runtimeEnv\\fileSystem\\event\\python\\sum_dry_wet_to_nc.py",
// "ASIJ",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "out_dep_20160701",
// "20160701",
// "20160702"
// };
// ProcessBuilder depBuilder = new ProcessBuilder(cmd_dep);
// ExecutePyUtils.executePythonProcess(depBuilder, "dep");
//
// String[] cmd_wrf = {
// "python",
// "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
// "XLAT,XLONG,HGT,U,V,W",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "out_wrf_20160701",
// "20160701",
// "20160702",
// "wrfout_d03_{YYYY-MM-DD}_00_00_00" // 使用占位符
// };
// ProcessBuilder wrfBuilder = new ProcessBuilder(cmd_wrf);
// ExecutePyUtils.executePythonProcess(wrfBuilder, "wrf");
//
// String[] cmd_cmaq = {
// "python",
// "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
// "CO,ASIJ",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "out_conc_20160701",
// "20160701",
// "20160702",
// "CCTM.CONC.d03.{YYYYMMDD}" // 使用占位符
// };
// ProcessBuilder concBuilder = new ProcessBuilder(cmd_cmaq);
// ExecutePyUtils.executePythonProcess(concBuilder, "conc");
//
// String[] cmd_metcr03d = {
// "python",
// "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
// "TA,PRES",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "out_metcr03d_20160701",
// "20160701",
// "20160702",
// "METCRO3D_d03_{YYYYMMDD}" // 使用占位符
// };
// ProcessBuilder metcr03dBuilder = new ProcessBuilder(cmd_metcr03d);
// ExecutePyUtils.executePythonProcess(metcr03dBuilder, "metcr03d");
//
// String[] cmd_emis = {
// "python",
// "E:\\runtimeEnv\\fileSystem\\event\\python\\merge_results_to_nc.py",
// "CO,PSI",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
// "out_emis_20160701",
// "20160701",
// "20160702",
// "emis_{YYYYMMDD}" // 使用占位符
// };
// ProcessBuilder emisBuilder = new ProcessBuilder(cmd_emis);
// ExecutePyUtils.executePythonProcess(emisBuilder, "emis");
String[] cmd_dose = {
"python",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\py\\convert_conc_to_dose.py",
"20181113",
"20181114",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\1113",
"D:\\hky_word\\Projectlibrary\\resultFile\\dose\\data_48.xlsx",
"out_dep_20181113",
"out_wrf_20181113",
"out_conc_20181113",
"out_metcr03d_20181113",
"out_emis_20181113",
"out_dose_20181113",
"E:\\runtimeEnv\\fileSystem\\event\\python\\convert_conc_to_dose.py",
"20160701",
"20160702",
"E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"E:\\runtimeEnv\\fileSystem\\event\\admin\\002\\",
"E:\\runtimeEnv\\fileSystem\\event\\python\\data_48.xlsx",
"out_dep_20160701",
"out_wrf_20160701",
"out_conc_20160701",
"out_metcr03d_20160701",
"out_emis_20160701",
"out_dose_20160701",
};
ProcessBuilder doseBuilder = new ProcessBuilder(cmd_dose);
ExecutePyUtils.executePythonProcess(doseBuilder, "emis");
ExecutePyUtils.executePythonProcess(doseBuilder, "dose");
}