Skip to content

Instantly share code, notes, and snippets.

@patchdynamics
Last active August 29, 2015 14:26
Show Gist options
  • Save patchdynamics/89648bbf45b127555bd7 to your computer and use it in GitHub Desktop.
Save patchdynamics/89648bbf45b127555bd7 to your computer and use it in GitHub Desktop.
NARR NetCDF to GeoTIFF
require(ncdf)
require(raster)
file.nc <- 'air.sfc.2009.nc'
## Output: a GeoTIFF file
file.tiff <- paste('air/air.', sprintf('%.4d',day), '.tiff', sep ='')
r.temperature <- raster(file.nc, day)
## Save to disk as GeoTIFF
writeRaster(r.temperature, filename = file.tiff, format = 'GTiff', overwrite = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment