Package ketUI

Examples of ketUI.Album$Index


            int minTileX = minX / tileWidth - (minX < 0 ? (-minX % tileWidth > 0 ? 1 : 0): 0);
            int minTileY = minY / tileHeight - (minY < 0 ? (-minY % tileHeight > 0 ? 1 : 0): 0);
            int maxTileX = maxX / tileWidth - (maxX < 0 ? (-maxX % tileWidth > 0 ? 1 : 0): 0);
            int maxTileY = maxY / tileHeight - (maxY < 0 ? (-maxY % tileHeight > 0 ? 1 : 0): 0);

            final Index matrixIndex = matrix.getIndex();
            final int indexing[] = new int[numDimensions];

            // Update the NetCDF array indexing to set values for a specific 2D slice
            updateIndexing(indexing, gridCoverage);

            // ----------------
            // Fill data matrix
            // ----------------

            // Loop over bands using a RandomIter
            final RandomIter data = RandomIterFactory.create(ri, null);
            for (int tileY = minTileY; tileY <= maxTileY; tileY++) {
                for (int tileX = minTileX; tileX <= maxTileX; tileX++) {
                    for (int trow = 0; trow < tileHeight; trow++) {
                        int j = (tileY * tileHeight) + trow;
                        if ((j >= minY) && (j <= maxY)) {
                            for (int tcol = 0; tcol < tileWidth; tcol++) {
                                int col = (tileX * tileWidth) + tcol;
                                if ((col >= minX) && (col <= maxX)) {
                                    int k = col;
                                    final int yPos = height - j + minY - 1;

                                    // Simply setting lat and lon
                                    indexing[numDimensions - 1] = k - minX;
                                    indexing[numDimensions - 2] = yPos;
                                    matrixIndex.set(indexing);

                                    // Write data
                                    switch (netCDFDataType) {
                                    case BYTE:
                                        byte sampleByte = (byte) data.getSampleFloat(k, j, 0);
View Full Code Here


        // --------
        // latitude
        // --------
        final ArrayFloat latData = new ArrayFloat(new int[] { numLat });
        final Index latIndex = latData.getIndex();
        final Variable varLat = writer.addVariable(null, NCUtilities.LAT, DataType.FLOAT, NCUtilities.LAT);
        writer.addVariableAttribute(varLat, new Attribute(NCUtilities.LONGNAME, NCUtilities.LATITUDE));
        writer.addVariableAttribute(varLat, new Attribute(NCUtilities.UNITS, NCUtilities.LAT_UNITS));

        for (int yPos = 0; yPos < numLat; yPos++) {
            latData.setFloat(latIndex.set(yPos),
            // new Float(
            // ymax
            // - (new Float(yPos)
            // .floatValue() * periodY))
            // .floatValue());
                    new Float(ymin + (new Float(yPos).floatValue() * periodY)).floatValue());
        }

        // ---------
        // longitude
        // ---------
        final ArrayFloat lonData = new ArrayFloat(new int[] { numLon });
        final Index lonIndex = lonData.getIndex();
        final Variable varLon = writer.addVariable(null, NCUtilities.LON, DataType.FLOAT, NCUtilities.LON);
        writer.addVariableAttribute(varLon, new Attribute(NCUtilities.LONGNAME, NCUtilities.LONGITUDE));
        writer.addVariableAttribute(varLon, new Attribute(NCUtilities.UNITS, NCUtilities.LON_UNITS));

        for (int xPos = 0; xPos < numLon; xPos++) {
            lonData.setFloat(lonIndex.set(xPos), new Float(xmin
                    + (new Float(xPos).floatValue() * periodX)).floatValue());
        }

        // Latitude management
        final NetCDFDimensionManager latManager = new NetCDFDimensionManager(NCUtilities.LAT);
View Full Code Here

            // Get a proper array to contain the dimension values
            final int[] dimensionSize = rangeValues ? new int[] { numElements, 2 } : new int[] {numElements};
            final Array data = NCUtilities.getArray(dimensionSize, netCDFDataType);

            final Index index = data.getIndex();
            final Iterator<Object> valuesIterator = values.iterator();
            final int indexing[] = new int[rangeValues ? 2: 1];

            // Setting array values
            for (int pos = 0; pos < numElements; pos++) {
                indexing[0] = pos;
                Object value = valuesIterator.next();
                data.setObject(index.set(indexing), getValue(value, isTime, false));
                if (rangeValues) {
                    indexing[1] = 1;
                    data.setObject(index.set(indexing), getValue(value, isTime, rangeValues));
                    indexing[1] = 0;
                }
            }
            return data;
        }
View Full Code Here

TOP

Related Classes of ketUI.Album$Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.