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

How to use
getStringValue
method
in
ucar.nc2.Attribute

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

  • 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: geotools/geotools

/**
 * Extract the {@link CoordinateReferenceSystem} from a NetCDF attribute (if present)
 * containing a WKT String
 *
 * @param wktAttribute the NetCDF {@link Attribute} if any, containing WKT definition.
 * @return
 */
private static CoordinateReferenceSystem parseWKT(Attribute wktAttribute) {
  CoordinateReferenceSystem crs = null;
  if (wktAttribute != null) {
    String wkt = wktAttribute.getStringValue();
    try {
      crs = CRS.parseWKT(wkt);
    } catch (FactoryException e) {
      if (LOGGER.isLoggable(Level.WARNING)) {
        LOGGER.warning("Unable to setup a CRS from the specified WKT: " + wkt);
      }
    }
  }
  return crs;
}
origin: geotools/geotools

if (coordinatesAttribute != null) {
  coordinates = coordinatesAttribute.getStringValue();
} else if (!(var instanceof CoordinateAxis)) {
origin: geotools/geotools

private static Variable getAuxiliaryCoordinate(
    NetcdfDataset dataset, Group group, Variable var, String dimName) {
  Variable coordinateVariable = null;
  Attribute attribute = var.findAttribute(NetCDFUtilities.COORDINATES);
  if (attribute != null) {
    String coordinates = attribute.getStringValue();
    String[] coords = coordinates.split(" ");
    for (String coord : coords) {
      Variable coordVar = dataset.findVariable(group, coord);
      List<Dimension> varDimensions = coordVar.getDimensions();
      if (varDimensions != null
          && varDimensions.size() == 1
          && varDimensions.get(0).getFullName().equalsIgnoreCase(dimName)) {
        coordinateVariable = coordVar;
        break;
      }
    }
  }
  return coordinateVariable;
}
origin: geotools/geotools

private String getCoordinatesForVariable(String shortName) {
  Variable var = dataset.findVariable(null, shortName);
  if (var != null) {
    // Getting the coordinates attribute
    Attribute attribute = var.findAttribute(NetCDFUtilities.COORDINATES);
    if (attribute != null) {
      return attribute.getStringValue();
    } else {
      return var.getDimensionsString();
    }
  }
  return null;
}
origin: geotools/geotools

  /** Look for a Coordinate Reference System */
  private CoordinateReferenceSystem lookForCrs(
      CoordinateReferenceSystem crs, Attribute gridMappingAttribute, Variable var)
      throws FactoryException {
    if (gridMappingAttribute != null) {
      String gridMappingName = gridMappingAttribute.getStringValue();
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("The variable refers to gridMapping: " + gridMappingName);
      }
      Variable mapping = dataset.findVariable(null, gridMappingName);
      if (mapping != null) {
        CoordinateReferenceSystem localCrs = NetCDFProjection.parseProjection(mapping);
        if (localCrs != null) {
          // lookup for a custom EPSG if any
          crs = NetCDFProjection.lookupForCustomEpsg(localCrs);
        }
      } else if (LOGGER.isLoggable(Level.WARNING)) {
        LOGGER.warning(
            "The specified variable "
                + var.getFullName()
                + " declares a gridMapping = "
                + gridMappingName
                + " but that mapping doesn't exist.");
      }
    }
    return crs;
  }
}
origin: geotools/geotools

  @Override
  public CoordinateReferenceSystem parseCoordinateReferenceSystem(Variable var)
      throws FactoryException {
    String mappingName = attribute.getStringValue();
    String projectionName = getProjectionName(mappingName, var);
    // Getting the proper projection and set the projection parameters
    NetCDFProjection projection = supportedProjections.get(projectionName);
    if (projection == null) {
      if (LOGGER.isLoggable(Level.FINE)) {
        LOGGER.fine("Unsupported grid_mapping_name: " + projectionName);
      }
      return null;
    }
    String ogcName = projection.getOGCName();
    // The OGC projection parameters
    ParameterValueGroup netcdfParameters =
        ProjectionBuilder.getDefaultparameters(ogcName);
    // Get the OGC to NetCDF projection parameters
    Map<String, String> paramsMapping = projection.getParameters();
    Set<String> keys = paramsMapping.keySet();
    for (String ogcParameterKey : keys) {
      handleParam(paramsMapping, netcdfParameters, ogcParameterKey, var);
    }
    return ProjectionBuilder.buildCRS(
        Collections.singletonMap(NetCDFUtilities.NAME, projectionName),
        projection.getOgcParameters(netcdfParameters),
        buildEllipsoid(var, SI.METRE));
  }
}
origin: geotools/geotools

final Attribute attribute = coordinateAxis.findAttribute("time_origin");
if (attribute != null) {
  origin = attribute.getStringValue();
origin: geotools/geotools

final Attribute attribute = timeAxis.findAttribute("time_origin");
if (attribute != null) {
  origin = attribute.getStringValue();
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/netcdf

public String getRadarID() {
 Attribute ga = ds.findGlobalAttribute("Station");
 if(ga != null)
   return ga.getStringValue();
 else
   return "XXXX";
}
origin: edu.ucar/netcdf

 public boolean match(CoordinateAxis axis) {
  Attribute stdName = axis.findAttribute(CF.STANDARD_NAME);
  return ((stdName == null) || !CF.STATION_ALTITUDE.equals(stdName.getStringValue()));
 }
});
origin: edu.ucar/cdm

/**
 * Is this Variable unsigned?. Only meaningful for byte, short, int, long types.
 * Looks for attribute "_Unsigned", case insensitive
 *
 * @return true if Variable is unsigned
 */
public boolean isUnsigned() {
 Attribute att = findAttributeIgnoreCase(CDM.UNSIGNED);
 return (att != null) && att.getStringValue().equalsIgnoreCase("true");
}
origin: edu.ucar/cdm

public String getRadarName() {
 Attribute ga = ds.findGlobalAttribute("StationName");
 if(ga != null)
   return ga.getStringValue();
 else
   return "Unknown Station";
}
origin: apache/tika

Property property = resolveMetadataKey(attr.getFullName());
if (attr.getDataType().isString()) {
  metadata.add(property, attr.getStringValue());
} else if (attr.getDataType().isNumeric()) {
  int value = attr.getNumericValue().intValue();
origin: edu.ucar/netcdf

private void writeStringValues(Attribute att) throws IOException {
 int n = att.getLength();
 if (n == 1)
  writeString(att.getStringValue());
 else {
  StringBuilder values = new StringBuilder();
  for (int i = 0; i < n; i++)
   values.append(att.getStringValue(i));
  writeString(values.toString());
 }
}
origin: edu.ucar/cdm

public String getDescription() {
 Attribute att = ncvar.findAttributeIgnoreCase(CDM.LONG_NAME);
 return (att == null) ? getName() : att.getStringValue();
}
public DataType getValueType() { return valueType; }
origin: apache/tika

Property property = resolveMetadataKey(attr.getFullName());
if (attr.getDataType().isString()) {
  metadata.add(property, attr.getStringValue());
} else if (attr.getDataType().isNumeric()) {
  int value = attr.getNumericValue().intValue();
origin: edu.ucar/netcdf

public void augmentDataset(NetcdfDataset ds, CancelTask cancelTask) throws IOException {
 Attribute levelAtt = ds.findAttribute("/HDFEOS/ADDITIONAL/FILE_ATTRIBUTES/@ProcessLevel");
 if (levelAtt == null)  return;
 int level = levelAtt.getStringValue().startsWith("2") ? 2 : 3;
 Attribute time = ds.findAttribute("/HDFEOS/ADDITIONAL/FILE_ATTRIBUTES/@TAI93At0zOfGranule");
 if (level == 3) augmentDataset3(ds);
}
origin: edu.ucar/netcdf

private void addAttributeInfo(NetcdfDataset result, String attName, String info) {
 Attribute att = result.findGlobalAttribute(attName);
 if (att == null)
  result.addAttribute(null, new Attribute(attName, info));
 else {
  String oldValue = att.getStringValue();
  result.addAttribute(null, new Attribute(attName, oldValue +" ;\n"+ info));
 }
}
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();
}
ucar.nc2AttributegetStringValue

Javadoc

Retrieve String value; only call if isString() is true.

Popular methods of Attribute

  • 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.
  • isString
    True if value is of type String and not null.
  • 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