【发布时间】:2020-07-19 23:42:45
【问题描述】:
我尝试打印给定像素(点位置)的降水总和的值
# pixel location
loc_point = ee.Geometry.Point([-0.627983, 52.074361])
# get precip
precip = ee.ImageCollection('NASA/GPM_L3/IMERG_MONTHLY_V06')\
.filterDate('2019-06-01', '2020-06-30')\
.filterBounds(loc_point)\
.select('precipitation')
# sum
precip_sum = precip.reduce(ee.Reducer.sum())
# print sum precip value
precip_sum.get('precipitation_sum').getInfo()
【问题讨论】:
-
行尾的反斜杠在几乎所有 Python 代码中都是不可读的邪恶。如果您试图避免使用 79 个字符 (pep8),请以可读的方式执行,例如:创建一个函数、使用多个变量、在
(和)上换行。这样一来,由 blocks 和伪代码语法构成的语言将很容易阅读,因此您可以简单地用眼睛浏览代码并知道发生了什么,而不是在头脑中颠倒代码只是为了阅读它。使代码可读,它将使您将来的生活更轻松。
标签: python google-earth-engine