将NetCDF文件导出到TIFF

时间:2019-02-06 18:21:34

标签: r geotiff netcdf4

我正在尝试将某些CMIP5项目NetCDF文件导出到GeoTiff中,如here所述,但是生成的图像具有偏移量。这是我正在使用的代码:

library(ncdf4)
library(raster)
FILENAME_IN = "thetao_Omon_HadGEM2-ES_rcp45_r1i1p1_200512-201511.nc"
nc <- nc_open(FILENAME_IN)
summary(nc)
print(nc)
print(names(nc$var))
varsal <- brick(FILENAME_IN, varname="thetao", level=2,    stopIfNotEqualSpaced=FALSE)
summary(varsal)
print(varsal)
r <- stack(varsal)
print(r)
names(r)
extent(r) <- extent(0, 360, -90, 90)
rr <- rotate(r)
print(rr)
names(rr)
writeRaster(rr, filename="thetao_Omon_HadGEM2-ES_rcp45_r1i1p1_lvl2.tif", format="GTiff",overwrite=TRUE)

图片预览:

enter image description here

0 个答案:

没有答案