public FeatureDatasetCoverage(String location, Closeable closer, CoverageCollection covCollection) { this.location = location; this.gatts = new AttributeContainerHelper(location, covCollection.getGlobalAttributes()); this.closer = closer; this.covCollections = Lists.newArrayList(covCollection); this.featureType = covCollection.getCoverageType(); this.calendarDateRange = covCollection.getCalendarDateRange(); }
new AttributeContainerHelper(org.getName(), org.getGlobalAttributes()), null, null, null,
private void addGlobalAttributes(CoverageCollection gds, NetcdfFileWriter writer) { // global attributes for (Attribute att : gds.getGlobalAttributes()) { if (att.getShortName().equals(CDM.FILE_FORMAT)) continue; if (att.getShortName().equals(_Coordinate._CoordSysBuilder)) continue; writer.addGroupAttribute(null, att); } Attribute att = gds.findAttributeIgnoreCase(CDM.CONVENTIONS); if (att == null || !att.getStringValue().startsWith("CF-")) // preserve prev version of CF Convention if exists writer.addGroupAttribute(null, new Attribute(CDM.CONVENTIONS, "CF-1.0")); writer.addGroupAttribute(null, new Attribute("History", "Translated to CF-1.0 Conventions by Netcdf-Java CDM (CFGridCoverageWriter2)\n" + "Original Dataset = " + gds.getName() + "; Translation Date = " + CalendarDate.present())); LatLonRect llbb = gds.getLatlonBoundingBox(); if (llbb != null) { // this will replace any existing writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MIN, llbb.getLatMin())); writer.addGroupAttribute(null, new Attribute(ACDD.LAT_MAX, llbb.getLatMax())); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MIN, llbb.getLonMin())); writer.addGroupAttribute(null, new Attribute(ACDD.LON_MAX, llbb.getLonMax())); } }
CdmrFeatureProto.CoverageDataset.Builder encodeHeader(CoverageCollection gridDataset, String location) { CdmrFeatureProto.CoverageDataset.Builder builder = CdmrFeatureProto.CoverageDataset.newBuilder(); builder.setName(location); builder.setCoverageType(convertCoverageType(gridDataset.getCoverageType())); builder.setDateRange(encodeDateRange(gridDataset.getCalendarDateRange())); if (gridDataset.getLatlonBoundingBox() != null) builder.setLatlonRect(encodeRectangle(gridDataset.getLatlonBoundingBox())); if (gridDataset.getProjBoundingBox() != null) builder.setProjRect(encodeRectangle(gridDataset.getProjBoundingBox())); for (Attribute att : gridDataset.getGlobalAttributes()) builder.addAtts(NcStream.encodeAtt(att)); for (CoverageCoordSys gcs : gridDataset.getCoordSys()) builder.addCoordSys(encodeCoordSys(gcs)); for (CoverageTransform gct : gridDataset.getCoordTransforms()) builder.addCoordTransforms(encodeCoordTransform(gct)); for (CoverageCoordAxis axis : gridDataset.getCoordAxes()) builder.addCoordAxes(encodeCoordAxis(axis)); for (Coverage grid : gridDataset.getCoverages()) builder.addGrids(encodeGrid(grid)); return builder; }