java动态生成污染玫瑰图

一、java动态生成Excel输入文件

关键代码实现:

// 表头数据
String[] header = {"index","stationName","stationTypeId","x","y","time","AQI","PM25","PM10","SO2","NO2","CO","O3","PMI"};
//站点名称    时间    气压(hpa)    气温(℃)    湿度(%)    风向(deg)    风速(m/s)    降水量(mm)    能见度(km)    PM10    PM2.5

//声明一个工作簿
HSSFWorkbook workbook = new HSSFWorkbook();
//生成一个表格
HSSFSheet sheet = workbook.createSheet("sheet1");

// 写入头部
HSSFRow headrow = sheet.createRow(0);
for (int i=0; i<header.length; i++) {
    headrow.createCell(i).setCellValue(header[i]);
}

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm");
for (int i=0; i<datalist.size(); i++) {
    HSSFRow row = sheet.createRow(i+1);
    StationWithData data = datalist.get(i);
    row.createCell(0).setCellValue(i+1);
    row.createCell(1).setCellValue(data.getStationName());
    row.createCell(2).setCellValue(data.getStationTypeId());
    if (data.getLongitude() != null) {
        row.createCell(3).setCellValue(data.getLongitude().doubleValue());
    }
    if (data.getLatitude() != null) {
        row.createCell(4).setCellValue(data.getLatitude().doubleValue());
    }
    if (data.getMonitorTime() != null) {
        row.createCell(5).setCellValue(dateFormat.format(data.getMonitorTime()));
    }
    if (data.getAqi() != null) {
        row.createCell(6).setCellValue(data.getAqi().doubleValue());
    }
    if (data.getPm25() != null) {
        row.createCell(7).setCellValue(data.getPm25().doubleValue());
    }
    if (data.getPm10() != null) {
        row.createCell(8).setCellValue(data.getPm10().doubleValue());
    }
    if (data.getSo2() != null) {
        row.createCell(9).setCellValue(data.getSo2().doubleValue());
    }
    if (data.getNo2() != null) {
        row.createCell(10).setCellValue(data.getNo2().doubleValue());
    }
    if (data.getCo() != null) {
        row.createCell(11).setCellValue(data.getCo().doubleValue());
    }
    if (data.getO3() != null) {
        row.createCell(12).setCellValue(data.getO3().doubleValue());
    }
    if (data.getPmi() != null) {
        row.createCell(13).setCellValue(data.getPmi().doubleValue());
    }
}

try {
    //workbook将Excel写入到文件
    File file = new File(excelPath);
    if (!file.exists()) {
        boolean flag = file.mkdirs();
        System.out.println(flag);
    }
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
    FileOutputStream os = new FileOutputStream(excelPath + "\\" + sdf.format(new Date()) + ".xls");
    workbook.write(os);

    //刷新缓冲
    os.flush();
    os.close();
    //this.execPython(scriptPath, pythonParam, pythonParam + File.separator + "wryt" + File.separator + "wrytexcel" + File.separator + sdf.format(new Date()) + ".xls");
    this.execPython(scriptPath, pythonParam, excelPath + File.separator + sdf.format(new Date()) + ".xls");
} catch(Exception e) {
    e.printStackTrace();
}

二、编写python代码实现

三、编写java服务代码调用python生成污染玫瑰图成果文件

四、网络调用

五、生成污染玫瑰图成果图

技术合作交流qq:2401315930

六、融合GIS展示时段内污染物的扩散方向方位和浓度可视化

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

兴诚

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值