Search in sources :

Example 56 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Index

use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Index in project grpc-gcp-java by GoogleCloudPlatform.

the class ListIndexes method listIndexesCall.

public void listIndexesCall() {
    System.out.println(":: Listing All Indexes ::");
    FirestoreAdminBlockingStub blockingStub = new GRPCFirebaseAdminClientFactory().createFirebaseAdminClient().getBlockingStub();
    ListIndexesRequest listIndexesRequest = ListIndexesRequest.newBuilder().setParent("projects/firestoretestclient/databases/(default)").build();
    ListIndexesResponse response;
    try {
        response = blockingStub.listIndexes(listIndexesRequest);
    } catch (Exception e) {
        System.out.println("Error during call: " + e.getMessage() + e.getCause());
        return;
    }
    List<Index> indexList = response.getIndexesList();
    DrawIndex di = new DrawIndex();
    for (Index index : indexList) {
        di.drawIndex(index);
    }
    Menu menu = new Menu();
    menu.draw();
}
Also used : ListIndexesResponse(com.google.firestore.admin.v1beta1.ListIndexesResponse) FirestoreAdminBlockingStub(com.google.firestore.admin.v1beta1.FirestoreAdminGrpc.FirestoreAdminBlockingStub) DrawIndex(org.roguewave.grpc.util.gfx.DrawIndex) Index(com.google.firestore.admin.v1beta1.Index) DrawIndex(org.roguewave.grpc.util.gfx.DrawIndex) Menu(org.roguewave.grpc.util.gfx.Menu) GRPCFirebaseAdminClientFactory(org.roguewave.grpc.util.GRPCFirebaseAdminClientFactory) ListIndexesRequest(com.google.firestore.admin.v1beta1.ListIndexesRequest)

Example 57 with org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Index

use of org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Index in project ncWMS by Unidata.

the class PhaveosDataReader method read.

@Override
public List<Float> read(String filename, Layer layer, int tIndex, int zIndex, Domain<HorizontalPosition> targetDomain) throws IOException {
    NetcdfDataset nc = null;
    try {
        nc = NetcdfDataset.openDataset(filename);
        ucar.nc2.Variable var = nc.findVariable(layer.getId());
        // We read in data using a "bounding box" strategy
        PixelMap pm = new PixelMap(layer.getHorizontalGrid(), targetDomain);
        int iSize = pm.getMaxIIndex() - pm.getMinIIndex() + 1;
        int jSize = pm.getMaxJIndex() - pm.getMinJIndex() + 1;
        int[] origin = new int[] { pm.getMinJIndex(), pm.getMinIIndex() };
        int[] shape = new int[] { jSize, iSize };
        Array data = var.read(origin, shape);
        // Now copy the data to an array of floats
        Index index = data.getIndex();
        index.set(new int[index.getRank()]);
        float[] arr = new float[(int) targetDomain.size()];
        Arrays.fill(arr, Float.NaN);
        for (PixelMapEntry pme : pm) {
            int i = pme.getSourceGridIIndex() - pm.getMinIIndex();
            int j = pme.getSourceGridJIndex() - pm.getMinJIndex();
            index.set(new int[] { j, i });
            float val = data.getFloat(index);
            // Hack to deal with factor-1000 scale in L4 data
            if ("mtci_l4".equals(layer.getId())) {
                val /= 1000.0f;
            }
            for (int targetGridPoint : pme.getTargetGridPoints()) {
                arr[targetGridPoint] = val > 0.0f ? val : Float.NaN;
            }
        }
        return CdmUtils.wrap(arr);
    } catch (InvalidRangeException ire) {
        // Shouldn't happen: this would be a programming error
        throw new RuntimeException(ire);
    } finally {
        if (nc != null) {
            nc.close();
        }
    }
}
Also used : PixelMap(uk.ac.rdg.resc.edal.cdm.PixelMap) InvalidRangeException(ucar.ma2.InvalidRangeException) Index(ucar.ma2.Index) NetcdfDataset(ucar.nc2.dataset.NetcdfDataset) PixelMapEntry(uk.ac.rdg.resc.edal.cdm.PixelMap.PixelMapEntry) Array(ucar.ma2.Array)

Aggregations

Index (ucar.ma2.Index)30 ArrayList (java.util.ArrayList)21 Array (ucar.ma2.Array)20 Test (org.junit.Test)12 IOException (java.io.IOException)11 Attribute (ucar.nc2.Attribute)11 AbstractMessage (com.google.protobuf.AbstractMessage)10 WritableRaster (java.awt.image.WritableRaster)10 ArrayFloat (ucar.ma2.ArrayFloat)10 Index (com.google.firestore.admin.v1.Index)9 Dimension (ucar.nc2.Dimension)9 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Bigint)8 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Smallint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Smallint)8 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Tinyint (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Tinyint)8 NetcdfFileWriteable (ucar.nc2.NetcdfFileWriteable)8 Variable (ucar.nc2.Variable)8 org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column (org.jaxdb.www.ddlx_0_5.xLygluGCXAA.$Column)7 File (java.io.File)5 List (java.util.List)5 ArrayDouble (ucar.ma2.ArrayDouble)5