Displaying 1 result from an estimated 1 matches for "test_grid2".
Did you mean:
test_grid24
2013 Jan 29
2
Netcdf and Raster Package Questions, Need .asc File for GIS
...* 0.0393701
# image plot of swe, takes time to load
filled.contour(x,y,swe_in, color = terrain.colors, asp = 1)
# load raster library
library(raster)
r = raster(swe_in)
# raster is sideways, rotate
m <- t(swe_in)
m <- m[nrow(m):1,]
r <- raster(m)
plot(r)
writeRaster(r,file="test_grid2.asc", format="ascii") # need square grids
# resample to square grids
r2 = raster(r)
res(r2) = min(res(r))
res(r2)
r2 <- resample(r, r2, method='bilinear')
writeRaster(r2,file="test_grid24.asc", format="ascii")
Thanks,
Doug
--
----------------...