ModisBandReader { public static int decodeScalingMethod(final String scaleMethod) { if (scaleMethod != null) { if (scaleMethod.equalsIgnoreCase(ModisConstants.LINEAR_SCALE_NAME)) { return SCALE_LINEAR; } else if (scaleMethod.equalsIgnoreCase(ModisConstants.EXPONENTIAL_SCALE_NAME)) { return SCALE_EXPONENTIAL; } else if (scaleMethod.equalsIgnoreCase(ModisConstants.POW_10_SCALE_NAME)) { return SCALE_POW_10; } else if (scaleMethod.equalsIgnoreCase(ModisConstants.SLOPE_INTERCEPT_SCALE_NAME)) { return SCALE_SLOPE_INTERCEPT; } } return SCALE_UNKNOWN; } ModisBandReader(Variable variable, final int layer, final boolean is3d); void setName(final String name); String getName(); static int decodeScalingMethod(final String scaleMethod); void setScaleAndOffset(final float scale, final float offset); void setValidRange(Range validRange); void setFillValue(double fillValue); abstract int getDataType(); void readBandData(int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight,
                             int sourceStepX, int sourceStepY, ProductData destBuffer, ProgressMonitor pm); static final int SCALE_UNKNOWN; static final int SCALE_LINEAR; static final int SCALE_EXPONENTIAL; static final int SCALE_POW_10; static final int SCALE_SLOPE_INTERCEPT; }
@Test public void testDecodeScalingMethod() { assertEquals(ModisBandReader.SCALE_UNKNOWN, ModisBandReader.decodeScalingMethod(null)); assertEquals(ModisBandReader.SCALE_UNKNOWN, ModisBandReader.decodeScalingMethod("")); assertEquals(ModisBandReader.SCALE_LINEAR, ModisBandReader.decodeScalingMethod(ModisConstants.LINEAR_SCALE_NAME)); assertEquals(ModisBandReader.SCALE_EXPONENTIAL, ModisBandReader.decodeScalingMethod(ModisConstants.EXPONENTIAL_SCALE_NAME)); assertEquals(ModisBandReader.SCALE_POW_10, ModisBandReader.decodeScalingMethod(ModisConstants.POW_10_SCALE_NAME)); assertEquals(ModisBandReader.SCALE_SLOPE_INTERCEPT, ModisBandReader.decodeScalingMethod(ModisConstants.SLOPE_INTERCEPT_SCALE_NAME)); }