当前位置: 首页>>代码示例>>Java>>正文


Java BitSetter类代码示例

本文整理汇总了Java中org.esa.snap.core.util.BitSetter的典型用法代码示例。如果您正苦于以下问题:Java BitSetter类的具体用法?Java BitSetter怎么用?Java BitSetter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BitSetter类属于org.esa.snap.core.util包,在下文中一共展示了BitSetter类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIdepixFlagCoding

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
public static FlagCoding createIdepixFlagCoding(String flagIdentifier) {
    FlagCoding flagCoding = new FlagCoding(flagIdentifier);
    flagCoding.addFlag("IDEPIX_INVALID", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_INVALID), IDEPIX_INVALID_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLOUD", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLOUD), IDEPIX_CLOUD_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLOUD_AMBIGUOUS", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLOUD_AMBIGUOUS), IDEPIX_CLOUD_AMBIGUOUS_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLOUD_SURE", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLOUD_SURE), IDEPIX_CLOUD_SURE_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLOUD_BUFFER", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLOUD_BUFFER), IDEPIX_CLOUD_BUFFER_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLOUD_SHADOW", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLOUD_SHADOW), IDEPIX_CLOUD_SHADOW_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_SNOW_ICE", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_SNOW_ICE), IDEPIX_SNOW_ICE_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_BRIGHT", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_BRIGHT), IDEPIX_BRIGHT_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_WHITE", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_WHITE), IDEPIX_WHITE_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_COASTLINE", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_COASTLINE), IDEPIX_COASTLINE_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_LAND", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_LAND), IDEPIX_LAND_DESCR_TEXT);

    flagCoding.addFlag("IDEPIX_CIRRUS_SURE", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CIRRUS_SURE), IDEPIX_CIRRUS_SURE_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CIRRUS_AMBIGUOUS", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CIRRUS_AMBIGUOUS), IDEPIX_CIRRUS_AMBIGUOUS_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLEAR_LAND", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLEAR_LAND), IDEPIX_CLEAR_LAND_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_CLEAR_WATER", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_CLEAR_WATER), IDEPIX_CLEAR_WATER_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_WATER", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_WATER), IDEPIX_WATER_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_BRIGHTWHITE", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_BRIGHTWHITE), IDEPIX_BRIGHTWHITE_DESCR_TEXT);
    flagCoding.addFlag("IDEPIX_VEG_RISK", BitSetter.setFlag(0, S2IdepixConstants.IDEPIX_VEG_RISK), IDEPIX_VEG_RISK_DESCR_TEXT);

    return flagCoding;
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:25,代码来源:S2IdepixUtils.java

示例2: initialize

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
@Override
public void initialize() throws OperatorException {
    String pname = aotProduct.getName();
    String ptype = aotProduct.getProductType();
    rasterWidth = aotProduct.getSceneRasterWidth();
    rasterHeight = aotProduct.getSceneRasterHeight();
    targetProduct = new Product(pname, ptype, rasterWidth, rasterHeight);
    FlagCoding aotFlagCoding = new FlagCoding(AotConsts.aotFlags.name);
    aotFlagCoding.addFlag("aot_climatology", BitSetter.setFlag(0, F_CLIM), "aot from climatology only");
    aotFlagCoding.addFlag("aot_interp", BitSetter.setFlag(0, F_INTERP), "aot spatially interpolated");
    targetProduct.getFlagCodingGroup().add(aotFlagCoding);
    AerosolUtils.createFlagMasks(targetProduct);
    Band targetBand = AerosolUtils.createTargetBand(AotConsts.aotFlags, rasterWidth, rasterHeight);
    targetBand.setSampleCoding(aotFlagCoding);
    targetProduct.addBand(targetBand);

    ProductUtils.copyBand(AotConsts.aot.name, aotProduct, targetProduct, false);
    ProductUtils.copyBand(AotConsts.aotErr.name, aotProduct, targetProduct, false);
    setTargetProduct(targetProduct);
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:21,代码来源:S2AerosolGapFillingOp.java

示例3: createScapeMFlagCoding

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
private FlagCoding createScapeMFlagCoding(String flagIdentifier) {
    FlagCoding flagCoding = new FlagCoding(flagIdentifier);
    flagCoding.addFlag("F_INVALID", BitSetter.setFlag(0, 0), null);
    flagCoding.addFlag("F_CLOUD_CERTAIN", BitSetter.setFlag(0, 1), null);
    flagCoding.addFlag("F_CLOUD_PRESUMABLY", BitSetter.setFlag(0, 2), null);
    if (calculateLakes) {
        flagCoding.addFlag("F_OCEAN", BitSetter.setFlag(0, 3), null);
        flagCoding.addFlag("F_LAKES", BitSetter.setFlag(0, 4), null);
    }
    return flagCoding;
}
 
开发者ID:senbox-org,项目名称:s3tbx-scape-m,代码行数:12,代码来源:FubScapeMClassificationOp.java

示例4: createScapeMLakesFlagCoding

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
private FlagCoding createScapeMLakesFlagCoding(String flagIdentifier) {
    FlagCoding flagCoding = new FlagCoding(flagIdentifier);
    flagCoding.addFlag("COASTLINE_BUFFER", BitSetter.setFlag(0, 0), null);
    flagCoding.addFlag("OCEAN", BitSetter.setFlag(0, 1), null);
    if (calculateLakes) {
        flagCoding.addFlag("LAKES", BitSetter.setFlag(0, 2), null);
    }
    return flagCoding;
}
 
开发者ID:senbox-org,项目名称:s3tbx-scape-m,代码行数:10,代码来源:FubScapeMLakesOp.java

示例5: computeTile

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
@Override
public void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm) throws OperatorException {
    final Rectangle rectangle = targetTile.getRectangle();

    Raster coastRegionData = coastRegionImage.getData(rectangle);
    Tile waterFractionTile = getSourceTile(landWaterMaskProduct.getRasterDataNode(LAND_WATER_FRACTION), rectangle);
    for (Tile.Pos pos : targetTile) {
        final boolean isAlongCoastline = coastRegionData.getSample(pos.x, pos.y, 0) == 1;
        final boolean isOcean;
        boolean isLake = false;
        if (calculateLakes) {
            int regionID = lakeRegionMatrix[pos.x][pos.y];
            if (regionID != 0) {
                for (Region region : regions) {
                    if (region.isResponsibleRegionFor(regionID)) {
                        isLake = !region.isOfMinimalSize();
                        break;
                    }
                }
            }
            isOcean = regionID != 0 && !isLake && !isAlongCoastline;
        } else {
            isOcean = waterFractionTile.getSampleFloat(pos.x, pos.y) > 50 && !isAlongCoastline;
        }

        int waterRegionFlag = 0;
        waterRegionFlag = BitSetter.setFlag(waterRegionFlag, 0, isAlongCoastline);
        waterRegionFlag = BitSetter.setFlag(waterRegionFlag, 1, isOcean);
        if (calculateLakes) {
            waterRegionFlag = BitSetter.setFlag(waterRegionFlag, 2, isLake);
        }
        targetTile.setSample(pos.x, pos.y, waterRegionFlag);
    }
}
 
开发者ID:senbox-org,项目名称:s3tbx-scape-m,代码行数:35,代码来源:FubScapeMLakesOp.java

示例6: isValid

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
@Override
public boolean isValid(int x, int y) {
    int sampleInt = tile.getSampleInt(x, y);
    boolean isInvalid = BitSetter.isFlagSet(sampleInt, ScapeMConstants.CLOUD_INVALID_BIT);
    boolean isCloud = BitSetter.isFlagSet(sampleInt, ScapeMConstants.CLOUD_CERTAIN_BIT);
    boolean isOcean = BitSetter.isFlagSet(sampleInt, ScapeMConstants.CLOUD_OCEAN_BIT);
    return !isCloud && !isInvalid && !isOcean;
}
 
开发者ID:senbox-org,项目名称:s3tbx-scape-m,代码行数:9,代码来源:ClearLandPixelStrategy.java

示例7: isValid

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
@Override
public boolean isValid(int x, int y) {
    int sampleInt = tile.getSampleInt(x, y);
    boolean isInvalid = BitSetter.isFlagSet(sampleInt, ScapeMConstants.CLOUD_INVALID_BIT);
    boolean isCloud = BitSetter.isFlagSet(sampleInt, ScapeMConstants.CLOUD_CERTAIN_BIT);
    return !isCloud && !isInvalid;
}
 
开发者ID:senbox-org,项目名称:s3tbx-scape-m,代码行数:8,代码来源:ClearLandAndWaterPixelStrategy.java

示例8: fillPixel

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
private int fillPixel(int x, int y, Tile aotTile, Tile aotErrTile, double climAot, double noDataValue, float[] fillResult) {
    double n0 = invDistanceWeight(CLIM_DIST, 0, 4);
    double n = n0;
    double sum = climAot * n;
    double sumErr = CLIM_ERR * n;
    float val;
    double weight;
    int ys = (y - OFF < 0) ? 0 : y - OFF;
    int xs = (x - OFF < 0) ? 0 : x - OFF;
    int ye = (y + OFF >= rasterHeight) ? rasterHeight - 1 : y + OFF;
    int xe = (x + OFF >= rasterWidth) ? rasterWidth - 1 : x + OFF;
    for (int j = ys; j <= ye; j++) {
        for (int i = xs; i <= xe; i++) {
            val = aotTile.getSampleFloat(i, j);
            if (Double.compare(noDataValue, val) != 0) {
                weight = invDistanceWeight(i - x, j - y, 4);
                sum += val * weight;
                n += weight;
                sumErr += aotErrTile.getSampleFloat(i, j) * weight;
            }
        }
    }
    int flag = 0;
    if (n > n0) {
        fillResult[0] = (float) (sum / n);
        fillResult[1] = (float) (sumErr / n);
        flag = BitSetter.setFlag(flag, F_INTERP);
    } else {
        if (n > 0) {
            fillResult[0] = (float) (sum / n);
            fillResult[1] = (float) (sumErr / n);
        } else {
            fillResult[0] = (float) noDataValue;
            fillResult[1] = (float) noDataValue;
        }
        flag = BitSetter.setFlag(flag, F_CLIM);
    }
    return flag;
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:40,代码来源:S2AerosolGapFillingOp.java

示例9: computeTile

import org.esa.snap.core.util.BitSetter; //导入依赖的package包/类
@Override
public void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm) throws OperatorException {
    Rectangle rectangle = targetTile.getRectangle();

    Tile[] reflectanceTiles = new Tile[num_of_visible_bands + 2];
    for (int i = 1; i <= num_of_visible_bands + 1; i++) {
        final Band reflBand = rad2reflProduct.getBand(REFLECTANCE_BAND_PREFIX + i);
        reflectanceTiles[i - 1] = getSourceTile(reflBand, rectangle);
    }

    final Band refl13Band = rad2reflProduct.getBand(REFLECTANCE_BAND_PREFIX + 13);
    final TiePointGrid altitudeGrid = sourceProduct.getTiePointGrid(EnvisatConstants.MERIS_DEM_ALTITUDE_DS_NAME);
    final Band l1FlagsBand = sourceProduct.getBand(EnvisatConstants.MERIS_L1B_FLAGS_DS_NAME);
    final Tile l1FlagsTile = getSourceTile(l1FlagsBand, rectangle);
    final TiePointGrid sunZenithGrid = sourceProduct.getTiePointGrid(EnvisatConstants.MERIS_SUN_ZENITH_DS_NAME);
    final Tile sunZenithTile = getSourceTile(sunZenithGrid, rectangle);
    final Tile altitudeTile = getSourceTile(altitudeGrid, rectangle);

    reflectanceTiles[num_of_visible_bands + 1] = getSourceTile(refl13Band, rectangle);
    Tile waterTile = null;
    if (calculateLakes) {
        waterTile = getSourceTile(waterProduct.getRasterDataNode("water_flags"), rectangle);
    }

    for (Tile.Pos pos : targetTile) {
        float pAvTOA = 0;
        for (int i = 0; i < num_of_visible_bands; i++) {
            pAvTOA += reflectanceTiles[i].getSampleFloat(pos.x, pos.y);
        }
        pAvTOA /= num_of_visible_bands;
        float p1TOA = reflectanceTiles[0].getSampleFloat(pos.x, pos.y);
        float p8TOA = reflectanceTiles[7].getSampleFloat(pos.x, pos.y);
        float p9TOA = reflectanceTiles[8].getSampleFloat(pos.x, pos.y);
        float p13TOA = reflectanceTiles[9].getSampleFloat(pos.x, pos.y);
        final float altitude = altitudeTile.getSampleFloat(pos.x, pos.y);
        final float sunZenith = sunZenithTile.getSampleFloat(pos.x, pos.y);
        final double musil = Math.cos(sunZenith * MathUtils.DTOR);

        boolean isInvalid = l1FlagsTile.getSampleBit(pos.x, pos.y, Constants.L1_F_INVALID);
        boolean certainlyCloud = pAvTOA > 0.3 || altitude > 2500 || (p1TOA > 0.23 && p1TOA > p9TOA) || musil < 0;
        boolean presumablyCloud = pAvTOA > 0.27 || altitude > 2500 || (p1TOA > 0.2 && p1TOA > p8TOA) || musil < 0;

        int cloudFlag = 0;
        cloudFlag = BitSetter.setFlag(cloudFlag, 0, isInvalid);
        cloudFlag = BitSetter.setFlag(cloudFlag, 1, certainlyCloud);
        cloudFlag = BitSetter.setFlag(cloudFlag, 2, presumablyCloud);

        boolean isOcean = false;
        boolean isLakeOrCoastline = false;
        if (calculateLakes) {
            isOcean = waterTile.getSampleBit(pos.x, pos.y, 1);
            isLakeOrCoastline = (waterTile.getSampleBit(pos.x, pos.y, 0) ||
                    waterTile.getSampleBit(pos.x, pos.y, 2)) && p13TOA < reflectance_water_threshold;
        }
        cloudFlag = BitSetter.setFlag(cloudFlag, 3, isOcean && !isInvalid);
        cloudFlag = BitSetter.setFlag(cloudFlag, 4, isLakeOrCoastline && !isInvalid);

        targetTile.setSample(pos.x, pos.y, cloudFlag);
    }
}
 
开发者ID:senbox-org,项目名称:s3tbx-scape-m,代码行数:61,代码来源:FubScapeMClassificationOp.java


注:本文中的org.esa.snap.core.util.BitSetter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。