wContour-tracingContourLines生成等值线-java.lang.ArrayIndexOutOfBoundsException-数组越界问题

wContour-tracingContourLines生成等值线-java.lang.ArrayIndexOutOfBoundsException-数组越界问题,第1张

wContour-tracingContourLines生成等值线-java.lang.ArrayIndexOutOfBoundsException-数组越界问题
//nc数据生成等值线数据
    public static List nc2EquiSurface(Map ncData, double[] dataInterval) throws IOException {
       // String geojsonpogylon = "";
        List cPolylineList = new ArrayList();
        List cPolygonList = new ArrayList();
 
        double[][] _gridData = (double[][]) ncData.get("eleData");
        int[][] S1 = new int[_gridData.length][_gridData[0].length];
        double[] _X = (double[]) ncData.get("lon"), _Y = (double[]) ncData.get("lat");
      //  double _undefData = Double.parseDouble((String)ncData.get("invalid"));
        double _undefData = -9999.0;
        List _borders = Contour.tracingBorders(_gridData, _X, _Y,
                S1, _undefData);
        int nc = dataInterval.length;
        cPolylineList = Contour.tracingContourLines(_gridData, _X, _Y, nc,
                dataInterval, _undefData, _borders, S1);// 生成等值线

        cPolylineList = Contour.smoothLines(cPolylineList);// 平滑
        cPolygonList = Contour.tracingPolygons(_gridData, cPolylineList,
                _borders, dataInterval);

        return cPolygonList; 
    }

问题:Contour.tracingContourLines报java.lang.ArrayIndexOutOfBoundsException:-1

  cPolylineList = Contour.tracingContourLines(_gridData, _X, _Y, nc,
                dataInterval, _undefData, _borders, S1);// 生成等值线

原因:nc原始文件读取时lat数组递减排列

总结:在tracingContourLines函数里,_X、_Y都需要保证数据递增排列

例:

 

 

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5081849.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-16
下一篇 2022-11-16

发表评论

登录后才能评论

评论列表(0条)

保存