//nc数据生成等值线数据 public static Listnc2EquiSurface(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都需要保证数据递增排列
例:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)