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


Java BitSetter.setFlag方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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.setFlag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。