Compare commits

...

2 Commits

Author SHA1 Message Date
hekaiyu
8edd0cdb16 Merge remote-tracking branch 'origin/master' 2025-12-11 16:36:52 +08:00
hekaiyu
ca1cd80f97 添加一个python目录 2025-12-11 16:36:46 +08:00
3 changed files with 10 additions and 5 deletions

View File

@ -9,6 +9,11 @@ import org.springframework.stereotype.Component;
@ConfigurationProperties(prefix = "t1h-download")
public class T1hDownloadProperties {
/**
* python环境路径
*/
private String pythonPath;
/**
* 下载T1H的Py脚本路径
*/

View File

@ -24,7 +24,8 @@ public class ExecutePyUtils {
processWatch.start();
Process process = null;
try {
System.out.println("执行命令: " + String.join(" ", processBuilder.command()));
System.out.println("工作目录: " + processBuilder.directory());
process = processBuilder.start();
// 异步处理输出流

View File

@ -86,7 +86,7 @@ public class DownloadT1hJob {
List<String> forecastTimes = generateForecastTimes();
ProcessBuilder processBuilder = new ProcessBuilder(
systemStorageProperties.getAiModelsPath() + File.separator + "python3 ",
t1hDownloadProperties.getPythonPath(),
getPythonScriptPath(t1hDownloadProperties.getMergeT1hPy()),
"--indir", getFullPath(t1hDownloadProperties.getT1hPath(), baseTime),
"--output_dir", getFullPath(systemStorageProperties.getT1h(), baseTime),
@ -94,7 +94,7 @@ public class DownloadT1hJob {
"--forecast_times", String.join(",", forecastTimes),
"--base_date", baseTime
);
processBuilder.directory(new File(systemStorageProperties.getRootPath()));
ExecutePyUtils.executePythonProcess(processBuilder, "文件合并");
}
@ -127,7 +127,6 @@ public class DownloadT1hJob {
log.info("执行Python脚本: {}", Arrays.toString(command));
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.directory(new File(systemStorageProperties.getRootPath()));
ExecutePyUtils.executePythonProcess(processBuilder,
String.format("元素%s预报时长%s下载", element, forecastHours));
}
@ -137,7 +136,7 @@ public class DownloadT1hJob {
*/
private String[] buildPythonCommand(String element, String baseTime, String forecastHours) {
return new String[]{
systemStorageProperties.getAiModelsPath() + File.separator + "python3 ",
t1hDownloadProperties.getPythonPath(),
getPythonScriptPath(t1hDownloadProperties.getDownloadT1hPy()),
"--base-time", baseTime,
"--element", element,