Re: [R-sig-Geo] converting raster to netcdf .nc with keeping CRS information

2019-02-12 Thread Michael Sumner
I agree, I wouldn't try to bend NetCDF to work this way via raster. The convention/s require parameters of the projection to be specified via attributes and you could do that via RNetCDF or ncdf4, but it's a lot of painful work. It's not easy to create NetCDF from R, it's a simple as that - and ty

Re: [R-sig-Geo] converting raster to netcdf .nc with keeping CRS information

2019-02-12 Thread Ben Tupper
Hi Ahmed, I can confirm that on my system I get the same result as you. Does your workflow confine you to using NetCDF? I can successfully write/read to the native raster format. r2 <- writeRaster(r, filename = "r001.grd", overwrite=TRUE) r2 #class : RasterLayer #dimensions : 1328, 12

Re: [R-sig-Geo] converting raster to netcdf .nc with keeping CRS information

2019-02-12 Thread Ahmed El-Gabbas
Thanks Ben for your suggestion. Adding *prj = TRUE *argument caused this error: Error in ncdf4::ncvar_def(varname, varunit, list(xdim, ydim), NAvalue(x), : unused argument (prj = T) Ahmed On Tue, Feb 12, 2019 at 3:13 PM Ben Tupper wrote: > Hi, > > Have you tried using th

Re: [R-sig-Geo] converting raster to netcdf .nc with keeping CRS information

2019-02-12 Thread Ben Tupper
Hi, Have you tried using the 'prj' argument to writeRaster? I don't know that it will be the solution, but according to ... https://www.rdocumentation.org/packages/raster/versions/2.8-19/topics/writeRaster It

[R-sig-Geo] converting raster to netcdf .nc with keeping CRS information

2019-02-12 Thread Ahmed El-Gabbas
Hello all, I am having a problem while converting a raster object as NetCDF (.nc) file, with keeping the CRS information in the output file. Here is a reproducible code: require(raster) require(ncdf4) CurrTemp <- tempfile() download.file(url = "https://seaice.uni-bremen.de/data/amsre/asi_daygri