How to use the hydrafloods.geeutils.extractBits function in hydrafloods

To help you get started, we’ve selected a few hydrafloods examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('state_1km'),10,10,'cloud_qa').neq(1)
        shadows = geeutils.extractBits(img.select('state_1km'),2,2,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('state_1km'),6,7,'aerosol_qa').neq(0)
        snows = geeutils.extractBits(img.select('state_1km'),15,15,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('QF1'),2,3,'cloud_qa').lte(2)
        shadows = geeutils.extractBits(img.select('QF2'),3,3,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('QF2'),4,4,'aerosol_qa').eq(0)
        snows = geeutils.extractBits(img.select('QF2'),5,5,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('QF1'),2,3,'cloud_qa').lte(2)
        shadows = geeutils.extractBits(img.select('QF2'),3,3,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('QF2'),4,4,'aerosol_qa').eq(0)
        snows = geeutils.extractBits(img.select('QF2'),5,5,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('QF1'),2,3,'cloud_qa').lte(2)
        shadows = geeutils.extractBits(img.select('QF2'),3,3,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('QF2'),4,4,'aerosol_qa').eq(0)
        snows = geeutils.extractBits(img.select('QF2'),5,5,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('QF1'),2,3,'cloud_qa').lte(2)
        shadows = geeutils.extractBits(img.select('QF2'),3,3,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('QF2'),4,4,'aerosol_qa').eq(0)
        snows = geeutils.extractBits(img.select('QF2'),5,5,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('state_1km'),10,10,'cloud_qa').neq(1)
        shadows = geeutils.extractBits(img.select('state_1km'),2,2,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('state_1km'),6,7,'aerosol_qa').neq(0)
        snows = geeutils.extractBits(img.select('state_1km'),15,15,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        qaCloud = geeutils.extractBits(img.select('pixel_qa'),5,5,'qa').neq(1)
        qaShadow = geeutils.extractBits(img.select('pixel_qa'),3,3,'qa').neq(1)
        mask = qaCloud.And(qaShadow)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time).uint16()
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('state_1km'),10,10,'cloud_qa').neq(1)
        shadows = geeutils.extractBits(img.select('state_1km'),2,2,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('state_1km'),6,7,'aerosol_qa').neq(0)
        snows = geeutils.extractBits(img.select('state_1km'),15,15,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)
github Servir-Mekong / hydra-floods / hydrafloods / processing.py View on Github external
def _qaMask(self,img):
        viewing = img.select('SensorZenith').abs().multiply(0.01).lt(45)
        clouds = geeutils.extractBits(img.select('state_1km'),10,10,'cloud_qa').neq(1)
        shadows = geeutils.extractBits(img.select('state_1km'),2,2,'shadow_qa').eq(0)
        aerosols = geeutils.extractBits(img.select('state_1km'),6,7,'aerosol_qa').neq(0)
        snows = geeutils.extractBits(img.select('state_1km'),15,15,'snow_qa').eq(0)
        mask = clouds.And(shadows).And(snows).And(viewing)
        t = ee.Date(img.get('system:time_start'))
        nDays = t.difference(INITIME,'day')
        time = ee.Image(nDays).int16().rename('time')
        return img.updateMask(mask).addBands(time)