【问题标题】:check if a raster is flipped检查栅格是否翻转
【发布时间】:2020-12-16 05:05:40
【问题描述】:

我有一个具有以下属性的栅格

  gdalinfo <- try (rgdal::GDALinfo(rasterFile))
  
  # Warning message:
  #  In rgdal::GDALinfo(rasterFile) : statistics not supported by this driver
  
  gdalinfo
  rows        36 
  columns     64 
  bands       1 
  lower left origin.x        91.17 
  lower left origin.y        -14.73 
  res.x       1 
  res.y       1 
  ysign       -1 
  oblique.x   0 
  oblique.y   0 
  driver      GTiff 
  projection  +proj=longlat +datum=WGS84 +no_defs 
  file        C:/earthengine/historical/raw/tmax_1987_ACCESS1-0__0.tif 
  apparent band summary:
    GDType hasNoDataValue NoDataValue blockSize1 blockSize2
  1 Float32          FALSE           0         32         64
  apparent band statistics:
    Bmin       Bmax Bmean Bsd
  1 -4294967295 4294967295    NA  NA
  Metadata:
    AREA_OR_POINT=Area 
  
  

我怀疑这个光栅是反转的,所以我翻转它

  my_ras_cel <- raster(rasterFile)
  
  # reverse it
  my_ras_cel_rev <- flip(my_ras_cel, direction='y')

将两个栅格绘制在一起

  ras_stack <- stack(my_ras_cel, my_ras_cel_rev)
  
  spplot(ras_stack)      

我可以看出翻转的(下面板)是正确的光栅,因为它跟随 我感兴趣的土地(马来西亚、印度尼西亚)

我的问题是有什么方法可以检查我的栅格是否确实翻转了?

【问题讨论】:

    标签: r raster rgdal


    【解决方案1】:

    GDALinfo 输出ysign -1 表明数据没有翻转。这就是文件中关于此的所有信息。

    但是数据明显是翻转的,因为你给出的原因,文件在这方面是错误的。

    【讨论】:

    • 谢谢。我正在通过 R 处理来自 googleearth 引擎的这些数据并在本地下载。不知道哪里出了问题,因为即使 ysign 是 -1,我的数据仍然会被翻转。我需要检查为什么会这样。谢谢
    猜你喜欢
    • 2021-01-09
    • 1970-01-01
    • 2022-11-20
    • 2012-09-03
    • 1970-01-01
    • 2023-01-25
    • 2012-05-23
    • 1970-01-01
    • 2023-03-30
    相关资源
    最近更新 更多