Java Code Examples for ucar.nc2.constants.FeatureType#SIMPLE_GEOMETRY

The following examples show how to use ucar.nc2.constants.FeatureType#SIMPLE_GEOMETRY . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleGeometryCSBuilder.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public SimpleGeometryCS makeCoordSys() {
  if (type == null)
    return null;

  if (type == FeatureType.SIMPLE_GEOMETRY) {
    return new SimpleGeometryCS(this);
  }
  return null;
}
 
Example 2
Source File: FeatureDatasetFactoryManager.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Determine if factory type matches wanted feature type.
 *
 * @param want want this FeatureType
 * @param facType factory is of this type
 * @return true if match
 */
public static boolean featureTypeOk(FeatureType want, FeatureType facType) {
  if (want == null)
    return true;
  if (want == facType)
    return true;

  if (want == FeatureType.ANY_POINT) {
    return facType.isPointFeatureType();
  }

  if (facType == FeatureType.ANY_POINT) {
    return want.isPointFeatureType();
  }

  if (want == FeatureType.COVERAGE) {
    return facType.isCoverageFeatureType();
  }

  if (want == FeatureType.GRID) { // for backwards compatibility
    return facType.isCoverageFeatureType();
  }

  if (want == FeatureType.SIMPLE_GEOMETRY) {
    return facType.isCoverageFeatureType();
  }

  if (want == FeatureType.UGRID) {
    return facType.isUnstructuredGridFeatureType();
  }

  return false;
}
 
Example 3
Source File: SimpleGeometryFeatureDataset.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FeatureType getFeatureType() {
  return FeatureType.SIMPLE_GEOMETRY;
}
 
Example 4
Source File: SimpleGeometryCSBuilder.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public SimpleGeometryCSBuilder(NetcdfDataset ds, CoordinateSystem cs, Formatter errlog) {

    // must be at least 2 dimensions
    if (cs.getRankDomain() < 2) {
      if (errlog != null)
        errlog.format("CoordinateSystem '%s': domain rank < 2%n", cs.getName());
      return;
    }

    sgAxes = new ArrayList<>();
    geometrySeriesVarNames = new ArrayList<>();
    geometryContainerNames = new ArrayList<>();
    geometryContainersAssoc = new HashMap<>();
    dims = ds.getDimensions();
    allAxes = cs.getCoordinateAxes();

    // Look through the variables and build a list of geometry variables, also build up map of simple geometry
    // containers
    for (Variable var : ds.getVariables()) {
      if (!var.findAttributeString(CF.GEOMETRY, "").equals("")) {

        geometrySeriesVarNames.add(var.getFullNameEscaped());
        String varName = var.findAttributeString(CF.GEOMETRY, "");

        // Using the Geometry Container name, add this variable as a reference to that container

        // Check if container exists
        if (ds.findVariable(varName) != null) {

          // Add container name to container name list, if not present already
          if (!geometryContainerNames.contains(varName))
            geometryContainerNames.add(varName);

          // If the list is null, instantiate it
          if (geometryContainersAssoc.get(varName) == null) {
            List<String> strList = new ArrayList<>();
            geometryContainersAssoc.put(varName, strList);
          }

          // Then add this variable as a reference.
          geometryContainersAssoc.get(var.findAttributeString(CF.GEOMETRY, "")).add(var.getFullNameEscaped());
        }
      }
    }

    // Create Simple Geometry Reader if there are any Axes with type SimpleGeometryID
    // Also, populate simple geometry axis list
    boolean sgtype = false;
    for (CoordinateAxis axis : cs.getCoordinateAxes()) {
      if (axis.getAxisType() == AxisType.SimpleGeometryID || axis.getAxisType() == AxisType.SimpleGeometryX
          || axis.getAxisType() == AxisType.SimpleGeometryY || axis.getAxisType() == AxisType.SimpleGeometryZ) {
        sgAxes.add(axis);
        sgtype = true;
      }
    }

    if (sgtype) {
      geometryReader = new SimpleGeometryReader(ds);
      this.type = FeatureType.SIMPLE_GEOMETRY;
    } else
      geometryReader = null;

    this.type = classify();
    this.coordTransforms = new ArrayList<>(cs.getCoordinateTransforms());
    this.orgProj = cs.getProjection();
  }
 
Example 5
Source File: SimpleGeometryStandardFactory.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FeatureType[] getFeatureTypes() {
  return new FeatureType[] {FeatureType.SIMPLE_GEOMETRY};
}
 
Example 6
Source File: SimpleGeometryCSBuilder.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 3 votes vote down vote up
private FeatureType classify() {

    // now to classify

    if (geometryReader != null) {
      return FeatureType.SIMPLE_GEOMETRY;
    }

    return null;
  }