protected void unravelStringMet(NetcdfFile ncFile, Group group, Metadata met) { if (group == null) { group = ncFile.getRootGroup(); } // get file type met.set("File-Type-Description", ncFile.getFileTypeDescription()); // unravel its string attrs for (Attribute attribute : group.getAttributes()) { if (attribute.isString()) { met.add(attribute.getFullName(), attribute.getStringValue()); } else { // try and cast its value to a string met.add(attribute.getFullName(), String.valueOf(attribute .getNumericValue())); } } for (Group g : group.getGroups()) { unravelStringMet(ncFile, g, met); } }
/** * Set the Group's parent Group * * @param parent parent group. */ public void setParentGroup(Group parent) { if (immutable) throw new IllegalStateException("Cant modify"); super.setParentGroup(parent == null ? ncfile.getRootGroup() : parent); }
/** * Set the Group's parent Group * * @param parent parent group. */ public void setParentGroup(Group parent) { if (immutable) throw new IllegalStateException("Cant modify"); super.setParentGroup(parent == null ? ncfile.getRootGroup() : parent); }
/** * Constructor * * @param ncfile NetcdfFile owns this Group * @param parent parent of Group. If null, this is the root Group. * @param shortName short name of Group. */ public Group(NetcdfFile ncfile, Group parent, String shortName) { super(shortName); this.ncfile = ncfile; setParentGroup(parent == null ? ncfile.getRootGroup() : parent); }
public void getEosInfo(Formatter f) throws IOException { NetcdfFile ncfile = headerParser.ncfile; Group eosInfo = ncfile.getRootGroup().findGroup(HdfEos.HDF5_GROUP); if (eosInfo != null) { HdfEos.getEosInfo(ncfile, eosInfo, f); } else { f.format("Cant find GROUP '%s'", HdfEos.HDF5_GROUP); } }
public void getEosInfo(Formatter f) throws IOException { NetcdfFile ncfile = headerParser.ncfile; Group eosInfo = ncfile.getRootGroup().findGroup(HdfEos.HDF5_GROUP); if (eosInfo != null) { HdfEos.getEosInfo(ncfile, eosInfo, f); } else { f.format("Cant find GROUP '%s'", HdfEos.HDF5_GROUP); } }
public void rewrite() throws IOException, InvalidRangeException { Attribute attr = ncIn.getRootGroup().findAttribute("featureType"); if(attr.getStringValue().contains("RADIAL")) isRadial = true; createGroup(null, ncIn.getRootGroup()); ncOut.create(); transferData(ncIn.getRootGroup()); ncOut.close(); }
public void rewrite() throws IOException, InvalidRangeException { Attribute attr = ncIn.getRootGroup().findAttribute("featureType"); if(attr.getStringValue().contains("RADIAL")) isRadial = true; createGroup(null, ncIn.getRootGroup()); ncOut.create(); transferData(ncIn.getRootGroup()); ncOut.close(); }
public static boolean isMine(NetcdfFile ncfile) { if (!ncfile.getFileTypeId().equals("HDF4-EOS")) return false; String typeName = ncfile.findAttValueIgnoreCase(null, CF.FEATURE_TYPE, null); if (typeName == null) return false; if (!typeName.equals(FeatureType.GRID.toString()) && !typeName.equals(FeatureType.SWATH.toString())) return false; return checkGroup(ncfile.getRootGroup()); }
public static boolean isMine(NetcdfFile ncfile) { if (!ncfile.getFileTypeId().equals("HDF4-EOS")) return false; String typeName = ncfile.findAttValueIgnoreCase(null, CF.FEATURE_TYPE, null); if (typeName == null) return false; if (!typeName.equals(FeatureType.GRID.toString()) && !typeName.equals(FeatureType.SWATH.toString())) return false; return checkGroup(ncfile.getRootGroup()); }
public static boolean isMine(NetcdfFile ncfile) { if (!ncfile.getFileTypeId().equals("HDF4-EOS")) return false; String typeName = ncfile.findAttValueIgnoreCase(null, CF.FEATURE_TYPE, null); if (typeName == null) return false; if (!typeName.equals(FeatureType.GRID.toString()) && !typeName.equals(FeatureType.SWATH.toString())) return false; return checkGroup(ncfile.getRootGroup()); }
static public Dimension getBoundsDimension(NetcdfFile ncfile) { Group g = ncfile.getRootGroup(); Dimension d = g.findDimension(boundsDimName); if (d == null) d = ncfile.addDimension(g, new Dimension(boundsDimName, 2, true)); return d; }
static public Dimension getBoundsDimension(NetcdfFile ncfile) { Group g = ncfile.getRootGroup(); Dimension d = g.findDimension(boundsDimName); if (d == null) d = ncfile.addDimension(g, new Dimension(boundsDimName, 2, true)); return d; }
static public Dimension getBoundsDimension(NetcdfFile ncfile) { Group g = ncfile.getRootGroup(); Dimension d = g.findDimension(boundsDimName); if (d == null) d = ncfile.addDimension(g, new Dimension(boundsDimName, 2, true)); return d; }
private void addMetadataToProduct() { final Group rootGroup = netcdfFile.getRootGroup(); NetCDFUtils.addGroups(product.getMetadataRoot(), rootGroup); AbstractMetadata.getAbstractedMetadata(product); }
public void open(RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask) throws IOException { super.open(raf, ncfile, cancelTask); headerParser = new H5header(this.raf, ncfile, this); headerParser.read(null); // check if its an HDF5-EOS file Group eosInfo = ncfile.getRootGroup().findGroup(HdfEos.HDF5_GROUP); if (eosInfo != null && !skipEos) { isEos = HdfEos.amendFromODL(ncfile, eosInfo); } ncfile.finish(); }
public void open(RandomAccessFile raf, ucar.nc2.NetcdfFile ncfile, ucar.nc2.util.CancelTask cancelTask) throws IOException { super.open(raf, ncfile, cancelTask); headerParser = new H5header(this.raf, ncfile, this); headerParser.read(null); // check if its an HDF5-EOS file Group eosInfo = ncfile.getRootGroup().findGroup(HdfEos.HDF5_GROUP); if (eosInfo != null && useHdfEos) { isEos = HdfEos.amendFromODL(ncfile, eosInfo); } ncfile.finish(); }
private NetcdfFile proto2nc(NcStreamProto.Header proto, NetcdfFile ncfile) throws InvalidProtocolBufferException { if (ncfile == null) ncfile = new NetcdfFileSubclass(); // not used i think ncfile.setLocation(proto.getLocation()); if (proto.getId().length() > 0) ncfile.setId(proto.getId()); if (proto.getTitle().length() > 0) ncfile.setTitle(proto.getTitle()); NcStreamProto.Group root = proto.getRoot(); NcStream.readGroup(root, ncfile, ncfile.getRootGroup()); ncfile.finish(); return ncfile; }
public NcStreamWriterChannel(NetcdfFile ncfile, String location) throws IOException { this.ncfile = ncfile; NcStreamProto.Group.Builder rootBuilder = NcStream.encodeGroup(ncfile.getRootGroup(), sizeToCache); NcStreamProto.Header.Builder headerBuilder = NcStreamProto.Header.newBuilder(); headerBuilder.setLocation(location == null ? ncfile.getLocation() : location); if (ncfile.getTitle() != null) headerBuilder.setTitle(ncfile.getTitle()); if (ncfile.getId() != null) headerBuilder.setId(ncfile.getId()); headerBuilder.setRoot(rootBuilder); header = headerBuilder.build(); }
public NcStreamWriterChannel(NetcdfFile ncfile, String location) throws IOException { this.ncfile = ncfile; NcStreamProto.Group.Builder rootBuilder = NcStream.encodeGroup(ncfile.getRootGroup(), sizeToCache); NcStreamProto.Header.Builder headerBuilder = NcStreamProto.Header.newBuilder(); headerBuilder.setLocation(location == null ? ncfile.getLocation() : location); if (ncfile.getTitle() != null) headerBuilder.setTitle(ncfile.getTitle()); if (ncfile.getId() != null) headerBuilder.setId(ncfile.getId()); headerBuilder.setRoot(rootBuilder); header = headerBuilder.build(); }