How to regrid the resolution of data with netcdf format in R

时间:2017-04-10 02:50:24

标签: r datagrid spatial netcdf4

I have a netcdf file named "precip.mon.mean.nc" downloaded from https://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html. It is a monthly mean precipitation dataset and the resolution is 2.5x2.5.

I wonder how I can regrid the precipitation data into 1x1 and 3x3 resolution respectively using interpolation method such as Kriging or inverse distance weighted (IDW). Thanks for the help.

require(ncdf4)

Precipitation = nc_open(filename = "precip.mon.mean.nc")
Pre=ncvar_get(Precipitation,varid = "precip")
Pre[Pre=-9.96920996838687e+36]=NA
lon=ncvar_get(Precipitation,varid = "lon")
aa=which(lon==181.25)
lon[aa:length(lon)]=lon[aa:length(lon)]-360
lat=ncvar_get(Precipitation,varid = "lat")
Date=ncvar_get(Precipitation,varid = "time")
nc_close(Precipitation)
Time=as.Date(Date/24,origin="1800-01-01")

0 个答案:

没有答案