Codota Logo
Attribute.isString
Code IndexAdd Codota to your IDE (free)

How to use
isString
method
in
ucar.nc2.Attribute

Best Java code snippets using ucar.nc2.Attribute.isString (Showing top 20 results out of 315)

  • Common ways to obtain Attribute
private void myMethod () {
Attribute a =
  • Codota IconVariable v;String name;v.addAttribute(new Attribute(name, "true"))
  • Codota IconVariable v;String name;v.findAttribute(name)
  • Codota IconVariable v;String name;String val;v.addAttribute(new Attribute(name, val))
  • Smart code suggestions by Codota
}
origin: apache/tika

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);
  }
}
origin: edu.ucar/cdm

private double findAttributeDouble(NetcdfDataset ds, String attname) {
 Attribute att = ds.findGlobalAttributeIgnoreCase(attname);
 if ((att == null) || (att.isString())) return Double.NaN;
 return att.getNumericValue().doubleValue();
}
origin: Unidata/thredds

private double findAttributeDouble(NetcdfDataset ds, String attname) {
 Attribute att = ds.findGlobalAttributeIgnoreCase(attname);
 if ((att == null) || (att.isString())) return Double.NaN;
 return att.getNumericValue().doubleValue();
}
origin: edu.ucar/netcdf

static private boolean hasStringAttribute_( NetcdfFile ncFile, String name,
                      int length ) {
 Attribute a = ncFile.findGlobalAttribute( name );
 return a != null && a.isString() && a.getStringValue().length()==length;
}
origin: edu.ucar/netcdf

private double findAttributeDouble(NetcdfDataset ds, String attname) {
 Attribute att = ds.findGlobalAttributeIgnoreCase(attname);
 if ((att == null) || (att.isString())) return Double.NaN;
 return att.getNumericValue().doubleValue();
}
origin: Unidata/thredds

/**
 * Get the value as an Object.
 *
 * @param index which index
 * @return ith value as an Object.
 */
public Object getValue(int index) {
 if (isString()) return getStringValue(index);
 return getNumericValue(index);
}
origin: Unidata/thredds

@Override
public String findAttValueIgnoreCase(String attName, String defaultValue) {
 String attValue = null;
 Attribute att = findAttributeIgnoreCase(attName);
 if ((att != null) && att.isString())
  attValue = att.getStringValue();
 if (null == attValue)                     // not found, use default
  attValue = defaultValue;
 return attValue;
}
origin: edu.ucar/netcdf

/**
 * Get the value as an Object.
 *
 * @param index which index
 * @return ith value as an Object.
 */
public Object getValue(int index) {
 if (isString()) return getStringValue(index);
 return getNumericValue(index);
}
origin: edu.ucar/cdm

/**
 * Get the value as an Object.
 *
 * @param index which index
 * @return ith value as an Object.
 */
public Object getValue(int index) {
 if (isString()) return getStringValue(index);
 return getNumericValue(index);
}
origin: org.n52.sensorweb.sos/coding-netcdf

private double checkValue(Variable v, Double value) {
  Attribute aStandardName = v.findAttributeIgnoreCase(CFConstants.STANDARD_NAME);
  if (aStandardName.isString() && CFStandardNames.DEPTH.getName().equals(aStandardName.getStringValue())) {
    return value != 0.0 ? value * (-1.0) : value;
  }
  return value;
}
origin: Unidata/thredds

public double readAttributeDouble(Variable v, String attName, double defValue) {
 Attribute att;
 if (v == null)
  att = rootGroup.findAttributeIgnoreCase(attName);
 else
  att = v.findAttributeIgnoreCase(attName);
 if (att == null) return defValue;
 if (att.isString())
  return Double.parseDouble(att.getStringValue());
 else
  return att.getNumericValue().doubleValue();
}
origin: edu.ucar/cdm

public int readAttributeInteger(Variable v, String attName, int defValue) {
 Attribute att;
 if (v == null)
  att = rootGroup.findAttributeIgnoreCase(attName);
 else
  att = v.findAttributeIgnoreCase(attName);
 if (att == null) return defValue;
 if (att.isString())
  return Integer.parseInt(att.getStringValue());
 else
  return att.getNumericValue().intValue();
}
origin: Unidata/thredds

public int readAttributeInteger(Variable v, String attName, int defValue) {
 Attribute att;
 if (v == null)
  att = rootGroup.findAttributeIgnoreCase(attName);
 else
  att = v.findAttributeIgnoreCase(attName);
 if (att == null) return defValue;
 if (att.isString())
  return Integer.parseInt(att.getStringValue());
 else
  return att.getNumericValue().intValue();
}
origin: edu.ucar/netcdf

public int readAttributeInteger(Variable v, String attName, int defValue) {
 Attribute att;
 if (v == null)
  att = rootGroup.findAttributeIgnoreCase(attName);
 else
  att = v.findAttributeIgnoreCase(attName);
 if (att == null) return defValue;
 if (att.isString())
  return Integer.parseInt(att.getStringValue());
 else
  return att.getNumericValue().intValue();
}
origin: edu.ucar/cdm

public double readAttributeDouble(Variable v, String attName, double defValue) {
 Attribute att;
 if (v == null)
  att = rootGroup.findAttributeIgnoreCase(attName);
 else
  att = v.findAttributeIgnoreCase(attName);
 if (att == null) return defValue;
 if (att.isString())
  return Double.parseDouble(att.getStringValue());
 else
  return att.getNumericValue().doubleValue();
}
origin: edu.ucar/netcdf

public double readAttributeDouble(Variable v, String attName, double defValue) {
 Attribute att;
 if (v == null)
  att = rootGroup.findAttributeIgnoreCase(attName);
 else
  att = v.findAttributeIgnoreCase(attName);
 if (att == null) return defValue;
 if (att.isString())
  return Double.parseDouble(att.getStringValue());
 else
  return att.getNumericValue().doubleValue();
}
origin: Unidata/thredds

@Test
public void testVlengthAttribute() throws IOException {
 try (NetcdfFile ncfile = TestH5.openH5("support/vlstra.h5")) {
  Attribute att = ncfile.findGlobalAttribute("test_scalar");
  assert (null != att);
  assert (!att.isArray());
  assert (att.isString());
  assert (att.getStringValue().equals("This is the string for the attribute"));
 }
}
origin: edu.ucar/cdm

private boolean computeIsInterval() {
 intervalWasComputed = true;
 Attribute boundsAtt = findAttributeIgnoreCase(CF.BOUNDS);
 if ((null == boundsAtt) || !boundsAtt.isString()) return false;
 String boundsVarName = boundsAtt.getStringValue();
 VariableDS boundsVar = (VariableDS) ncd.findVariable(getParentGroup(), boundsVarName);
 if (null == boundsVar) return false;
 if (3 != boundsVar.getRank()) return false;
 if (getDimension(0) != boundsVar.getDimension(0)) return false;
 return 2 == boundsVar.getDimension(2).getLength();
}
origin: Unidata/thredds

public void testReplaceAtt() {
 // System.out.println("\nncfile = "+ncfile);
 Attribute att = ncfile.findGlobalAttribute("title");
 assert null != att;
 assert !att.isArray();
 assert att.isString();
 assert att.getDataType() == DataType.STRING;
 assert att.getStringValue().equals("replaced");
 assert att.getNumericValue() == null;
 assert att.getNumericValue(3) == null;
}
origin: Unidata/thredds

private boolean computeIsInterval() {
 intervalWasComputed = true;
 Attribute boundsAtt = findAttributeIgnoreCase(CF.BOUNDS);
 if ((null == boundsAtt) || !boundsAtt.isString()) return false;
 String boundsVarName = boundsAtt.getStringValue();
 VariableDS boundsVar = (VariableDS) ncd.findVariable(getParentGroup(), boundsVarName);
 if (null == boundsVar) return false;
 if (3 != boundsVar.getRank()) return false;
 if (getDimension(0) != boundsVar.getDimension(0)) return false;
 if (getDimension(1) != boundsVar.getDimension(1)) return false;
 return 2 == boundsVar.getDimension(2).getLength();
}
ucar.nc2AttributeisString

Javadoc

True if value is of type String and not null.

Popular methods of Attribute

  • getStringValue
    Retrieve ith String value; only call if isString() is true.
  • getNumericValue
    Retrieve a numeric value by index. If its a String, it will try to parse it as a double.
  • <init>
    A copy constructor using a ucar.unidata.util.Parameter. Need to do this so ucar.unidata.geoloc packa
  • getDataType
    Get the data type of the Attribute value.
  • getShortName
  • getLength
    Get the length of the array of values
  • getValues
    Get the value as an Array.
  • isArray
    True if value is an array (getLength() > 1)
  • getFullName
  • getValue
    Get the value as an Object.
  • toString
    CDL representation, may be strict
  • getName
  • toString,
  • getName,
  • isUnsigned,
  • setShortName,
  • _getStringValue,
  • setStringValue,
  • setValues,
  • writeCDL,
  • hashCode

Popular in Java

  • Start an intent from android
  • getSharedPreferences (Context)
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • getApplicationContext (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now