/** * Adds a new band description to the product description. * * @param name the name of the band (without spectral extension) * @param isSpectral whether the badnd is a spectral band or not * @param scalingMethod the scaling method to be used for this band (lin, exp ..) * @param scaleName name of the attribute containing the scale factors * @param offsetName name of the attribute containing the scale offsets * @param unitName name off the attribute containing the physical unit * @param bandName name of the attribute containing the spectral extensions (band names) * @param descName name of the attribute containing a description of the band */ public void addBand(String name, String isSpectral, String scalingMethod, String scaleName, String offsetName, String unitName, String bandName, String descName) { addBand(new ModisBandDescription( name, isSpectral, scalingMethod, scaleName, offsetName, unitName, bandName, descName)); }
/** * Adds a new band description to the product description. * * @param name the name of the band (without spectral extension) * @param isSpectral whether the badnd is a spectral band or not * @param scalingMethod the scaling method to be used for this band (lin, exp ..) * @param scaleName name of the attribute containing the scale factors * @param offsetName name of the attribute containing the scale offsets * @param unitName name off the attribute containing the physical unit * @param bandName name of the attribute containing the spectral extensions (band names) * @param descName name of the attribute containing a description of the band * @param spectralWaveLength the spectral wavelength in nm (nanomater) units * @param spectralBandWidth the spectral bandwidth in nm (nanomater) units * @param spectralBandIndex the (zero-based) spectral band index */ public void addBand(final String name, final String isSpectral, final String scalingMethod, final String scaleName, final String offsetName, final String unitName, final String bandName, final String descName, final String spectralWaveLength, final String spectralBandWidth, final String spectralBandIndex) { final ModisBandDescription bandDesc = new ModisBandDescription( name, isSpectral, scalingMethod, scaleName, offsetName, unitName, bandName, descName); bandDesc.setSpecInfo(new ModisSpectralInfo( spectralWaveLength, spectralBandWidth, spectralBandIndex)); addBand(bandDesc); }
/** * Retrieves the names of the tie point grids for the given product type * * @param prodType * @return the names of the tie point grids */ public String[] getTiePointNames(final String prodType) { String[] tpNames = null; try { final ModisProductDescription prod = getProductDescription(prodType); tpNames = prod.getTiePointNames(); } catch (IOException e) { logger.severe("Unable to retrieve tie point names for product type '" + prodType + "'."); } return tpNames; }
static void setBandSpectralInformation(ModisBandDescription bandDesc, String bandNameExt, Band band) { if (bandDesc.isSpectral()) { if (bandDesc.hasSpectralInfo()) { final ModisSpectralInfo specInfo = bandDesc.getSpecInfo(); band.setSpectralWavelength(specInfo.getSpectralWavelength()); band.setSpectralBandwidth(specInfo.getSpectralBandwidth()); band.setSpectralBandIndex(specInfo.getSpectralBandIndex()); } else { final float[] data = ModisUtils.decodeSpectralInformation(bandNameExt, null); band.setSpectralWavelength(data[0]); band.setSpectralBandwidth(data[1]); band.setSpectralBandIndex((int) data[2]); } } else { band.setSpectralBandIndex(-1); } }
public void testSetSpectralBandInfo_fromSpecInfo() { final Band band = new Band("bla", ProductData.TYPE_FLOAT32, 3, 3); final ModisBandDescription description = new ModisBandDescription("", "true", "", "", "", "", "", ""); final ModisSpectralInfo spectralInfo = new ModisSpectralInfo("2", "3", "4"); description.setSpecInfo(spectralInfo); ModisFileReader.setBandSpectralInformation(description, "", band); assertEquals(4, band.getSpectralBandIndex()); assertEquals(2.f, band.getSpectralWavelength(), 1e-8); assertEquals(3.f, band.getSpectralBandwidth(), 1e-8); }
@Test public void testIsPow10Scale() { final ModisBandDescription pow10 = new ModisBandDescription("", "", ModisConstants.POW_10_SCALE_NAME, "", "", "", "", ""); assertTrue(pow10.isPow10Scaled()); final ModisBandDescription notPow10 = new ModisBandDescription("", "", "notPowTen", "", "", "", "", ""); assertFalse(notPow10.isPow10Scaled()); } }
/** * Retrieves the geolocation information for the given product type * * @param prodType * @return the geolocation information */ public String[] getGeolocationInformation(final String prodType) { String[] strRet = null; try { final ModisProductDescription prod = getProductDescription(prodType); strRet = prod.getGeolocationDatasetNames(); } catch (IOException e) { logger.severe("Unable to retrieve geolocation information for product type '" + prodType + "'."); } return strRet; }
/** * Retrieves the names of the bands for the given product type. * * @param prodType the product type string * @return the names of the bands. */ public String[] getBandNames(final String prodType) { String[] bandNames = null; try { final ModisProductDescription prod = getProductDescription(prodType); bandNames = prod.getBandNames(); } catch (IOException e) { logger.severe("Unable to retrieve the band names for product of type '" + prodType + "'."); } return bandNames; }
/** * Retrieves whether the product must be flipped top down or not * * @param prodType * @return <code>true</code> if the product must be flipped top down, otherwise <code>false</code>. */ public boolean mustFlip(final String prodType) { boolean bRet = false; try { final ModisProductDescription prod = getProductDescription(prodType); bRet = prod.mustFlipTopDown(); } catch (IOException e) { logger.severe("Unable to retrieve flipping information for product type '" + prodType + "'."); } return bRet; }
/** * Retrieves the band description for the given product type and band name * * @param prodType * @param bandName * @return the band description */ public ModisBandDescription getBandDescription(final String prodType, final String bandName) { ModisBandDescription bandDesc = null; try { final ModisProductDescription prod = getProductDescription(prodType); bandDesc = prod.getBandDescription(bandName); } catch (IOException e) { logger.severe( "Unable to retrieve information for band '" + bandName + "' of product type '" + prodType + "'."); } return bandDesc; }
/** * Retrieves the tie point description for the given product type and tie point grid name * * @param prodType the product type * @param tpName the name of the tie point grid * @return the tie point description */ public ModisTiePointDescription getTiePointDescription(final String prodType, final String tpName) { ModisTiePointDescription tpDesc = null; try { final ModisProductDescription prod = getProductDescription(prodType); tpDesc = prod.getTiePointDescription(tpName); } catch (IOException e) { logger.severe( "Unable to retrieve description for tie point grid '" + tpName + "' of product type '" + prodType + "'."); } return tpDesc; }
public void testShittyEsaNotFollowingTheConventionsNameHandling() throws ProductIOException { final String[] supportetProductTypes = ModisProductDb.getInstance().getSupportetProductTypes(); for (int i = 0; i < supportetProductTypes.length; i++) { final String type = supportetProductTypes[i]; final String toTest = type + "_anySuffix"; if (isImapp(toTest)) { // this does not work for IMAPP types - intentionally! tb 2008-06-17 continue; } assertEquals("Index = " + i, ModisDaacUtils.extractProductType(toTest), type); } }
/** * Retrieves the names of the scientific datasets of the product * * @return the names of the scientific datasets. */ public String[] getBandNames() { String[] strRet = new String[_bandVec.size()]; for (int n = 0; n < _bandVec.size(); n++) { strRet[n] = ((ModisBandDescription) _bandVec.get(n)).getName(); } return strRet; }
/** * Retrieves the names of the tie point grids of the product. * * @return the names of the tie point grids. */ public String[] getTiePointNames() { String[] strRet = new String[_tiePointVec.size()]; for (int n = 0; n < _tiePointVec.size(); n++) { strRet[n] = ((ModisTiePointDescription) _tiePointVec.get(n)).getName(); } return strRet; }
private static String getQcFileType(Product product, ModisProductDescription desc) { final String replaceWith = product.getProductType().substring(1, 2); final String pattern = desc.getExternalGeolocationPattern(); return pattern.replaceFirst("[xX]", replaceWith); }
/** * Sets the geolocation dataset names. * * @param lat the name of the dataset providing the latitude values, must not be null * @param lon the name of the dataset providing the longitude values, must not be null */ public void setGeolocationDatasetNames(String lat, String lon) { Guardian.assertNotNullOrEmpty("lat", lat); Guardian.assertNotNullOrEmpty("lon", lon); setGeolocationDatasetNames(new String[]{lat, lon}); }
@Before public void setUp() { prod = new ModisProductDescription(); }
/** * Checks whether the given product type is suported by the reader - or not. * * @param typeString the product type * @return <code>true</code> if the given product type is suported, otherwise <code>false</code>. */ public boolean isSupportedProduct(final String typeString) throws ProductIOException { ensureSupportedProductTypes(); return _productTypes.get(typeString) != null; }
private static ArrayList<String> extractProductTypeBySeparatorChar(String s, ModisProductDb db, String delim) throws ProductIOException { final ArrayList<String> prodType = new ArrayList<String>(); final StringTokenizer tokenizer = new StringTokenizer(s, delim); while (tokenizer.hasMoreTokens()) { final String token = tokenizer.nextToken(); if (db.isSupportedProduct(token)) { prodType.add(token); } } return prodType; } }
/** * ensure that the list of supported product types is loaded */ private void ensureSupportedProductTypes() throws ProductIOException { if (_productTypes == null) { try { loadProductTypes(); } catch (IOException e) { throw new ProductIOException(e.getMessage()); } } }