python-3.x - 如何在 tfrecord 中使用 python API 从谷歌地球引擎下载哨兵图像
问题描述
在尝试下载特定位置的哨兵图像时,tif 文件默认在驱动器中生成,但 openCV 或 PIL.Image() 无法读取它。下面是相同的代码。如果我使用文件格式作为 tfrecord. 驱动器中没有下载图像。
starting_time = '2018-12-15'
delta = 15
L = -96.98
B = 28.78
R = -97.02
T = 28.74
cordinates = [L,B,R,T]
my_scale = 30
fname = 'sinton_texas_30'
llx = cordinates[0]
lly = cordinates[1]
urx = cordinates[2]
ury = cordinates[3]
geometry = [[llx,lly], [llx,ury], [urx,ury], [urx,lly]]
tstart = datetime.datetime.strptime(starting_time, '%Y-%m-%d') tend =
tstart+datetime.timedelta(days=delta)
collSent = ee.ImageCollection('COPERNICUS/S2').filterDate(str(tstart).split('')[0], str(tend).split(' ')[0]).filter(ee.Filter.lt('CLOUDY_PIXEL_PERCENTAGE', 20)).map(mask2clouds)
medianSent = ee.Image(collSent.reduce(ee.Reducer.median())) cropLand = ee.ImageCollection('USDA/NASS/CDL').filterDate('2017-01-01','2017-12-31').first()
task_config = {
'scale': my_scale,
'region': geometry,
'fileFormat':'TFRecord'
}
f1 = medianSent.select(['B1_median','B2_median','B3_median'])
taskSent = ee.batch.Export.image(f1,fname+"_Sent",task_config)
taskSent.start()
我希望输出在 python 中是可读的,所以我可以转换为 numpy。如果文件格式为“tfrecord”,我希望该文件能够下载到我的驱动器中。
解决方案
推荐阅读
- sql - 在访问中,查询仅在每个字段中有记录时才显示结果
- sudo - gitlab-ci-runner 在下次运行时避免“删除失败”错误消息(避免跟踪某些文件)
- ios - 在另一个 ViewController 中的 ViewController 之间显示和切换
- ckeditor5 - 如何销毁 Ckeditor 5 实例
- axios - 如何使用 Babel Polyfill 实现 Promise?
- ios - 我正在尝试将 UICollectionView 项中的值传递给 Swift 4 中的 UIButton
- javascript - 在shopify中使用嵌入式应用程序获取商店名称/ URL(应用程序是iFramed)
- plot - 用 gfortran 编译 plplot
- .htaccess - 如何使用 Htaccess 从 URL 中删除连续重复的单词?
- excel - 如何在 LINK 字段中调整图形对象的大小?