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


Python ee.List方法代码示例

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


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

示例1: iterate

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def iterate(image1,image2,niter,first):
#   simulated iteration of MAD for debugging          
#   result = iterate(image1,image2,niter,first)   
    for i in range(1,niter+1):
        result = ee.Dictionary(imad(i,first))
        allrhos = ee.List(result.get('allrhos'))
        chi2 = ee.Image(result.get('chi2'))
        MAD = ee.Image(result.get('MAD'))
        first = ee.Dictionary({'image':image1.addBands(image2),
                               'allrhos':allrhos,
                               'chi2':chi2,
                               'MAD':MAD})
    return result


#------------------
# helper functions
#------------------ 
开发者ID:mortcanty,项目名称:earthengine,代码行数:20,代码来源:app.py

示例2: testMapping

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def testMapping(self):
    lst = ee.List(['foo', 'bar'])
    body = lambda s: ee.String(s).cat('bar')
    mapped = lst.map(body)

    self.assertTrue(isinstance(mapped, ee.List))
    self.assertEquals(ee.ApiFunction.lookup('List.map'), mapped.func)
    self.assertEquals(lst, mapped.args['list'])

    # 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': 'Object'}]
    }
    expected_function = ee.CustomFunction(sig, body)
    self.assertEquals(expected_function.serialize(),
                      mapped.args['baseAlgorithm'].serialize()) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:21,代码来源:list_test.py

示例3: omnibus

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def omnibus(imList,significance=0.0001,median=False):
    '''return change maps for sequential omnibus change algorithm'''    
    imList = ee.List(imList).map(multbyenl)    
    p = ee.Image(imList.get(0)).bandNames().length()
    k = imList.length() 
#  pre-calculate p-value array    
    ells = ee.List.sequence(1,k.subtract(1))
    first = ee.Dictionary({'k':k,'p':p,'median':median,'imList':imList,'pv_arr':ee.List([])})
    pv_arr = ee.List(ee.Dictionary(ells.iterate(ells_iter,first)).get('pv_arr'))      
#  filter p-values to generate cmap, smap, fmap and bmap
    cmap = ee.Image(imList.get(0)).select(0).multiply(0.0)
    smap = ee.Image(imList.get(0)).select(0).multiply(0.0)
    fmap = ee.Image(imList.get(0)).select(0).multiply(0.0)   
    bmap = ee.Image.constant(ee.List.repeat(0,k.subtract(1)))    
    threshold = ee.Image.constant(1-significance)
    first = ee.Dictionary({'ell':1,'threshold':threshold,'cmap':cmap,'smap':smap,'fmap':fmap,'bmap':bmap})
    return ee.Dictionary(pv_arr.iterate(filter_ell,first)) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:19,代码来源:eeWishart.py

示例4: simonf

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [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

示例5: rename_landsat_bands

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def rename_landsat_bands(collection, collectionName):
    '''Selects and renames the landsat bands we are interested in.  
       Works with any Landsat satellite.'''

    # The list of bands we are interested in
    # - temp = temperature.  Landsat8 splits this into two bands, we use the first of these.
    # - The panchromatic band might be nice but it is only on Landsat7/8
    LANDSAT_BANDS_OF_INTEREST = ee.List(['blue', 'green', 'red', 'nir', 'swir1', 'temp', 'swir2'])

    # The indices where these bands are found in the Landsat satellites
    LANDSAT_BAND_INDICES = {'L8': ee.List([1, 2, 3, 4, 5, 9, 6]),
                            'L7': ee.List([0, 1, 2, 3, 4, 5, 7]),
                            'L5': ee.List([0, 1, 2, 3, 4, 5, 6])}

    landsat_index = 'L8';
    if '5' in collectionName:
        landsat_index = 'L5'
    if '7' in collectionName:
        landsat_index = 'L7'

    return collection.select(LANDSAT_BAND_INDICES[landsat_index], LANDSAT_BANDS_OF_INTEREST) 
开发者ID:nasa,项目名称:CrisisMappingToolkit,代码行数:23,代码来源:landsat_functions.py

示例6: get_image_collection_landsat

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [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

示例7: containsAllBands

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def containsAllBands(collection, bands):
    """ Filter a collection with images cotaining all bands specified in
    parameter `bands` """
    bands = ee.List(bands)
    # add bands as metadata
    collection = collection.map(
        lambda i: ee.Image(i).set('_BANDS_', ee.Image(i).bandNames()))

    band0 = ee.String(bands.get(0))
    rest = ee.List(bands.slice(1))
    filt0 = ee.Filter.listContains(leftField='_BANDS_', rightValue=band0)

    # Get filter
    def wrap(band, filt):
        band = ee.String(band)
        filt = ee.Filter(filt)
        newfilt = ee.Filter.listContains(leftField='_BANDS_', rightValue=band)
        return ee.Filter.And(filt, newfilt)

    filt = ee.Filter(rest.iterate(wrap, filt0))
    return collection.filter(filt) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:23,代码来源:imagecollection.py

示例8: containsAnyBand

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def containsAnyBand(collection, bands):
    """ Filter a collection with images cotaining any of the bands specified in
    parameter `bands` """
    bands = ee.List(bands)
    # add bands as metadata
    collection = collection.map(
        lambda i: ee.Image(i).set('_BANDS_', ee.Image(i).bandNames()))

    band0 = ee.String(bands.get(0))
    rest = ee.List(bands.slice(1))
    filt0 = ee.Filter.listContains(leftField='_BANDS_', rightValue=band0)

    # Get filter
    def wrap(band, filt):
        band = ee.String(band)
        filt = ee.Filter(filt)
        newfilt = ee.Filter.listContains(leftField='_BANDS_', rightValue=band)
        return ee.Filter.Or(filt, newfilt)

    filt = ee.Filter(rest.iterate(wrap, filt0))
    return collection.filter(filt) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:23,代码来源:imagecollection.py

示例9: enumerateProperty

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def enumerateProperty(collection, name='enumeration'):
    """

    :param collection:
    :param name:
    :return:
    """
    enumerated = eecollection.enumerate(collection)

    def over_list(l):
        l = ee.List(l)
        index = ee.Number(l.get(0))
        element = l.get(1)
        return ee.Image(element).set(name, index)

    imlist = enumerated.map(over_list)
    return ee.ImageCollection(imlist) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:19,代码来源:imagecollection.py

示例10: _add_suffix_prefix

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def _add_suffix_prefix(image, value, option, bands=None):
    """ Internal function to handle addPrefix and addSuffix """
    if bands:
        bands = ee.List(bands)

    addon = ee.String(value)

    allbands = image.bandNames()
    bands_ = ee.List(ee.Algorithms.If(bands, bands, allbands))

    def over_bands(band, first):
        all = ee.List(first)
        options = ee.Dictionary({
            'suffix': ee.String(band).cat(addon),
            'prefix': addon.cat(ee.String(band))
        })
        return all.replace(band, ee.String(options.get(option)))

    newbands = bands_.iterate(over_bands, allbands)
    newbands = ee.List(newbands)
    return image.select(allbands, newbands) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:23,代码来源:image.py

示例11: addMultiBands

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def addMultiBands(imagesList):
    """ Image.addBands for many images. All bands from all images will be
    put together, so if there is one band with the same name in different
    images, the first occurrence will keep the name and the rest will have a
    number suffix ({band}_1, {band}_2, etc)

    :param imagesList: a list of images
    :type imagesList: list or ee.List
    :rtype: ee.Image
    """
    imagesList = ee.List(imagesList)
    first = ee.Image(imagesList.get(0))
    rest = imagesList.slice(1)

    def iteration(img, ini):
        ini = ee.Image(ini)
        img = ee.Image(img)
        return ini.addBands(img)

    return ee.Image(rest.iterate(iteration, first)) 
开发者ID:gee-community,项目名称:gee_tools,代码行数:22,代码来源:image.py

示例12: doyToDate

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def doyToDate(image, dateFormat='yyyyMMdd', year=None):
    """ Make a date band from a day of year band """
    if not year:
        year = image.date().get('year')

    doyband = image.select([0])
    leap = date.isLeap(year)
    limit = ee.Number(ee.Algorithms.If(leap, 365, 364))
    alldoys = ee.List.sequence(1, limit)

    def wrap(doy, i):
        i = ee.Image(i)
        doy = ee.Number(doy)
        d = date.fromDOY(doy, year)
        date_band = ee.Image.constant(ee.Number.parse(d.format(dateFormat)))
        condition = i.eq(doy)
        return i.where(condition, date_band)

    datei = ee.Image(alldoys.iterate(wrap, doyband))

    return datei.rename('date') 
开发者ID:gee-community,项目名称:gee_tools,代码行数:23,代码来源:image.py

示例13: createPieChartSliceDictionary

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def createPieChartSliceDictionary(fc):
  return ee.List(fc.aggregate_array("transition_class_palette")) \
    .map(lambda p: {'color': p}).getInfo()


###############################
# Calculations
###############################

# Create a dictionary for looking up names of transition classes. 
开发者ID:giswqs,项目名称:qgis-earthengine-examples,代码行数:12,代码来源:3_water_class_transition.py

示例14: intersect

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def intersect(state):
  nPowerPlants = ee.List(state.get('power_plants')).size()
  # Return the state feature with a new property: power plant count.
  return state.set('n_power_plants', nPowerPlants)

# Load the primary 'collection': US state boundaries. 
开发者ID:giswqs,项目名称:qgis-earthengine-examples,代码行数:8,代码来源:intersect.py

示例15: anglestats

# 需要导入模块: import ee [as 别名]
# 或者: from ee import List [as 别名]
def anglestats(current,prev):
    ''' get dictionary of incident angle statistics of current image and append to list '''
    prev = ee.Dictionary(prev)
    rect = ee.Geometry(prev.get('rect'))
    stats = ee.List(prev.get('stats'))
    current = ee.Image(current).select('angle')
    meana = current.reduceRegion(ee.Reducer.mean(),geometry=rect,maxPixels= 1e9).get('angle')
    mina = current.reduceRegion(ee.Reducer.min(),geometry=rect,maxPixels= 1e9).get('angle')
    maxa = current.reduceRegion(ee.Reducer.max(),geometry=rect,maxPixels= 1e9).get('angle')
    stats = stats.add(ee.Dictionary({'mina':mina,'meana':meana,'maxa':maxa}))
    return ee.Dictionary({'stats':stats,'rect':rect}) 
开发者ID:mortcanty,项目名称:earthengine,代码行数:13,代码来源:app.py


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