移植并裁剪RasterBrick R.

时间:2016-03-15 22:31:43

标签: r crop raster transpose

A)如何转置包含多个图层的栅格砖?

prr <- brick('dat.nc4',transpose=T)#transpose=T does not transpose

> proj4string(prr) <-crs("+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0")
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files

> prr
class       : RasterBrick
dimensions  : 3600, 1800, 6480000, 732  (nrow, ncol, ncell, nlayers)
resolution  : 0.1, 0.1  (x, y)
extent      : -90, 90, -180, 180  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0
data source : /data/Run.nc4
names       : X20150401, X20150401.25, X20150401.5, X20150401.75, X20150402, X20150402.25, X20150402.5, X20150402.75, X20150403, X20150403.25, X20150403.5, X20150403.75, X20150404, X20150404.25, X20150404.5, ...
z-value     : 20150401, 20150930 (min, max)
varname     : precipitationCal

您可以从文件属性中看到lat和lon被翻转。 尝试转置rasterbrick会产生以下错误:

A=t(pr)

    Error in matrix(unlist(ini), ncol = 2, byrow = TRUE) :
      'data' must be of a vector type, was 'NULL'
    In addition: There were 50 or more warnings (use warnings() to see the first 50)

我如何transpose dat.nc4中的所有图层?{/ p>

#########################################################

B)

尝试裁剪时也遇到了同样的错误:

cr <- crop(dat, extent(-141.01807 , -52.61941, 41.68144, 60), snap="out")
NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files
Error in matrix(unlist(ini), ncol = 2, byrow = TRUE) :
  'data' must be of a vector type, was 'NULL'

如果我使用prr <- raster('dat.nc4',transpose=T)

只读取一个图层,则砖块和裁剪功能会很好用

感谢您对此的看法。

AT

我正在分析的文件可以在这里下载http://disc.sci.gsfc.nasa.gov/SSW/#keywords=GPM_3IMERGHH 03

0 个答案:

没有答案