public void writeHeader(PointFeature pf) throws IOException { List<VariableSimpleIF> coords = new ArrayList<>(); coords.add(VariableSimpleImpl.makeScalar(timeName, "time of measurement", timeUnit.getUnitsString(), DataType.DOUBLE)); coords.add(VariableSimpleImpl.makeScalar(latName, "latitude of measurement", CDM.LAT_UNITS, DataType.DOUBLE)); coords.add(VariableSimpleImpl.makeScalar(lonName, "longitude of measurement", CDM.LON_UNITS, DataType.DOUBLE)); Formatter coordNames = new Formatter().format("%s %s %s", timeName, latName, lonName); if (altUnits != null) { coords.add( VariableSimpleImpl.makeScalar(altName, "altitude of measurement", altUnits, DataType.DOUBLE) .add(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altName, altUnits)))); coordNames.format(" %s", altName); } super.writeHeader(coords, null, pf.getDataAll(), coordNames.toString()); }
public void writeHeader(PointFeature pf) throws IOException { List<VariableSimpleIF> coords = new ArrayList<>(); coords.add(VariableSimpleImpl.makeScalar(timeName, "time of measurement", timeUnit.getUdUnit(), DataType.DOUBLE) .add(new Attribute(CF.CALENDAR, timeUnit.getCalendar().toString()))); coords.add(VariableSimpleImpl.makeScalar(latName, "latitude of measurement", CDM.LAT_UNITS, DataType.DOUBLE)); coords.add(VariableSimpleImpl.makeScalar(lonName, "longitude of measurement", CDM.LON_UNITS, DataType.DOUBLE)); Formatter coordNames = new Formatter().format("%s %s %s", timeName, latName, lonName); if (altUnits != null) { coords.add( VariableSimpleImpl.makeScalar(altName, "altitude of measurement", altUnits, DataType.DOUBLE) .add(new Attribute(CF.POSITIVE, CF1Convention.getZisPositive(altName, altUnits)))); coordNames.format(" %s", altName); } super.writeHeader(coords, null, pf.getDataAll(), coordNames.toString()); }
StructureData data = pointFeature.getDataAll(); if (count == 0) {
StructureData data = pointFeature.getDataAll(); if (count == 0) {
static int countObs(PointFeatureCollection pfc) throws IOException { int count = 0; pfc.resetIteration(); while (pfc.hasNext()) { PointFeature pf = pfc.next(); StructureData sd = pf.getDataAll(); count++; } return count; }
static void showStructureData(PointFeatureCCC ccc) throws IOException { PrintWriter pw = new PrintWriter(System.out); IOIterator<PointFeatureCC> iter = ccc.getCollectionIterator(); while (iter.hasNext()) { PointFeatureCC cc = iter.next(); System.out.printf(" 1.hashCode=%d %n", cc.hashCode()); IOIterator<PointFeatureCollection> iter2 = cc.getCollectionIterator(); while (iter2.hasNext()) { PointFeatureCollection pfc = iter2.next(); System.out.printf(" 2.hashcode%d %n", pfc.hashCode()); for (ucar.nc2.ft.PointFeature pointFeature : pfc) { System.out.printf(" 3.hashcode=%d %n", pointFeature.hashCode()); StructureData sdata = pointFeature.getDataAll(); logger.debug(NCdumpW.toString(sdata)); } } } }
builder.setLoc(locBuilder); StructureData sdata = pf.getDataAll(); ArrayStructureBB abb = StructureDataDeep.copyToArrayBB(sdata); ByteBuffer bb = abb.getByteBuffer();
static private void checkPointFeature(PointFeature pobs, CalendarDateUnit timeUnit) throws java.io.IOException { Assert.assertNotNull("PointFeature location", pobs.getLocation()); Assert.assertNotNull("PointFeature time", pobs.getNominalTimeAsCalendarDate()); Assert.assertNotNull("PointFeature dataAll", pobs.getDataAll()); Assert.assertNotNull("PointFeature featureData", pobs.getFeatureData()); Assert.assertEquals("PointFeature makeCalendarDate", timeUnit.makeCalendarDate(pobs.getObservationTime()), pobs.getObservationTimeAsCalendarDate()); assert timeUnit.makeCalendarDate(pobs.getObservationTime()).equals(pobs.getObservationTimeAsCalendarDate()); checkData( pobs.getDataAll()); }
static public PointStreamProto.PointFeatureCollection encodePointFeatureCollection( String name, String timeUnitString, String altUnits, PointFeature pf) throws IOException { PointStreamProto.PointFeatureCollection.Builder builder = PointStreamProto.PointFeatureCollection.newBuilder(); if (name == null) System.out.printf("HEY null pointstream name%n"); builder.setName(name); builder.setTimeUnit(timeUnitString); if (altUnits != null) { builder.setAltUnit(altUnits); } StructureData sdata = pf.getDataAll(); StructureMembers sm = sdata.getStructureMembers(); for (StructureMembers.Member m : sm.getMembers()) { PointStreamProto.Member.Builder mbuilder = PointStreamProto.Member.newBuilder(); mbuilder.setName(m.getName()); if (null != m.getDescription()) mbuilder.setDesc(m.getDescription()); if (null != m.getUnitsString()) mbuilder.setUnits(m.getUnitsString()); mbuilder.setDataType(NcStream.convertDataType(m.getDataType())); mbuilder.setSection(NcStream.encodeSection(new ucar.ma2.Section(m.getShape()))); builder.addMembers(mbuilder); } return builder.build(); }