use of com.google.firestore.admin.v1.Index in project java-firestore by googleapis.
the class FirestoreAdminClient method deleteIndex.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a composite index.
*
* <p>Sample code:
*
* <pre>{@code
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* String name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]").toString();
* firestoreAdminClient.deleteIndex(name);
* }
* }</pre>
*
* @param name Required. A name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteIndex(String name) {
DeleteIndexRequest request = DeleteIndexRequest.newBuilder().setName(name).build();
deleteIndex(request);
}
use of com.google.firestore.admin.v1.Index in project java-firestore by googleapis.
the class FirestoreAdminClient method deleteIndex.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a composite index.
*
* <p>Sample code:
*
* <pre>{@code
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
* IndexName name = IndexName.of("[PROJECT]", "[DATABASE]", "[COLLECTION]", "[INDEX]");
* firestoreAdminClient.deleteIndex(name);
* }
* }</pre>
*
* @param name Required. A name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteIndex(IndexName name) {
DeleteIndexRequest request = DeleteIndexRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteIndex(request);
}
use of com.google.firestore.admin.v1.Index in project s1tbx by senbox-org.
the class NetCDFWriter method writeBandRasterData.
/**
* {@inheritDoc}
*/
public void writeBandRasterData(final Band sourceBand, final int regionX, final int regionY, final int regionWidth, final int regionHeight, final ProductData regionData, ProgressMonitor pm) throws IOException {
final int[] origin = new int[2];
origin[1] = regionX;
origin[0] = regionY;
try {
final ArrayDouble dataTemp = new ArrayDouble.D2(regionHeight, regionWidth);
final Index index = dataTemp.getIndex();
int i = 0;
for (int y = 0; y < regionHeight; ++y) {
for (int x = 0; x < regionWidth; ++x) {
index.set(y, x);
dataTemp.set(index, regionData.getElemDoubleAt(i));
++i;
}
}
netCDFWriteable.write(sourceBand.getName(), origin, dataTemp);
pm.worked(1);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
use of com.google.firestore.admin.v1.Index in project ncWMS by Unidata.
the class CdmUtils method readTimeseries.
public static List<Float> readTimeseries(NetcdfDataset nc, GridDatatype grid, HorizontalGrid horizGrid, List<Integer> tIndices, int zIndex, HorizontalPosition xy) throws IOException {
GridCoordinates gridCoords = horizGrid.findNearestGridPoint(xy);
if (gridCoords == null) {
// a list of nulls
return nullList(tIndices.size());
}
int i = gridCoords.getCoordinateValue(0);
int j = gridCoords.getCoordinateValue(1);
int firstTIndex = tIndices.get(0);
int lastTIndex = tIndices.get(tIndices.size() - 1);
RangesList rangesList = new RangesList(grid);
rangesList.setTRange(firstTIndex, lastTIndex);
rangesList.setZRange(zIndex, zIndex);
rangesList.setYRange(j, j);
rangesList.setXRange(i, i);
// We read data for the whole time range. This may mean grabbing
// data we don't need.
// TODO: use a datareadingstrategy here to read point-by-point for
// local files?
DataChunk dataChunk = DataChunk.readDataChunk(grid.getVariable(), rangesList);
// Copy the data to the required array, discarding the points we
// don't need
List<Float> tsData = new ArrayList<Float>(tIndices.size());
Index index = dataChunk.getIndex();
index.set(new int[index.getRank()]);
for (int tIndex : tIndices) {
int tIndexOffset = tIndex - firstTIndex;
// This will happen if the layer has no t axis
if (tIndexOffset < 0)
tIndexOffset = 0;
index.setDim(rangesList.getTAxisIndex(), tIndexOffset);
// Read the data from the chunk, applying enhancement if necessary
float val = dataChunk.readFloatValue(index);
// Replace missing values with nulls
tsData.add(Float.isNaN(val) ? null : val);
}
return tsData;
}
use of com.google.firestore.admin.v1.Index in project mzmine2 by mzmine.
the class NetCDFReadTask method readNextScan.
/**
* Reads one scan from the file. Requires that general information has already been read.
*/
private Scan readNextScan() throws IOException {
// Get scan starting position and length
int[] scanStartPosition = new int[1];
int[] scanLength = new int[1];
Integer[] startAndLength = scansIndex.get(scanNum);
// End of file
if (startAndLength == null) {
return null;
}
scanStartPosition[0] = startAndLength[0];
scanLength[0] = startAndLength[1];
// Get retention time of the scan
Double retentionTime = scansRetentionTimes.get(scanNum);
if (retentionTime == null) {
logger.severe("Could not find retention time for scan " + scanNum);
throw (new IOException("Could not find retention time for scan " + scanNum));
}
// An empty scan needs special attention..
if (scanLength[0] == 0) {
scanNum++;
return new SimpleScan(null, scanNum, 1, retentionTime.doubleValue(), 0, 0, null, new DataPoint[0], MassSpectrumType.CENTROIDED, PolarityType.UNKNOWN, "", null);
}
// Is there any way how to extract polarity from netcdf?
PolarityType polarity = PolarityType.UNKNOWN;
// Is there any way how to extract scan definition from netcdf?
String scanDefinition = "";
// Read mass and intensity values
Array massValueArray;
Array intensityValueArray;
try {
massValueArray = massValueVariable.read(scanStartPosition, scanLength);
intensityValueArray = intensityValueVariable.read(scanStartPosition, scanLength);
} catch (Exception e) {
logger.log(Level.SEVERE, "Could not read from variables mass_values and/or intensity_values.", e);
throw (new IOException("Could not read from variables mass_values and/or intensity_values."));
}
Index massValuesIndex = massValueArray.getIndex();
Index intensityValuesIndex = intensityValueArray.getIndex();
int arrayLength = massValueArray.getShape()[0];
DataPoint[] dataPoints = new DataPoint[arrayLength];
for (int j = 0; j < arrayLength; j++) {
Index massIndex0 = massValuesIndex.set0(j);
Index intensityIndex0 = intensityValuesIndex.set0(j);
double mz = massValueArray.getDouble(massIndex0) * massValueScaleFactor;
double intensity = intensityValueArray.getDouble(intensityIndex0) * intensityValueScaleFactor;
dataPoints[j] = new SimpleDataPoint(mz, intensity);
}
scanNum++;
// Auto-detect whether this scan is centroided
MassSpectrumType spectrumType = ScanUtils.detectSpectrumType(dataPoints);
SimpleScan buildingScan = new SimpleScan(null, scanNum, 1, retentionTime.doubleValue(), 0, 0, null, dataPoints, spectrumType, polarity, scanDefinition, null);
return buildingScan;
}
Aggregations