本文整理了Java中ucar.nc2.Group.findAttribute()
方法的一些代码示例,展示了Group.findAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Group.findAttribute()
方法的具体详情如下:
包路径:ucar.nc2.Group
类名称:Group
方法名:findAttribute
[英]Find an Attribute in this Group by its name.
[中]按名称查找此组中的属性。
代码示例来源:origin: edu.ucar/netcdf
private ucar.nc2.Attribute findAttribute(Object parent, String name) {
if (parent == null)
return null;
if (parent instanceof Group)
return ((Group) parent).findAttribute(name);
else if (parent instanceof Variable)
return ((Variable) parent).findAttribute(name);
return null;
}
代码示例来源:origin: edu.ucar/cdm
private ucar.nc2.Attribute findAttribute(Object parent, String name) {
if (parent == null)
return null;
if (parent instanceof Group)
return ((Group) parent).findAttribute(name);
else if (parent instanceof Variable)
return ((Variable) parent).findAttribute(name);
return null;
}
代码示例来源:origin: Unidata/thredds
private ucar.nc2.Attribute findAttribute(Object parent, String name) {
if (parent == null)
return null;
if (parent instanceof Group)
return ((Group) parent).findAttribute(name);
else if (parent instanceof Variable)
return ((Variable) parent).findAttribute(name);
return null;
}
代码示例来源:origin: Unidata/thredds
public Attribute findGlobalAttribute(String attName) {
return ncfile.getRootGroup().findAttribute(attName);
}
代码示例来源:origin: edu.ucar/cdm
public Attribute findGlobalAttribute(String attName) {
return ncfile.getRootGroup().findAttribute(attName);
}
代码示例来源:origin: bcdev/beam
@Override
protected DecodeQualification getDecodeQualification(NetcdfFile netcdfFile) {
Attribute attribute = netcdfFile.getRootGroup().findAttribute("metadata_profile");
if (attribute != null) {
String value = attribute.getStringValue();
if (value != null && value.equals("beam")) {
return DecodeQualification.INTENDED;
}
}
return DecodeQualification.UNABLE;
}
代码示例来源:origin: Unidata/thredds
/**
* Delete a group Attribute. Must be in define mode.
*
* @param g the group to add to. if null, use root group
* @param attName existing Attribute has this name
* @return deleted Attribute, or null if not found
*/
public Attribute deleteGroupAttribute(Group g, String attName) {
if (!defineMode) throw new UnsupportedOperationException("not in define mode");
if (g == null) g = ncfile.getRootGroup();
Attribute att = g.findAttribute(attName);
if (null == att) return null;
g.remove(att);
return att;
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Delete a group Attribute. Must be in define mode.
* @param g the group to add to. if null, use root group
* @param attName existing Attribute has this name
* @return deleted Attribute, or null if not found
*/
public Attribute deleteGroupAttribute(Group g, String attName) {
if (!defineMode) throw new UnsupportedOperationException("not in define mode");
if (g == null) g = ncfile.getRootGroup();
Attribute att = g.findAttribute(attName);
if (null == att) return null;
g.remove(att);
return att;
}
代码示例来源:origin: Unidata/thredds
/**
* Copy attributes from src to target, skip ones that already exist (by name)
* @param src copy from here
* @param target copy to here
*/
static public void transferGroupAttributes(Group src, Group target) {
for (Attribute a : src.getAttributes()) {
if (null == target.findAttribute(a.getShortName()))
target.addAttribute(a);
}
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Copy attributes from src to target, skip ones that already exist (by name)
* @param src copy from here
* @param target copy to here
*/
static public void transferGroupAttributes(Group src, Group target) {
for (Attribute a : src.getAttributes()) {
if (null == target.findAttribute(a.getShortName()))
target.addAttribute(a);
}
}
代码示例来源:origin: edu.ucar/cdm
/**
* Copy attributes from src to target, skip ones that already exist (by name)
* @param src copy from here
* @param target copy to here
*/
static public void transferGroupAttributes(Group src, Group target) {
for (Attribute a : src.getAttributes()) {
if (null == target.findAttribute(a.getShortName()))
target.addAttribute(a);
}
}
代码示例来源:origin: openmicroscopy/bioformats
@Override
public String getAttributeValue(String path) {
String groupName = getDirectory(path);
String attributeName = getName(path);
Group group = getGroup(groupName);
Attribute attribute = group.findAttribute(attributeName);
if (attribute == null) return null;
return arrayToString(attribute.getValues());
}
代码示例来源:origin: ome/formats-gpl
@Override
public String getAttributeValue(String path) {
String groupName = getDirectory(path);
String attributeName = getName(path);
Group group = getGroup(groupName);
Attribute attribute = group.findAttribute(attributeName);
if (attribute == null) return null;
return arrayToString(attribute.getValues());
}
代码示例来源:origin: edu.ucar/netcdf
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();
}
代码示例来源:origin: edu.ucar/netcdf4
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();
}
代码示例来源:origin: bcdev/beam
@Override
public void decode(ProfileReadContext ctx, Product p) throws IOException {
for (String attribName : DESCRIPTION_ATTRIBUTE_NAMES) {
Attribute attribute = ctx.getNetcdfFile().getRootGroup().findAttribute(attribName);
if (attribute != null) {
final String description = attribute.getStringValue();
if (description != null) {
p.setDescription(description);
return;
}
}
}
p.setDescription(Constants.FORMAT_DESCRIPTION);
}
代码示例来源:origin: Unidata/thredds
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();
}
代码示例来源:origin: Unidata/thredds
@Test
public void problemHugeHeapId() throws IOException {
//H5header.setDebugFlags(new ucar.nc2.util.DebugFlagsImpl("H5header/header"));
String filename = TestH5.testDir + "SMAP_L4_SM_aup_20140115T030000_V05007_001.h5";
try (NetcdfFile ncfile = NetcdfFile.open(filename)) {
Group g = ncfile.findGroup("Metadata");
assert g != null;
Attribute att = g.findAttribute("iso_19139_dataset_xml");
assert att != null;
assert att.isString();
String val = att.getStringValue();
System.out.printf(" len of %s is %d%n", att.getFullName(), val.length());
assert val.length() > 200 * 1000; // silly rabbit
}
}
代码示例来源:origin: Unidata/thredds
@org.junit.Test
public void testReadH5attributeString() throws IOException {
try (NetcdfFile ncfile = TestH5.openH5("support/attstr.h5")) {
Group g = ncfile.getRootGroup().findGroup("MyGroup");
assert null != g;
Attribute att = g.findAttribute("data_contents");
assert (null != att);
assert (!att.isArray());
assert (att.isString());
assert (att.getStringValue().equals("important_data"));
}
}
代码示例来源:origin: Unidata/thredds
@Test
public void testReadByName() throws IOException
{
NetcdfFile ncfile = TestDir.openFileLocal("testSpecialAttributes.nc4");
// Attempt to read special attributes by name
for(String name : new String[]{CDM.NCPROPERTIES}) {
Attribute special = ncfile.getRootGroup().findAttribute(name);
Assert.assertTrue("Could not access special attribute: " + name,
special != null && Attribute.isspecial(special));
}
ncfile.close();
}
内容来源于网络,如有侵权,请联系作者删除!