Displaying 1 result from an estimated 1 matches for "swe_in".
Did you mean:
sein
2013 Jan 29
2
Netcdf and Raster Package Questions, Need .asc File for GIS
...2.201204110000.d01.nc
##########
# Start R #
##########
library(ncdf)
ex.nc = open.ncdf("NOAH32.201204110000.d01.nc")
print(ex.nc)
summary(ex.nc)
x = get.var.ncdf(ex.nc, "lon")
y = get.var.ncdf(ex.nc, "lat")
swe = get.var.ncdf(ex.nc, "SWE") # kg/m2
swe_in <- swe * 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,...