I have netcdf files of daily temperature and precipitation data How is it possible to Change projection of a netcdf?
I have tried to doing this using raster function to read the files and reproject them with projectraster?
Code_used
a <-raster(file.nc)
cr1<-"+proj=longlat +datum=NAD83 +no_defs+ellps=GRS80 +towgs84=0,0,0"
projectRaster(a, cr1,res = 0.04166667)
ERROR_
Error in (function (classes, fdef, mtable) : unable to find an inherited method for function βresβ for signature β"character"β In addition: Warning message: In min(dim(to)[1:2]) : no non-missing arguments to min; returning Inf
The help for
projectRaster
gives this usage:if you call it with two unnamed arguments, they get matched to
from
andto
, andto
is:if instead you name the second argument, this should work:
because now the second argument is matched as the
crs
argument.BUT if you just want to transform a gdal-compatible data set then you can use
gdaltransform
, either from the command line or via the function with the same name from thegdalUtils
package.