public ScaledMultiLevelImage( RasterDataNode rdn, ScaledVariable scaledVariable, ProfileReadContext ctx) { super(rdn); this.variable = scaledVariable.getVariable(); this.scaleFactor = scaledVariable.getScaleFactor(); this.imageOrigin = new int[0]; this.ctx = ctx; }
@Override public void decode(ProfileReadContext ctx, Product p) throws IOException { RasterDigest rasterDigest = ctx.getRasterDigest(); final Variable[] variables = rasterDigest.getRasterVariables(); for (Variable variable : variables) { final int rasterDataType = DataTypeUtils.getRasterDataType(variable); final Band band = p.addBand(variable.getShortName(), rasterDataType); CfBandPart.readCfBandAttributes(variable, band); band.setSourceImage(new NetcdfMultiLevelImage(band, variable, ctx)); } ScaledVariable[] scaledVariables = rasterDigest.getScaledVariables(); for (ScaledVariable scaledVariable : scaledVariables) { Variable variable = scaledVariable.getVariable(); final int rasterDataType = DataTypeUtils.getRasterDataType(variable); final Band band = p.addBand(variable.getShortName(), rasterDataType); CfBandPart.readCfBandAttributes(variable, band); band.setSourceImage(new ScaledMultiLevelImage(band, scaledVariable, ctx)); } }