private void writeGlobalAttributes(NetcdfFileWriter writer, ucar.nc2.dt.GridDataset gds, LatLonRect llbb) { // 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); } 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 (NetcdfCFWriter)\n" + "Original Dataset = " + gds.getLocationURI() + "; Translation Date = " + new Date())); // this will replace any existing writer.addGroupAttribute(null, new Attribute(CDM.LAT_MIN, llbb.getLatMin())); writer.addGroupAttribute(null, new Attribute(CDM.LAT_MAX, llbb.getLatMax())); writer.addGroupAttribute(null, new Attribute(CDM.LON_MIN, llbb.getLonMin())); writer.addGroupAttribute(null, new Attribute(CDM.LON_MAX, llbb.getLonMax())); }
private void writeGlobalAttributes(NetcdfFileWriter writer, ucar.nc2.dt.GridDataset gds, LatLonRect llbb) { // 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.findGlobalAttributeIgnoreCase(CDM.CONVENTIONS); if (att == null || !att.getStringValue().startsWith("CF-")) // preserve previous version of CF Convention if it 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 (CFGridWriter)\n" + "Original Dataset = " + gds.getLocationURI() + "; Translation Date = " + CalendarDate.present())); // 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())); }
private void addGlobalAttributes(NetcdfFileWriter writer, ucar.nc2.dt.GridDataset gds, LatLonRect llbb) { // 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.findGlobalAttributeIgnoreCase(CDM.CONVENTIONS); if (att == null || !att.getStringValue().startsWith("CF-")) // preserve previous version of CF Convention if it 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 (CFGridWriter2)\n" + "Original Dataset = " + gds.getLocationURI() + "; Translation Date = " + CalendarDate.present())); // 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())); }
Variable newV = writer.findVariable(gridName); if (newV == null) { log.warn("NetcdfCFWriter cant find " + gridName + " in gds " + gds.getLocationURI()); continue;
Variable newV = writer.findVariable(gridName); if (newV == null) { log.warn("NetcdfCFWriter cant find " + gridName + " in gds " + gds.getLocationURI()); continue;
Variable newV = writer.findVariable(gridName); if (newV == null) { log.warn("NetcdfCFWriter cant find " + gridName + " in gds " + gds.getLocationURI()); continue;
Element rootElem = new Element("gridForm"); Document doc = new Document(rootElem); rootElem.setAttribute("location", gds.getLocationURI()); if (null != path) rootElem.setAttribute("path", path);
Element rootElem = new Element("gridForm"); Document doc = new Document(rootElem); rootElem.setAttribute("location", gds.getLocationURI()); if (null != path) rootElem.setAttribute("path", path);
Element rootElem = new Element("gridDataset"); Document doc = new Document(rootElem); rootElem.setAttribute("location", gds.getLocationURI()); if (null != path) rootElem.setAttribute("path", path);
Element rootElem = new Element("gridDataset"); Document doc = new Document(rootElem); rootElem.setAttribute("location", gds.getLocationURI()); if (null != path) rootElem.setAttribute("path", path);