I am trying to write rasters in asc format using raster
and terra
R package. I am using the following code
library(terra)
library(raster)
f <- system.file("external/test.grd", package="raster")
r1 <- raster(f)
plot(r1)
writeRaster(r1, paste('Try1','.asc', sep=''), overwrite=TRUE)
r2 <- rast(f)
writeRaster(r2, paste('Try2','.asc', sep=''), overwrite=TRUE)
Now if you open the Try1.asc, you will see that the NODATA_value is -3.4e+38 while it is nan in Try2.asc
nan is creating problem when I am using these rasters in other software. I have tried using NAflag = -3.4e+38
which is not working as well
Now how can I have the output like raster
package using terra
R package while using writeRaster
function?