一、数据源参数定义

关键参数代码:
package com.grab.catchWindData.pram;
/**
* @ClassName: DevPrams
* @Description: TODO
**/
public class DevPrams {
public static String lev_0to0p1_m_below_ground ="lev_0-0.1_m_below_ground";
public static String lev_0p1to0p4_m_below_ground ="lev_0.1-0.4_m_below_ground";
public static String lev_0p33to1_sigma_layer ="lev_0.33-1_sigma_layer";
public static String lev_0p4to1_m_below_ground ="lev_0.4-1_m_below_ground";
public static String lev_0p44to0p72_sigma_layer ="lev_0.44-0.72_sigma_layer";
public static String sigmaLayerlev_0p44to1 ="lev_0.44-1_sigma_layer";
public static String mblev_0p0to0p4 ="lev_0.4_mb";
public static String sigmaLayerlev_0p72to0p94 ="lev_0.72-0.94_sigma_layer";
public static String sigmaLevellev_0p995="lev_0.995_sigma_level";
public static String lev_0C_isotherm ="lev_0C_isotherm";
public static String lev_1000_mb ="lev_1000_mb";
public static String lev_100_m_above_ground ="lev_100_m_above_ground";
public static String lev_100_mb ="lev_100_mb";
public static String lev_10_m_above_ground ="lev_10_m_above_ground";
public static String lev_10_m_above_mean_sea_level ="lev_10_m_above_mean_sea_level";
public static String lev_10_mb ="lev_10_mb";
public static String lev_1to2below_ground="lev_1-2_m_below_ground";
public static String lev_150_mb ="lev_150_mb";
public static String lev_15_mb ="lev_15_mb";
public static String lev_180to0_mb_above_ground ="lev_180-0_mb_above_ground";
public static String lev_1829_m_above_mean_sea_level ="lev_1829_m_above_mean_sea_level";
public static String lev_1_hybrid_level ="lev_1_hybrid_level";
public static String lev_1_mb ="lev_1_mb";
public static String lev_200_mb ="lev_200_mb";
public static String lev_20_m_above_ground ="lev_20_m_above_ground";
public static String lev_20_mb ="lev_20_mb";
public static String lev_250_mb ="lev_250_mb";
public static String lev_255to0_mb_above_ground ="lev_255-0_mb_above_ground";
public static String lev_2743_m_above_mean_sea_level ="lev_2743_m_above_mean_sea_level";
public static String lev_2_m_above_ground ="lev_2_m_above_ground";
public static String lev_2_mb ="lev_2_mb";
public static String lev_3000to0_m_above_ground ="lev_3000-0_m_above_ground";
public static String lev_300_mb ="lev_300_mb";
public static String lev_30to0_mb_above_ground ="lev_30-0_mb_above_ground";
public static String lev_30_m_above_ground ="lev_30_m_above_ground";
public static String lev_30_mb ="lev_30_mb";
public static String lev_350_mb ="lev_350_mb";
public static String lev_3658_m_above_mean_sea_level ="lev_3658_m_above_mean_sea_level";
public static String lev_3_mb ="lev_3_mb";
public static String lev_400_mb ="lev_400_mb";
public static String lev_40_m_above_ground ="lev_40_m_above_ground";
public static String lev_40_mb ="lev_40_mb";
public static String lev_450_mb ="lev_450_mb";
public static String lev_500_mb ="lev_500_mb";
public static String lev_50_m_above_ground ="lev_50_m_above_ground";
public static String lev_50_mb ="lev_50_mb";
public static String lev_550_mb ="lev_550_mb";
public static String lev_5_mb ="lev_5_mb";
public static String lev_6000to0_m_above_ground ="lev_6000-0_m_above_ground";
public static String lev_600_mb ="lev_600_mb";
public static String lev_650_mb ="lev_650_mb";
public static String lev_700_mb ="lev_700_mb";
public static String lev_70_mb ="lev_70_mb";
public static String lev_750_mb ="lev_750_mb";
public static String lev_7_mb ="lev_7_mb";
public static String lev_800_mb ="lev_800_mb";
public static String lev_80_m_above_ground ="lev_80_m_above_ground";
public static String lev_850_mb ="lev_850_mb";
public static String lev_900_mb ="lev_900_mb";
public static String lev_925_mb ="lev_925_mb";
public static String lev_950_mb ="lev_950_mb";
public static String lev_975_mb ="lev_975_mb";
public static String lev_boundary_layer_cloud_layer ="lev_boundary_layer_cloud_layer";
public static String lev_convective_cloud_bottom_level ="lev_convective_cloud_bottom_level";
public static String lev_convective_cloud_layer ="lev_convective_cloud_layer";
public static String lev_convective_cloud_top_level ="lev_convective_cloud_top_level";
public static String lev_entire_atmosphere ="lev_entire_atmosphere";
public static String lev_entire_atmosphere_single ="lev_entire_atmosphere_%5C%28considered_as_a_single_layer%5C%29";
public static String lev_high_cloud_bottom_level ="lev_high_cloud_bottom_level";
public static String lev_high_cloud_layer ="lev_high_cloud_layer";
public static String lev_high_cloud_top_level ="lev_high_cloud_top_level";
public static String lev_highest_tropospheric_freezing_level ="lev_highest_tropospheric_freezing_level";
public static String lev_low_cloud_bottom_level ="lev_low_cloud_bottom_level";
public static String lev_low_cloud_layer ="lev_low_cloud_layer";
public static String lev_low_cloud_top_level ="lev_low_cloud_top_level";
public static String lev_max_wind ="lev_max_wind";
public static String lev_mean_sea_level ="lev_mean_sea_level";
public static String lev_middle_cloud_bottom_level ="lev_middle_cloud_bottom_level";
public static String lev_middle_cloud_layer ="lev_middle_cloud_layer";
public static String lev_middle_cloud_top_level ="lev_middle_cloud_top_level";
public static String lev_planetary_boundary_layer ="lev_planetary_boundary_layer";
public static String PVM ="lev_PV%5C%3D%5C-2e%5C-06_%5C%28Km%5C%5E2%2Fkg%2Fs%5C%29_surface";
public static String PVADD ="lev_PV%5C%3D2e%5C-06_%5C%28Km%5C%5E2%2Fkg%2Fs%5C%29_surface";
public static String lev_surface ="lev_surface";
public static String lev_top_of_atmosphere ="lev_top_of_atmosphere";
public static String lev_tropopause ="lev_tropopause";
}
二、编写抓取程序定时任务
@Value("${grab.pythonPath}")
String pythonPath;
static String flag="";
@Scheduled(cron="0 0/2 * * * ?")
void get00(){
Date date = new Date();
Log.info("定时任务执行了" + DateUtil.format(date, DateUtil.DATE_TIME_PATTERN));
Log.info("flag======::::::::::::::::"+flag);
String [] levParams={DevPrams.lev_10_m_above_ground};
String [] varParams={VarParams.TMAX,VarParams.TMIN,VarParams.UGRD,VarParams.VGRD};
// Core core = new Core(0,"00","70","140","0","55");
// core.startRun(levParams,varParams);
String[] params={"18","12","06","00"};
int canDoPython=0;
List<String> allList=new ArrayList<String>();
for (int i=0;i<params.length;i++ ){
String flagData=getDateFlag(date,params[i]);
if(flag.equals(flagData)){
continue;
}
Core core = new Core(0,params[i],"70","140","0","55");
List<String> list = core.startRun(levParams, varParams);
if(list!=null&&!list.isEmpty()){
allList.addAll(list);
this.flag=flagData;
canDoPython++;
}else if (params[i].equals("00")&&(list==null||list.isEmpty())){
Core coretemp = new Core(1,"18","70","140","0","55");
list = coretemp.startRun(levParams, varParams);
allList.addAll(list);
canDoPython++;
this.flag=getDateFlag(DateUtil.addDateDays(date,-1),"18");
}
}
if(canDoPython>0){
HashSet<String> set =new HashSet<>(allList);
for(String s: set) {
try {
PythonGet.getStartPython(pythonPath,s);
} catch (Exception e) {
e.printStackTrace();
}
// System.out.println("已完成一次");
}
}
}
三、编写转换成JSON脚本python脚本

四、抓取文件及转化成果文件

转化json成果示例:

五、前端可视化

如果对您有帮助,请点赞打赏支持;
技术合作交流qq:2401315930



















