private void writeExpressionMatrixValues( NetcdfFileWriteable netCDF, Collection<Integer> designElements, List<Assay> assays, Map<Integer, Map<Integer, Float>> expressionValues) throws IOException, InvalidRangeException { if (netCDF.findDimension("AS") != null && netCDF.findDimension("DE") != null) { ArrayDouble bdc = new ArrayDouble.D2( netCDF.findDimension("DE").getLength(), netCDF.findDimension("AS").getLength()); // initialise everything to -1000000, default value IndexIterator bdcIt = bdc.getIndexIterator(); for(int designElementId : designElements) { for(Assay assay : assays) { double value = -1000000; Map<Integer,Float> evmap = expressionValues.get(assay.getAssayID()); if(evmap != null) { Float v = evmap.get(designElementId); if(v != null) value = Double.valueOf(v); } bdcIt.setDoubleNext(value); } } netCDF.write("BDC", bdc); } log.debug("Wrote expression data matrix ok."); }
int row = Math.max(Math.min(rectIndex[0], nrows - 1), 0); int col = Math.max(Math.min(rectIndex[1], ncols - 1), 0); double lat = latEdge.get(row, col); double lon = lonEdge.get(row, col); double diffLat = wantLat - lat; double diffLon = wantLon - lon; double dlatdy = latEdge.get(row + 1, col) - lat; double dlatdx = latEdge.get(row, col + 1) - lat; double dlondx = lonEdge.get(row, col + 1) - lon; double dlondy = lonEdge.get(row + 1, col) - lon;
/** * Get the coordinate values as a 1D double array, in canonical order. * * @return coordinate values * @throws UnsupportedOperationException if !isNumeric() */ public double[] getCoordValues() { if (coords == null) doRead(); if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis2D.getCoordValues() on non-numeric"); return (double[]) coords.get1DJavaArray(DataType.DOUBLE); }
ArrayDouble A = new ArrayDouble.D2(latDim.getLength(), lonDim.getLength()); int i, j; Index ima = A.getIndex();
ArrayDouble A = new ArrayDouble.D2(latDim.getLength(), lonDim.getLength()); int i, j; Index ima = A.getIndex();
return new ArrayFloat.D2(dimensions[0], dimensions[1]); } else if (varDataType == DataType.DOUBLE) { return new ArrayDouble.D2(dimensions[0], dimensions[1]); } else if (varDataType == DataType.BYTE) { return new ArrayByte.D2(dimensions[0], dimensions[1]);
ArrayDouble A = new ArrayDouble.D2(shape[0], shape[1]); int i, j; Index ima = A.getIndex();
ArrayDouble A = new ArrayDouble.D2(latDim.getLength(), lonDim.getLength()); int i,j; Index ima = A.getIndex(); ArrayDouble.D2 Ad = new ArrayDouble.D2(latDim.getLength(), lonDim.getLength()); for (i=0; i<latDim.getLength(); i++) for (j=0; j<lonDim.getLength(); j++) Ad.setDouble(ima.set(i,j), (double) (i*10.0+j)); Ad.set(1,1,-999.99); ncfile.write("m1", new int[2], Ad);
int col = rectIndex[1]; double x1 = lonEdge.get(row, col); double y1 = latEdge.get(row, col); double x2 = lonEdge.get(row, col + 1); double y2 = latEdge.get(row, col + 1); double x3 = lonEdge.get(row + 1, col + 1); double y3 = latEdge.get(row + 1, col + 1); double x4 = lonEdge.get(row + 1, col); double y4 = latEdge.get(row + 1, col);
unpacked = new ArrayDouble.D2(latDim.getLength(), lonDim.getLength()); Index ima = unpacked.getIndex();
int col = rectIndex[1]; double x1 = lonEdge.get(row, col); double y1 = latEdge.get(row, col); double x2 = lonEdge.get(row, col+1); double y2 = latEdge.get(row, col+1); double x3 = lonEdge.get(row+1, col+1); double y3 = latEdge.get(row + 1, col+1); double x4 = lonEdge.get(row + 1, col); double y4 = latEdge.get(row+1, col);
int col = rectIndex[1]; double x1 = lonEdge.get(row, col); double y1 = latEdge.get(row, col); double x2 = lonEdge.get(row, col+1); double y2 = latEdge.get(row, col+1); double x3 = lonEdge.get(row+1, col+1); double y3 = latEdge.get(row+1, col+1); double x4 = lonEdge.get(row+1, col); double y4 = latEdge.get(row+1, col);
int row = Math.max( Math.min(rectIndex[0], nrows-1), 0); int col = Math.max( Math.min(rectIndex[1], ncols-1), 0); double lat = latEdge.get(row, col); double lon = lonEdge.get(row, col); double diffLat = wantLat - lat; double diffLon = wantLon - lon; double dlatdy = latEdge.get(row + 1, col) - lat; double dlatdx = latEdge.get(row, col+1) - lat; double dlondx = lonEdge.get(row, col + 1) - lon; double dlondy = lonEdge.get(row + 1, col) - lon;
int col = rectIndex[1]; double x1 = lonEdge.get(row, col); double y1 = latEdge.get(row, col); double x2 = lonEdge.get(row, col+1); double y2 = latEdge.get(row, col+1); double x3 = lonEdge.get(row+1, col+1); double y3 = latEdge.get(row+1, col+1); double x4 = lonEdge.get(row+1, col); double y4 = latEdge.get(row+1, col);
int row = Math.max( Math.min(rectIndex[0], nrows-1), 0); int col = Math.max(Math.min(rectIndex[1], ncols - 1), 0); double lat = latEdge.get(row, col); double lon = lonEdge.get(row, col); double diffLat = wantLat - lat; double diffLon = wantLon - lon; double dlatdy = latEdge.get(row + 1, col) - lat; double dlatdx = latEdge.get(row, col+1) - lat; double dlondx = lonEdge.get(row, col + 1) - lon; double dlondy = lonEdge.get(row + 1, col) - lon;
int row = Math.max( Math.min(rectIndex[0], nrows-1), 0); int col = Math.max( Math.min(rectIndex[1], ncols-1), 0); double lat = latEdge.get(row, col); double lon = lonEdge.get(row, col); double diffLat = wantLat - lat; double diffLon = wantLon - lon; double dlatdy = latEdge.get(row + 1, col) - lat; double dlatdx = latEdge.get(row, col+1) - lat; double dlondx = lonEdge.get(row, col + 1) - lon; double dlondy = lonEdge.get(row + 1, col) - lon;
int col = rectIndex[1]; double x1 = lonEdge.get(row, col); double y1 = latEdge.get(row, col); double x2 = lonEdge.get(row, col+1); double y2 = latEdge.get(row, col+1); double x3 = lonEdge.get(row+1, col+1); double y3 = latEdge.get(row+1, col+1); double x4 = lonEdge.get(row+1, col); double y4 = latEdge.get(row+1, col);
int row = Math.max( Math.min(rectIndex[0], nrows-1), 0); int col = Math.max( Math.min(rectIndex[1], ncols-1), 0); double lat = latEdge.get(row, col); double lon = lonEdge.get(row, col); double diffLat = wantLat - lat; double diffLon = wantLon - lon; double dlatdy = latEdge.get(row + 1, col) - lat; double dlatdx = latEdge.get(row, col+1) - lat; double dlondx = lonEdge.get(row, col + 1) - lon; double dlondy = lonEdge.get(row + 1, col) - lon;
ArrayDouble.D2 lonEdges = (ArrayDouble.D2) lonAxis2D.getCoordBoundsAsArray(); assert Arrays.equals(latEdges.getShape(), lonEdges.getShape()) : "2D lat/lon edges ought to have the same shape"; int[] edgesShape = latEdges.getShape(); midpointsShape[0]++; midpointsShape[1]++; points.add(new LatLonPointImpl(latEdges.get(0, i), lonEdges.get(0, i))); points.add(new LatLonPointImpl(latEdges.get(j, numXtotal), lonEdges.get(j, numXtotal))); points.add(new LatLonPointImpl(latEdges.get(numYtotal, i), lonEdges.get(numYtotal, i))); points.add(new LatLonPointImpl(latEdges.get(j, 0), lonEdges.get(j, 0)));