【问题标题】:Projecting a Climate Research Unit (CRU) CDF raster into a stereo polar view in R: how-to?将气候研究单元 (CRU) CDF 栅格投影到 R 中的立体极地视图中:操作方法?
【发布时间】:2017-01-04 11:55:12
【问题描述】:

如何将气候研究单元 (CRU) CDF 投影到 R 中的极地视图中?

cruts 包及其函数 cruts2raster() 可以很好地获取时间序列数据,我可以使用 raster 可视化一个月(或更多)的数据 包和 plot()image() 函数。在引入所有数据并检查 RasterStack 后,它会在查询时绘制并给出坐标参考系,但我无法将其转换为极坐标投影。

我使用 rgdal(已将最新的 proj.4 安装到我的 Mac 的 /usr/local/lib/pkgconfig 中)但似乎无法投影到这个极坐标视图中:

library(cruts)
library(raster)
## Bring the downloaded file into R
r <- cruts2raster("cru_ts3.24.2011.2015.pre.dat.nc", 
                  timeRange=c("2011-01-01","2015-01-01"))
## get the first layer
r1 <- r[[1]]

## admire its colors (beautiful!)
plot(r1)

# check its coordinate reference system and projection
r1 
# gives this 
# coord. ref. : +init=epsg:4326 
# .             +proj=longlat 
# .             +datum=WGS84 
# .             +no_defs 
# .             +ellps=WGS84 +towgs84=0,0,0

## define the stereo polar projection to make it really gorgeous
newproj <- "+proj=stere 
            +lat_0=90 
            +lat_ts=70 
             +lon_0=-45 +datum=WGS84"
## try to project
x <- projectRaster(r1,crs=newproj)
# and FAIL

" if (value[1] != nrow(x) | value[2] != ncol(x)) { 中的错误: 需要 TRUE/FALSE 的缺失值 另外:警告信息: 在dim&lt;-(*tmp*, value = c(nr, nc)) 中: 强制引入整数范围的 NA"

我一直无法找出“缺失值”。

projectRaster() 的文档中有这样的内容:“将投影的极地数据转换为(例如)经度/纬度时,projectExtent 不能很好地工作。使用这些数据,您可能需要调整返回的对象。例如,做 ymax(object)

【问题讨论】:

    标签: r gis


    【解决方案1】:

    这解决了我的问题:

    r1e

    r1c

    绘图(r1c)

    x

    绘图(x)

    【讨论】:

      猜你喜欢
      • 2017-10-18
      • 1970-01-01
      • 1970-01-01
      • 2015-10-05
      • 1970-01-01
      • 2019-07-26
      • 1970-01-01
      • 2021-04-03
      • 2017-04-20
      相关资源
      最近更新 更多