private static RasterDataNode[] getReferencedNodes(final RasterDataNode node) { final Product product = node.getProduct(); if (product != null) { final List<String> expressions = new ArrayList<String>(10); if (node.getValidPixelExpression() != null) { expressions.add(node.getValidPixelExpression()); } final ProductNodeGroup<Mask> overlayMaskGroup = node.getOverlayMaskGroup(); if (overlayMaskGroup.getNodeCount() > 0) { final Mask[] overlayMasks = overlayMaskGroup.toArray(new Mask[overlayMaskGroup.getNodeCount()]); for (final Mask overlayMask : overlayMasks) { final String expression; if (overlayMask.getImageType() == Mask.BandMathsType.INSTANCE) { expression = Mask.BandMathsType.getExpression(overlayMask); } else if (overlayMask.getImageType() == Mask.RangeType.INSTANCE) { expression = Mask.RangeType.getExpression(overlayMask); } else { expression = null; } if (expression != null) { expressions.add(expression); } } } if (node instanceof VirtualBand) { final VirtualBand virtualBand = (VirtualBand) node; expressions.add(virtualBand.getExpression()); } final ArrayList<Term> termList = new ArrayList<Term>(10); for (final String expression : expressions) { try { final Term term = product.parseExpression(expression); if (term != null) { termList.add(term); } } catch (ParseException e) { // @todo se handle parse exception Debug.trace(e); } } final Term[] terms = termList.toArray(new Term[termList.size()]); final RasterDataSymbol[] refRasterDataSymbols = BandArithmetic.getRefRasterDataSymbols(terms); return BandArithmetic.getRefRasters(refRasterDataSymbols); } return new RasterDataNode[0]; }
@Override protected void addFlagsAndMasks(Product product) { Band QFBand = product.getBand("l3m_qual"); if (QFBand != null) { FlagCoding flagCoding = new FlagCoding("SST_Quality"); flagCoding.addFlag("Best", 0x00, "Highest quality retrieval"); flagCoding.addFlag("Good", 0x01, "Good quality retrieval"); flagCoding.addFlag("Questionable", 0x02, "Questionable quality retrieval"); flagCoding.addFlag("Bad", 0x03, "Bad quality retrieval"); product.getFlagCodingGroup().add(flagCoding); QFBand.setSampleCoding(flagCoding); product .getMaskGroup() .add( Mask.BandMathsType.create( "Best", "Highest quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l3m_qual == 0", SeadasFileReader.Cornflower, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Good", "Good quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l3m_qual == 1", SeadasFileReader.LightPurple, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Questionable", "Questionable quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l3m_qual == 2", SeadasFileReader.BurntUmber, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Bad", "Bad quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l3m_qual == 3", SeadasFileReader.FailRed, 0.6)); } QFBand = product.getBand("qual_sst"); if (QFBand != null) { FlagCoding flagCoding = new FlagCoding("SST_Quality"); flagCoding.addFlag("Best", 0x00, "Highest quality retrieval"); flagCoding.addFlag("Good", 0x01, "Good quality retrieval"); flagCoding.addFlag("Questionable", 0x02, "Questionable quality retrieval"); flagCoding.addFlag("Bad", 0x03, "Bad quality retrieval"); product.getFlagCodingGroup().add(flagCoding); QFBand.setSampleCoding(flagCoding); product .getMaskGroup() .add( Mask.BandMathsType.create( "Best", "Highest quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 0", SeadasFileReader.Cornflower, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Good", "Good quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 1", SeadasFileReader.LightPurple, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Questionable", "Questionable quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 2", SeadasFileReader.BurntUmber, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Bad", "Bad quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 3", SeadasFileReader.FailRed, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "No Data", "No data retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == -1", SeadasFileReader.MediumGray, 0.6)); } QFBand = product.getBand("qual_sst4"); if (QFBand != null) { FlagCoding flagCoding = new FlagCoding("SST_Quality"); flagCoding.addFlag("Best", 0x00, "Highest quality retrieval"); flagCoding.addFlag("Good", 0x01, "Good quality retrieval"); flagCoding.addFlag("Questionable", 0x02, "Questionable quality retrieval"); flagCoding.addFlag("Bad", 0x03, "Bad quality retrieval"); product.getFlagCodingGroup().add(flagCoding); QFBand.setSampleCoding(flagCoding); product .getMaskGroup() .add( Mask.BandMathsType.create( "Best", "Highest quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 0", SeadasFileReader.Cornflower, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Good", "Good quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 1", SeadasFileReader.LightPurple, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Questionable", "Questionable quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 2", SeadasFileReader.BurntUmber, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Bad", "Bad quality retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 3", SeadasFileReader.FailRed, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "No Data", "No data retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == -1", SeadasFileReader.MediumGray, 0.6)); } }
protected void addFlagsAndMasks(Product product) { Band QFBand = product.getBand("l2_flags"); if (QFBand != null) { FlagCoding flagCoding = new FlagCoding("L2Flags"); flagCoding.addFlag("ATMFAIL", 0x01, "Atmospheric correction failure"); flagCoding.addFlag("LAND", 0x02, "Land"); flagCoding.addFlag("PRODWARN", 0x04, "One (or more) product algorithms generated a warning"); flagCoding.addFlag("HIGLINT", 0x08, "High glint determined"); flagCoding.addFlag("HILT", 0x10, "High (or saturating) TOA radiance"); flagCoding.addFlag("HISATZEN", 0x20, "Large satellite zenith angle"); flagCoding.addFlag("COASTZ", 0x40, "Shallow water (<30m)"); flagCoding.addFlag("SPARE8", 0x80, "Unused"); flagCoding.addFlag("STRAYLIGHT", 0x100, "Straylight determined"); flagCoding.addFlag("CLDICE", 0x200, "Cloud/Ice determined"); flagCoding.addFlag("COCCOLITH", 0x400, "Coccolithophores detected"); flagCoding.addFlag("TURBIDW", 0x800, "Turbid water determined"); flagCoding.addFlag("HISOLZEN", 0x1000, "High solar zenith angle"); flagCoding.addFlag("SPARE14", 0x2000, "Unused"); flagCoding.addFlag("LOWLW", 0x4000, "Low Lw @ 555nm (possible cloud shadow)"); flagCoding.addFlag("CHLFAIL", 0x8000, "Chlorophyll algorithm failure"); flagCoding.addFlag("NAVWARN", 0x10000, "Navigation suspect"); flagCoding.addFlag("ABSAER", 0x20000, "Absorbing Aerosols determined"); flagCoding.addFlag("SPARE19", 0x40000, "Unused"); flagCoding.addFlag("MAXAERITER", 0x80000, "Maximum iterations reached for NIR iteration"); flagCoding.addFlag("MODGLINT", 0x100000, "Moderate glint determined"); flagCoding.addFlag("CHLWARN", 0x200000, "Chlorophyll out-of-bounds (<0.01 or >100 mg m^-3)"); flagCoding.addFlag( "ATMWARN", 0x400000, "Atmospheric correction warning; Epsilon out-of-bounds"); flagCoding.addFlag("SPARE24", 0x800000, "Unused"); flagCoding.addFlag("SEAICE", 0x1000000, "Sea ice determined"); flagCoding.addFlag("NAVFAIL", 0x2000000, "Navigation failure"); flagCoding.addFlag("FILTER", 0x4000000, "Insufficient data for smoothing filter"); flagCoding.addFlag("SSTWARN", 0x8000000, "Sea surface temperature suspect"); flagCoding.addFlag("SSTFAIL", 0x10000000, "Sea surface temperature algorithm failure"); flagCoding.addFlag("HIPOL", 0x20000000, "High degree of polariztion determined"); flagCoding.addFlag( "PRODFAIL", 0x40000000, "One (or more) product algorithms produced a failure"); flagCoding.addFlag("SPARE32", 0x80000000, "Unused"); product.getFlagCodingGroup().add(flagCoding); QFBand.setSampleCoding(flagCoding); product .getMaskGroup() .add( Mask.BandMathsType.create( "ATMFAIL", "Atmospheric correction failure", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.ATMFAIL", FailRed, 0.0)); product .getMaskGroup() .add( Mask.BandMathsType.create( "LAND", "Land", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.LAND", LandBrown, 0.0)); product .getMaskGroup() .add( Mask.BandMathsType.create( "PRODWARN", "One (or more) product algorithms generated a warning", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.PRODWARN", DeepBlue, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "HILT", "High (or saturating) TOA radiance", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.HILT", Color.GRAY, 0.2)); product .getMaskGroup() .add( Mask.BandMathsType.create( "HIGLINT", "High glint determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.HIGLINT", BrightPink, 0.2)); product .getMaskGroup() .add( Mask.BandMathsType.create( "HISATZEN", "Large satellite zenith angle", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.HISATZEN", LightCyan, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "COASTZ", "Shallow water (<30m)", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.COASTZ", BurntUmber, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "STRAYLIGHT", "Straylight determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.STRAYLIGHT", Color.YELLOW, 0.2)); product .getMaskGroup() .add( Mask.BandMathsType.create( "CLDICE", "Cloud/Ice determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.CLDICE", Color.WHITE, 0.0)); product .getMaskGroup() .add( Mask.BandMathsType.create( "COCCOLITH", "Coccolithophores detected", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.COCCOLITH", Color.CYAN, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "TURBIDW", "Turbid water determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.TURBIDW", LightBrown, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "HISOLZEN", "High solar zenith angle", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.HISOLZEN", Purple, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "LOWLW", "Low Lw @ 555nm (possible cloud shadow)", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.LOWLW", Cornflower, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "CHLFAIL", "Chlorophyll algorithm failure", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.CHLFAIL", FailRed, 0.0)); product .getMaskGroup() .add( Mask.BandMathsType.create( "NAVWARN", "Navigation suspect", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.NAVWARN", Color.MAGENTA, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "ABSAER", "Absorbing Aerosols determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.ABSAER", Color.ORANGE, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "MAXAERITER", "Maximum iterations reached for NIR correction", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.MAXAERITER", MediumGray, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "MODGLINT", "Moderate glint determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.MODGLINT", LightPurple, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "CHLWARN", "Chlorophyll out-of-bounds (<0.01 or >100 mg m^-3)", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.CHLWARN", Color.LIGHT_GRAY, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "ATMWARN", "Atmospheric correction warning; Epsilon out-of-bounds", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.ATMWARN", Color.MAGENTA, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "SEAICE", "Sea ice determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.SEAICE", Color.DARK_GRAY, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "NAVFAIL", "Navigation failure", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.NAVFAIL", FailRed, 0.0)); product .getMaskGroup() .add( Mask.BandMathsType.create( "FILTER", "Insufficient data for smoothing filter", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.FILTER", Color.LIGHT_GRAY, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "SSTWARN", "Sea surface temperature suspect", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.SSTWARN", Color.MAGENTA, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "SSTFAIL", "Sea surface temperature algorithm failure", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.SSTFAIL", FailRed, 0.1)); product .getMaskGroup() .add( Mask.BandMathsType.create( "HIPOL", "High degree of polariztion determined", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.HIPOL", Color.PINK, 0.5)); product .getMaskGroup() .add( Mask.BandMathsType.create( "PRODFAIL", "One (or more) product algorithms produced a failure", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "l2_flags.PRODFAIL", FailRed, 0.1)); } Band QFBandSST = product.getBand("qual_sst"); if (QFBandSST != null) { // FlagCoding flagCoding = new FlagCoding("SSTFlags"); // product.getFlagCodingGroup().add(flagCoding); // // QFBandSST.setSampleCoding(flagCoding); product .getMaskGroup() .add( Mask.BandMathsType.create( "Best", "Highest quality SST retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 0", SeadasFileReader.Cornflower, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Good", "Good quality SST retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 1", SeadasFileReader.LightPurple, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Questionable", "Questionable quality SST retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 2", SeadasFileReader.BurntUmber, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Bad", "Bad quality SST retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 3", SeadasFileReader.FailRed, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "No SST Retrieval", "No SST retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst == 4", SeadasFileReader.FailRed, 0.6)); } Band QFBandSST4 = product.getBand("qual_sst4"); if (QFBandSST4 != null) { // FlagCoding flagCoding = new FlagCoding("SST4Flags"); // product.getFlagCodingGroup().add(flagCoding); // QFBandSST4.setSampleCoding(flagCoding); product .getMaskGroup() .add( Mask.BandMathsType.create( "Best", "Highest quality SST4 retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 0", SeadasFileReader.Cornflower, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Good", "Good quality SST4 retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 1", SeadasFileReader.LightPurple, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Questionable", "Questionable quality SST4 retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 2", SeadasFileReader.BurntUmber, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "Bad", "Bad quality SST4 retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 3", SeadasFileReader.FailRed, 0.6)); product .getMaskGroup() .add( Mask.BandMathsType.create( "No SST Retrieval", "No SST retrieval", product.getSceneRasterWidth(), product.getSceneRasterHeight(), "qual_sst4 == 4", SeadasFileReader.FailRed, 0.6)); } }