[R-sig-Geo] writeRaster - netcdf - Rotation

Pascal Oettli kridox at ymail.com
Fri Mar 22 15:48:11 CET 2013


Hi,

What are the dimension of 'example.asc'? Generally, in netCDF file, the 
first dimension is longitude, second is latitude.

Regards,
Pascal

Le 13/03/22 23:20, Philipp Reiter a écrit :
> Hey there,
>
> I’ve got a problem concerning exporting a raster*-Object as nc-File:
> When exporting rasterLayers or rasterBricks as nc-Files with writeRaster from the raster-Package, easting and northing in the resulting nc-File are switched, which results in a rotated plot. I can correct this afterwards, but it should be possible to be correct right away?!
>
> Example code for a rasterLayer:
> tmp <- raster(readGDAL(‘example.asc’,p4s="+init=epsg:31467"))
> writeRaster(tmp, filename=’export.nc’, format="CDF", overwrite=TRUE)
> nc <- open.ncdf("export.nc")
> x <- get.var.ncdf(nc,”easting”)
> y <- get.var.ncdf(nc,”northing”)
>
> R version 2.15.3 (2013-03-01)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> ncdf_1.6.6    raster_2.1-16 rgdal_0.8-5   sp_1.0-6
>
>
> I hope someone can give me a hint! Thanks in advance!
> Philipp
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>



More information about the R-sig-Geo mailing list