我试图使用sen2r
R包加载一些Sentinel卫星图像,但遇到了问题。简而言之,即使是文档中最简单的示例也不起作用。此示例如下:
json_path <- build_example_param_file()
if (is_gcloud_configured()) {
out_paths_2 <- sen2r(json_path)
} else {
out_paths_2 <- character(0)
}
字符串
这是我收到的输出;其中一些消息似乎对结果没有影响,错误有点模糊,似乎是由于包使用的某些函数中的一个小错误引起的。
[2023-12-04 17:59:26] #### Starting sen2r execution. ####
Spherical geometry (s2) switched off
[2023-12-04 17:59:27] Searching for available SAFE products...
old-style crs object detected; please recreate object with a recent sf::st_crs()
old-style crs object detected; please recreate object with a recent sf::st_crs()
[2023-12-04 17:59:28] Querying Google Cloud (this can take a very long time)...
|==========================================================================================| 100%Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘saveXML’ for signature ‘"NULL"’
Spherical geometry (s2) switched on
型
示例代码组成了一个默认的.json文件,其中包含函数的参数。该文件的内容如下:
{
"preprocess": [true],
"s2_levels": ["l1c", "l2a"],
"sel_sensor": ["s2a", "s2b"],
"online": [true],
"server": ["gcloud"],
"order_lta": [true],
"downloader": ["builtin"],
"overwrite_safe": [false],
"rm_safe": ["no"],
"max_cloud_safe": [100],
"step_atmcorr": ["l2a"],
"sen2cor_use_dem": [null],
"sen2cor_gipp": [null],
"timewindow": ["2020-08-01", "2020-08-01"],
"timeperiod": ["full"],
"extent": ["C:/Users/pthom/AppData/Local/R/win-library/4.3/sen2r/extdata/vector/barbellino.geojson"],
"s2tiles_selected": [null],
"s2orbits_selected": [null],
"list_prods": ["BOA", "SCL"],
"list_indices": ["MSAVI2", "NDVI"],
"list_rgb": ["RGB432B", "RGB843B"],
"rgb_ranges": [
[0, 2500],
[
[0, 7500],
[0, 2500],
[0, 2500]
]
],
"index_source": ["BOA"],
"mask_type": [null],
"max_mask": [100],
"mask_smooth": [0],
"mask_buffer": [0],
"clip_on_extent": [true],
"extent_as_mask": [false],
"extent_name": ["sen2r"],
"reference_path": [null],
"res": [null],
"res_s2": ["10m"],
"unit": ["Meter"],
"proj": [null],
"resampling": ["near"],
"resampling_scl": ["near"],
"outformat": ["GTiff"],
"rgb_outformat": ["GTiff"],
"index_datatype": ["Int16"],
"compression": ["DEFLATE"],
"rgb_compression": ["DEFLATE"],
"overwrite": [false],
"path_l1c": ["C:/Users/pthom/DOCUME~1/SEN2R~1/safe"],
"path_l2a": ["C:/Users/pthom/DOCUME~1/SEN2R~1/safe"],
"path_tiles": [null],
"path_merged": [null],
"path_out": ["C:\\Users\\pthom\\AppData\\Local\\Temp\\RtmpyAjAd3\\sen2r_out_120814e04eb2"],
"path_rgb": [""],
"path_indices": [""],
"path_subdirs": [true],
"thumbnails": [true],
"log": [null],
"parallel": [false],
"processing_order": ["by_groups"],
"pkg_version": ["1.6.0"]
}
型
为了确定查询的空间范围,此文件调用sen2r
包提供的geoJSON文件。此文件的内容显示在此处。
{
"type": "FeatureCollection",
"name": "barbellino",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32632" } },
"features": [
{ "type": "Feature", "properties": { }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 580560.0, 5101700.0 ], [ 580680.0, 5101700.0 ], [ 580800.0, 5101820.0 ], [ 580800.0, 5102120.0 ], [ 580660.0, 5102120.0 ], [ 580560.0, 5102020.0 ], [ 580560.0, 5101700.0 ] ] ] } }
]
}
型
我使用的是R 4.3.2和sen 2 r版本1.6.0。我已经尝试更新我设备上所有安装的R软件包,使用install_github
安装sen 2 r,并在网上查看了很多其他类似的问题。可能只是这个问题无法解决,除非软件包的创建者能够恢复一些东西;我不确定。看起来这个软件包最近已经更新了,以反映一些非R软件的变化,所以大多数关于sen2r
的问题都来自旧版本。如果有任何其他信息对你有帮助,请告诉我。或者你有什么建议
谢谢你,谢谢
1条答案
按热度按时间6mzjoqzu1#
您的时间范围内只有一个日期:“2022-08-01”。
设置为类似于:
字符串
后重试
编辑...
我将你的js.json和上面的geojson扩展文件复制到我的计算机上的一个目录中,并运行
sen2r
命令,如下所示(删除一些配置选项,以简化):型
此代码成功下载了25个SAFE目录,并创建了BOA和SAVI产品。
也许你可以从简单的东西开始,如果它有效,尝试添加其他产品。