Java Code Examples for ucar.nc2.constants.CF#POSITIVE_DOWN

The following examples show how to use ucar.nc2.constants.CF#POSITIVE_DOWN . 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: CF1Convention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Guess the value of ZisPositive based on z axis name and units
 *
 * @param zaxisName z coordinate axis name
 * @param vertCoordUnits z coordinate axis name
 * @return CF.POSITIVE_UP or CF.POSITIVE_DOWN
 */
public static String getZisPositive(String zaxisName, String vertCoordUnits) {
  if (vertCoordUnits == null) {
    return CF.POSITIVE_UP;
  }
  if (vertCoordUnits.isEmpty()) {
    return CF.POSITIVE_UP;
  }

  if (SimpleUnit.isCompatible("millibar", vertCoordUnits)) {
    return CF.POSITIVE_DOWN;
  }

  if (SimpleUnit.isCompatible("m", vertCoordUnits)) {
    return CF.POSITIVE_UP;
  }

  // dunno - make it up
  return CF.POSITIVE_UP;
}
 
Example 2
Source File: CF1Convention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Guess the value of ZisPositive based on z axis name and units
 *
 * @param zaxisName z coordinate axis name
 * @param vertCoordUnits z coordinate axis name
 * @return CF.POSITIVE_UP or CF.POSITIVE_DOWN
 */
public static String getZisPositive(String zaxisName, String vertCoordUnits) {
  if (vertCoordUnits == null) {
    return CF.POSITIVE_UP;
  }
  if (vertCoordUnits.isEmpty()) {
    return CF.POSITIVE_UP;
  }

  if (SimpleUnit.isCompatible("millibar", vertCoordUnits)) {
    return CF.POSITIVE_DOWN;
  }

  if (SimpleUnit.isCompatible("m", vertCoordUnits)) {
    return CF.POSITIVE_UP;
  }

  // dunno - make it up
  return CF.POSITIVE_UP;
}
 
Example 3
Source File: ThreddsMetadata.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public GeospatialCoverage(LatLonRect bb, CoordinateAxis1D vaxis, double dX, double dY) {
  if (bb == null) {
    this.eastwest = null;
    this.northsouth = null;
    this.isGlobal = false;
    this.names = null;

  } else {
    LatLonPoint llpt = bb.getLowerLeftPoint();
    LatLonPoint urpt = bb.getUpperRightPoint();
    double height = urpt.getLatitude() - llpt.getLatitude();

    this.eastwest = new GeospatialRange(llpt.getLongitude(), bb.getWidth(), dX, CDM.LON_UNITS);
    this.northsouth = new GeospatialRange(llpt.getLatitude(), height, dY, CDM.LAT_UNITS);

    if ((bb.getWidth() >= (360 - dX)) && (height >= (180 - dY))) {
      this.isGlobal = true;
      // serialize isGlobal
      this.names = new ArrayList<>();
      this.names.add(new Vocab("global", null));
    } else {
      this.isGlobal = false;
      this.names = null;
    }
  }

  if (vaxis == null) {
    this.updown = null;
    this.zpositive = null;

  } else {
    int n = (int) vaxis.getSize();
    double size = vaxis.getCoordValue(n - 1) - vaxis.getCoordValue(0);
    double resolution = vaxis.getIncrement();
    String units = vaxis.getUnitsString();
    this.updown = new GeospatialRange(vaxis.getCoordValue(0), size, resolution, units);
    if (units != null) {
      boolean isPositive = SimpleUnit.isCompatible("m", units);
      this.zpositive = isPositive ? CF.POSITIVE_UP : CF.POSITIVE_DOWN;
    } else {
      this.zpositive = CF.POSITIVE_UP;
    }
  }

}