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


Python ee.ImageCollection方法代码示例

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


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

示例1: addDate

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def addDate(image):
    # parse date stored in 'system:index'
    date = ee.Date(image.get('system:index'))

    # format date, see http:#www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html
    str = date.format('YYYY-mm-dd')

    return image.set({'Date': str})


# point = ee.Geometry.Point(-122.262, 37.8719)
# start = ee.Date('2014-06-01')
# finish = ee.Date('2014-10-01')

# filteredCollection = ee.ImageCollection('LANDSAT/LC08/C01/T1') \
#     .filterBounds(point) \
#     .filterDate(start, finish) \
#     .sort('CLOUD_COVER', True) 
开发者ID:giswqs,项目名称:qgis-earthengine-examples,代码行数:20,代码来源:set_image_properties.py

示例2: testMapping

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def testMapping(self):
    """Verifies the behavior of the map() method."""
    collection = ee.ImageCollection('foo')
    algorithm = lambda img: img.select('bar')
    mapped = collection.map(algorithm)

    self.assertTrue(isinstance(mapped, ee.ImageCollection))
    self.assertEquals(ee.ApiFunction.lookup('Collection.map'), mapped.func)
    self.assertEquals(collection, mapped.args['collection'])

    # Need to do a serialized comparison for the function body because
    # variables returned from CustomFunction.variable() do not implement
    # __eq__.
    sig = {
        'returns': 'Image',
        'args': [{'name': '_MAPPING_VAR_0_0', 'type': 'Image'}]
    }
    expected_function = ee.CustomFunction(sig, algorithm)
    self.assertEquals(expected_function.serialize(),
                      mapped.args['baseAlgorithm'].serialize()) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:22,代码来源:collection_test.py

示例3: testIteration

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def testIteration(self):
    """Verifies the behavior of the iterate() method."""
    collection = ee.ImageCollection('foo')
    first = ee.Image(0)
    algorithm = lambda img, prev: img.addBands(ee.Image(prev))
    result = collection.iterate(algorithm, first)

    self.assertEquals(ee.ApiFunction.lookup('Collection.iterate'), result.func)
    self.assertEquals(collection, result.args['collection'])
    self.assertEquals(first, result.args['first'])

    # Need to do a serialized comparison for the function body because
    # variables returned from CustomFunction.variable() do not implement
    # __eq__.
    sig = {
        'returns': 'Object',
        'args': [
            {'name': '_MAPPING_VAR_0_0', 'type': 'Image'},
            {'name': '_MAPPING_VAR_0_1', 'type': 'Object'}
        ]
    }
    expected_function = ee.CustomFunction(sig, algorithm)
    self.assertEquals(expected_function.serialize(),
                      result.args['function'].serialize()) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:26,代码来源:collection_test.py

示例4: simon

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def simon(path):
    images = ee.List(  
        [ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160305T171543_20160305T171608_010237_00F1FA_49DC')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160329T171543_20160329T171608_010587_00FBF9_B4DE')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160410T171538_20160410T171603_010762_010122_CEF6')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160422T171539_20160422T171604_010937_010677_03F6')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160504T171539_20160504T171604_011112_010BED_80AF')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160516T171540_20160516T171605_011287_011198_FC21')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160528T171603_20160528T171628_011462_011752_F570')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160609T171604_20160609T171629_011637_011CD1_C2F5')), 
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160715T171605_20160715T171630_012162_012DA2_95A1')), 
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160727T171606_20160727T171631_012337_013359_29A6')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160808T171607_20160808T171632_012512_01392E_44C4')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160901T171608_20160901T171633_012862_0144E3_30E5')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20160925T171609_20160925T171634_013212_015050_8FDB')),
         ee.call("S1.dB",ee.Image(path+'S1B_IW_GRDH_1SDV_20161001T171508_20161001T171533_002316_003E9D_D195')), 
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20161007T171609_20161007T171634_013387_0155CD_F513')), 
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20161019T171609_20161019T171634_013562_015B60_27FF')),
         ee.call("S1.dB",ee.Image(path+'S1A_IW_GRDH_1SDV_20161031T171609_20161031T171634_013737_0160BD_4FAE')) ] )
    return ee.ImageCollection(images) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:22,代码来源:app_sav.py

示例5: simonf

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def simonf(path):
    
    def sel(image):
        return ee.Image(image).select(['VV','VH'])
        
    images = ee.List(  
       [ee.Image(path+'S1A_IW_GRDH_1SDV_20160305T171543_20160305T171608_010237_00F1FA_49DC'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160329T171543_20160329T171608_010587_00FBF9_B4DE'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160410T171538_20160410T171603_010762_010122_CEF6'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160422T171539_20160422T171604_010937_010677_03F6'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160504T171539_20160504T171604_011112_010BED_80AF'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160516T171540_20160516T171605_011287_011198_FC21'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160528T171603_20160528T171628_011462_011752_F570'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160609T171604_20160609T171629_011637_011CD1_C2F5'), 
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160715T171605_20160715T171630_012162_012DA2_95A1'), 
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160727T171606_20160727T171631_012337_013359_29A6'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160808T171607_20160808T171632_012512_01392E_44C4'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160901T171608_20160901T171633_012862_0144E3_30E5'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20160925T171609_20160925T171634_013212_015050_8FDB'),
        ee.Image(path+'S1B_IW_GRDH_1SDV_20161001T171508_20161001T171533_002316_003E9D_D195'), 
        ee.Image(path+'S1A_IW_GRDH_1SDV_20161007T171609_20161007T171634_013387_0155CD_F513'), 
        ee.Image(path+'S1A_IW_GRDH_1SDV_20161019T171609_20161019T171634_013562_015B60_27FF'),
        ee.Image(path+'S1A_IW_GRDH_1SDV_20161031T171609_20161031T171634_013737_0160BD_4FAE') ] )
    
    return ee.ImageCollection(images.map(sel)) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:27,代码来源:app_sav.py

示例6: add_cloudscore7

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def add_cloudscore7(image):
   """ Add cloud score for Landsat 7 """
   thedate = image.date()
   date_bef = thedate.advance(-1, 'day')
   date_aft = thedate.advance(1,'day')
   toa = ee.ImageCollection('LANDSAT/LE07/C01/T1_TOA'
           ).filterDate(date_bef, date_aft
           ).filter(ee.Filter.eq('WRS_PATH', path)
           ).filter(ee.Filter.eq('WRS_ROW', row)
           ).first()
   cs = ee.Algorithms.If(
          ee.Image(toa),
          ee.Image(ee.Algorithms.Landsat.simpleCloudScore(
          ee.Image(toa))).select('cloud'),
          ee.Image(0).rename(['cloud']))
   mask = ee.Image(cs).lt(ee.Image(cloud_score))
   if aoi:
     return image.updateMask(mask).select(['B1','B2', 'B3','B4','B5','B7']).clip(aoi)
   else:
     return image.updateMask(mask).select(['B1','B2', 'B3','B4','B5','B7']) 
开发者ID:bullocke,项目名称:coded,代码行数:22,代码来源:cdd_simple.py

示例7: add_cloudscore8

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def add_cloudscore8(image):
   """ Add cloud score for Landsat 8 """
   thedate = image.date()
   date_bef = thedate.advance(-1, 'day')
   date_aft = thedate.advance(1,'day')
   toa = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA'
           ).filterDate(date_bef, date_aft
           ).filter(ee.Filter.eq('WRS_PATH', path)
           ).filter(ee.Filter.eq('WRS_ROW', row)
           ).first()
   cs = ee.Algorithms.If(
          ee.Image(toa),
          ee.Image(ee.Algorithms.Landsat.simpleCloudScore(
          ee.Image(toa))).select('cloud'), 
          ee.Image(0).rename(['cloud']))
   mask = ee.Image(cs).lt(ee.Image(cloud_score))
   if aoi:
     return image.updateMask(mask).select(['B1','B2', 'B3','B4','B5','B7']).clip(aoi)
   else:
     return image.updateMask(mask).select(['B1','B2', 'B3','B4','B5','B7'])


#  MAIN WORK 

# JAVASCRIPT GLOBALS 
开发者ID:bullocke,项目名称:coded,代码行数:27,代码来源:cdd_simple.py

示例8: make_proxy

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def make_proxy(self, image, collection, year):
        """ Make a proxy collection """

        size = collection.size()

        # unmask all bands
        unmasked = image.unmask()

        proxy_date = ee.Date('{}-01-01'.format(year))

        bands = image.bandNames()
        empty = tools.image.empty(0, bands)
        proxy = unmasked.where(unmasked, empty)

        proxy = proxy.set('system:time_start', proxy_date.millis())

        proxy_col = ee.ImageCollection.fromImages([proxy])

        return ee.ImageCollection(ee.Algorithms.If(size.gt(0),
                                                   collection,
                                                   proxy_col)) 
开发者ID:fitoprincipe,项目名称:geebap,代码行数:23,代码来源:bap.py

示例9: GetImageInfoTimeSeries

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def GetImageInfoTimeSeries(aoi):
    def GetImageInfo(img):
        return ee.Feature(None, {
            'id': img.get('system:id'),
            'time': img.get('system:time_start'),
            'cloud_cover': img.get('CLOUD_COVER')
        })

    def ToFeatureCollection(imageCollectionName):
        return ee.FeatureCollection(ee.ImageCollection(imageCollectionName).filterBounds(aoi).map(GetImageInfo))

    collectionNames = [
        'LANDSAT/LT4_L1T_TOA',
        'LANDSAT/LT5_L1T_TOA',
        'LANDSAT/LE7_L1T_TOA',
        'LANDSAT/LC8_L1T_TOA'
    ]

    fc = ee.FeatureCollection([])
    for n in collectionNames:
        fc = fc.merge(ToFeatureCollection(n))

    info = fc.sort('time').getInfo()

    return [i['properties'] for i in info['features']] 
开发者ID:Deltares,项目名称:aqua-monitor,代码行数:27,代码来源:server.py

示例10: get_image_collection_landsat

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def get_image_collection_landsat(bounds, start_date, end_date, collectionName='LT5_L1T'):
    '''Retrieve Landsat imagery for the selected location and dates.'''

    ee_bounds  = bounds
    ee_points  = ee.List(bounds.bounds().coordinates().get(0))
    points     = ee_points.getInfo()
    points     = map(functools.partial(apply, ee.Geometry.Point), points)
#    collection = ee.ImageCollection(collectionName).filterDate(start_date, end_date) \
#                                    .filterBounds(points[0]).filterBounds(points[1]) \
#                                    .filterBounds(points[2]).filterBounds(points[3])
    collection = ee.ImageCollection(collectionName).filterDate(start_date, end_date) \
                                    .filterBounds(bounds.centroid())
                                    
    # Select and rename the bands we want
    temp = cmt.util.landsat_functions.rename_landsat_bands(collection, collectionName)
    return temp.sort('system:time_start') 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:18,代码来源:imageRetrievalFunctions.py

示例11: assetsize

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def assetsize(asset):
    ee.Initialize()
    header = ee.data.getAsset(asset)["type"]
    if header == "IMAGE_COLLECTION":
        collc = ee.ImageCollection(asset)
        size = collc.aggregate_array("system:asset_size")
        return [str(humansize(sum(size.getInfo()))), collc.size().getInfo()]
    elif header == "IMAGE":
        collc = ee.Image(asset)
        return [str(humansize(collc.get("system:asset_size").getInfo())), 1]
    elif header == "TABLE":
        collc = ee.FeatureCollection(asset)
        return [str(humansize(collc.get("system:asset_size").getInfo())), 1]
    elif header == "FOLDER":
        num = subprocess.check_output(
            "earthengine --no-use_cloud_api ls " + asset, shell=True
        ).decode("ascii")
        return ["NA", len(num.split("\n")) - 1]


# folder parse 
开发者ID:samapriya,项目名称:gee_asset_manager_addon,代码行数:23,代码来源:ee_report.py

示例12: sumDistance

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def sumDistance(image, collection, bands=None, discard_zeros=False,
                name='sumdist'):
    """ Compute de sum of all distances between the given image and the
    collection passed
    
    :param image: 
    :param collection:
    :return: 
    """
    condition = isinstance(collection, ee.ImageCollection)

    if condition:
        collection = collection.toList(collection.size())

    accum = ee.Image(0).rename(name)

    def over_rest(im, ini):
        ini = ee.Image(ini)
        im = ee.Image(im)
        dist = ee.Image(euclideanDistance(image, im, bands, discard_zeros))\
                 .rename(name)
        return ini.add(dist)

    return ee.Image(collection.iterate(over_rest, accum)) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:26,代码来源:algorithms.py

示例13: medoid

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def medoid(collection, bands=None, discard_zeros=False):
    """ Medoid Composite

    :param collection: the collection to composite
    :type collection: ee.ImageCollection
    :param bands: the bands to use for computation. The composite will include
        all bands
    :type bands: list
    :param discard_zeros: Masked and pixels with value zero will not be use
        for computation. Improves dark zones.
    :type discard_zeros: bool
    :return: the Medoid Composite
    :rtype: ee.Image
    """
    medcol = medoidScore(collection, bands, discard_zeros)
    comp = medcol.qualityMosaic('sumdist')
    final = tools.image.removeBands(comp, ['sumdist', 'mask'])
    return final 
开发者ID:gee-community,项目名称:gee_tools,代码行数:20,代码来源:composite.py

示例14: fillWithLast

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def fillWithLast(collection):
    """ Fill masked values of each image pixel with the last available
    value

    :param collection: the collection that holds the images that will be filled
    :type collection: ee.ImageCollection
    :rtype: ee.ImageCollection
    """
    collector = ee.List([])
    def overcol(i, collect):
        collect = ee.List(collect)
        def true():
            last = ee.Image(collect.get(-1))
            mask = i.mask().Not()
            return collect.add(ee.Image(i.unmask().where(mask, last)))
        def false():
            return collect.add(i)

        return ee.List(ee.Algorithms.If(collect.size(), true(), false()))

    return ee.ImageCollection.fromImages(collection.iterate(overcol, collector)) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:23,代码来源:imagecollection.py

示例15: check_imageCollection

# 需要导入模块: import ee [as 别名]
# 或者: from ee import ImageCollection [as 别名]
def check_imageCollection(imageCollection):
        if not isinstance(imageCollection, ee.ImageCollection):
            msg = 'first parameter of Image.doySeries must be an ' \
                  'ImageCollection, found {}'
            raise ValueError(msg.format(type(imageCollection))) 
开发者ID:fitoprincipe,项目名称:ipygee,代码行数:7,代码来源:chart.py


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