Google Earth Engine(gee)中的List
程序员文章站
2022-05-26 19:10:20
...
目录
List中的equals、contains、containsAll
类似于js中的数组
ee.List
print('ee.List([1, 2, 3, 4, 5]):', ee.List([1, 2, 3, 4, 5]));
print('ee.List.sequence(1, 5):', ee.List.sequence(1, 5));
print('ee.List.sequence(1, 5).get(2):', ee.List.sequence(1, 5).get(2));
print('ee.List(["a","b","c","d"]):', ee.List(["a","b","c","d"]));
print('ee.List(["a","b","c","d"]).get(2):', ee.List(["a","b","c","d"]).get(2));
print('ee.List.sequence(1, 365, 16)',ee.List.sequence(1, 365, 16))
List.repeat()
List.sequence()
ee.List.sequenee.List.sequencece ( start , end,step , 等差数列由几个数字构成)
List中的get、set
print(ee.List([1992,23,45,"hello"]))
print(ee.List([1992,23,45,"hello"]).set(0,2000))
print(ee.List([1992,23,45,"hello"]).set(1,"hahahah"))
print(ee.List([1992,23,45,"hello"]).set(-1,"world"))
print(ee.List([1992,23,45,"hello"]).get(0))
List中的replace、replaceAll
print(ee.List([1992,23,"hello",1992]))
print("replace",ee.List([1992,23,"hello",1992]).replace(1992,2000))
print("replaceAll",ee.List([1992,235,"hello",1992]).replaceAll(1992,2000))
List中的add、insert、reverse、swap
print("add",ee.List([1992,23,"hello",1992]).add("lijiang"))
print("insert",ee.List([1992,23,"hello",1992]).insert(2,"sichuan"))
print("reverse",ee.List([1992,23,"hello",1992]).reverse())
print("swap",ee.List([1992,23,2,1992,56]).swap(1,4))
List中的sort
print(ee.List([1992,23,1,1992]).sort())
print(ee.List(["beijing","shanghai","sichuan","chongqing"]).sort())
List 中的remove、removeAll
print(ee.List([1992,23,"hello",1992]))
print(ee.List([1992,23,"hello",1992]).get(2))
print(ee.List([1992,23,"hello",1992]).remove("hello"))//移除操作不是用索引
print(ee.List([1992,23,"hello",1992]).removeAll([1992,"hello"]))
List中的equals、contains、containsAll
var list1=ee.List(["a","b","c","d"])
var list2=ee.List(["a","b","d","c"])
var list3=ee.List(["a","b","c"])
print(list1.equals(list2))
print(list1.contains("a"))
print(list1.contains(list3))
print(list1.containsAll(list3))
List.map()
var list1=ee.List(["a","b","c","d"])
function repeatName(name){
return ee.List.repeat(name,3)
}
print("list1",list1)
print("list1.map(repeatName)",list1.map(repeatName))
List中的iterate
var list=ee.List([1,2,3,4,5])
function myAdd(num1,num2){
return ee.Number(num1).add(num2)
}
print(list.iterate(myAdd,0))
print(list.iterate(myAdd,10))
List中的size、length
size()和.length()指令具有相同的效果
推荐阅读
-
Google Earth Engine——windowns下搭建GEE本地python开发环境
-
google earth engine(GEE)如何在看某一点的经纬度、波段信息
-
使用google earth engine(GEE)提取2000年到2019年长江下游水体(河流、湖泊)数据
-
google earth engine(GEE)导出影像集合Collection方法
-
Google Earth Engine(GEE)对指定地点Sentinel-2 Level1C数据进行NDVI指数的计算
-
Google Earth Engine(gee)中的List
-
Google Earth Engine(gee)中的Dictionary
-
Google Earth Engine(gee)中的Date和DateRange
-
Google Earth Engine(gee)中的String和Number
-
Google Earth Engine(GEE)对指定地点Sentinel-2 Level1C数据的读取及云量处理