使用R

时间:2015-11-08 18:03:52

标签: r netcdf

我已经从ECMWF ERA-INTERIM (click here to download the file)下载了温度数据(netcdf),但是当我尝试绘制它时,它似乎不完整。我做错了什么?

library(ncdf) 
library(raster)

UK <- getData("GADM",country="GBR",level=1)
england <- UK[UK$NAME_1 == 'England', ]

# To convert longitude from range [0,360] to [-180,180]
x <- rotate(raster(x = "netcdf-atls13-a562cefde8a29a7288fa0b8b7f9413f7-ORIAcW.nc", varname="t2m"))

plot(x, ext=extent(england))
plot(england, add=T)

enter image description here

1 个答案:

答案 0 :(得分:1)

这是一个错误。它已在光栅2.4-24中修复(可通过R-Forge获得)。以下是针对此特定案例的解决方法:

library(raster)
r <- raster("netcdf-atls13-a562cefde8a29a7288fa0b8b7f9413f7-ORIAcW.nc", varname="t2m")
x <- rotate(r)
x[, 240] <- r[1:240,1]