/** * return true if val equals a missing_value (low level) */ public boolean isMissingValue(double val) { if (!hasMissingValue) return false; for (int i = 0; i < missingValue.length; i++) if (ucar.nc2.util.Misc.closeEnough(val, missingValue[i])) return true; return false; }
public boolean equals(Object oo) { if (this == oo) return true; if ( !(oo instanceof LevelCoord)) return false; LevelCoord other = (LevelCoord) oo; return (ucar.nc2.util.Misc.closeEnough(value1, other.value1) && ucar.nc2.util.Misc.closeEnough(value2, other.value2)); }
public boolean equals(Object oo) { if (this == oo) return true; if (!(oo instanceof LevelCoord)) return false; LevelCoord other = (LevelCoord) oo; return (ucar.nc2.util.Misc.closeEnough(value1, other.value1) && ucar.nc2.util.Misc.closeEnough(value2, other.value2)); }
/** * return true if val equals a missing_value (low level) */ public boolean isMissingValue(double val) { if (!hasMissingValue) return false; for (double aMissingValue : missingValue) if (Misc.closeEnough(val, aMissingValue)) return true; return false; }
private int findIndex(int runIdx, double want) { for (int j = 0; j < noffsets; j++) if (Misc.closeEnough(timeOffset[runIdx * noffsets + j], want)) return j; return -1; }
private int findIndex(int runIdx, double want) { for (int j = 0; j < noffsets; j++) if (Misc.closeEnough(timeOffset[runIdx * noffsets + j], want)) return j; return -1; }
public boolean equals2(Object oo) { if (this == oo) return true; if (!(oo instanceof LevelCoord)) return false; LevelCoord other = (LevelCoord) oo; return (ucar.nc2.util.Misc.closeEnough(value1, other.value1) && ucar.nc2.util.Misc.closeEnough(value2, other.value2)); }
public int findInterval(double b1, double b2) { for (int i = 0; i < getNCoords(); i++) if (Misc.closeEnough(bound1[i], b1) && Misc.closeEnough(bound2[i], b2)) return i; return -1; }
public int findInterval(double b1, double b2) { for (int i = 0; i < getNCoords(); i++) if (Misc.closeEnough(bound1[i], b1) && Misc.closeEnough(bound2[i], b2)) return i; return -1; }
public int findIndex(double offsetHour) { double[] off = getOffsetTimes(); for (int i = 0; i < off.length; i++) if (Misc.closeEnough(off[i], offsetHour)) return i; return -1; }
public int findIndex(double offsetHour) { double[] off = getOffsetTimes(); for (int i = 0; i < off.length; i++) if (Misc.closeEnough(off[i], offsetHour)) return i; return -1; }
RunTimeDatasetInventory(CalendarDate run) throws FileNotFoundException { double offset = FmrcInv.getOffsetInHours(base, run); for (int i = 0; i < runOffset.length; i++) { if (Misc.closeEnough(runOffset[i], offset)) { runIdx = i; break; } } if (runIdx < 0) throw new FileNotFoundException("No run date of " + run); }
private List<TimeInv> makeConstantForecast(double offset) { List<TimeInv> result = new ArrayList<TimeInv>(noffsets); for (int run = 0; run < nruns; run++) { for (int time = 0; time < noffsets; time++) { // search for all offsets that match - presumably 0 or 1 per run double baseOffset = timeOffset[run * noffsets + time]; if (Double.isNaN(baseOffset)) continue; if (Misc.closeEnough(baseOffset, offset)) result.add(new TimeInv(run, time, offset - timeOffset[run * noffsets])); // use offset from start of run } } timeCoordMap.put("forecast" + offset, result); return result; }
RunTimeDatasetInventory(CalendarDate run) throws FileNotFoundException { double offset = FmrcInv.getOffsetInHours(base, run); for (int i = 0; i < runOffset.length; i++) { if (Misc.closeEnough(runOffset[i], offset)) { runIdx = i; break; } } if (runIdx < 0) throw new FileNotFoundException("No run date of " + run); }
ConstantOffsetDataset(double offset) throws FileNotFoundException { this.offset = offset; boolean ok = false; double[] offsets = getForecastOffsets(); for (int i=0; i<offsets.length; i++) if (Misc.closeEnough(offsets[i], offset)) ok = true; if (!ok) throw new FileNotFoundException("No constant offset dataset for = " + offset); }
ConstantOffsetDataset(double offset) throws FileNotFoundException { this.offset = offset; boolean ok = false; double[] offsets = getForecastOffsets(); for (int i=0; i<offsets.length; i++) if (Misc.closeEnough(offsets[i], offset)) ok = true; if (!ok) throw new FileNotFoundException("No constant offset dataset for = " + offset); }
/** * Returns true if this represents the same point as pt, using Misc.closeEnough. * * @param pt2 point to check against * @return true if this represents the same point as pt2. */ public boolean closeEnough(ProjectionPoint pt2) { return Misc.closeEnough(getX(), pt2.getX()) && Misc.closeEnough(getY(), pt2.getY()); }
/** * Returns true if this represents the same point as pt, using Misc.closeEnough. * * @param pt2 point to check against * @return true if this represents the same point as pt2. */ public boolean closeEnough(ProjectionPoint pt2) { return Misc.closeEnough(getX(), pt2.getX()) && Misc.closeEnough(getY(), pt2.getY()); }
public static void main(String arg[]) { UtmProjection utm = new UtmProjection(17, true); LatLonPointImpl ll = utm.projToLatLon(577.8000000000001, 2951.8); System.out.printf("%15.12f %15.12f%n", ll.getLatitude(), ll.getLongitude()); assert Misc.closeEnough(ll.getLongitude(), -80.21802662821469, 1.0e-8); assert Misc.closeEnough(ll.getLatitude(), 26.685132668190793, 1.0e-8); }
public static void main(String arg[]) { UtmProjection utm = new UtmProjection(17, true); LatLonPoint ll = utm.projToLatLon(577.8000000000001, 2951.8); System.out.printf("%15.12f %15.12f%n", ll.getLatitude(), ll.getLongitude()); assert Misc.closeEnough(ll.getLongitude(), -80.21802662821469, 1.0e-8); assert Misc.closeEnough(ll.getLatitude(), 26.685132668190793, 1.0e-8); }