Ok, so I was able to convert and visualize everything but the projections are skewed. Do I have to define a projection when reading it in via raster or using writeGDAL? I have a custom co-ordinate system which is a modified North American Lambert Conformal Conic (NAD 1983 datum) like so: False_Easting: 0.00000000 False_Northing: 0.00000000 Central_Meridian: -96.00000000 Standard_Parallel_1: 33.00000000 Standard_Parallel_2: 45.00000000 Latitude_Of_Origin: 40.00000000 Linear Unit: Meter
I would presume that writeGDAL takes care of the projection but my hunch says otherwise since the netcdf does not really have a "projection" in GIS parlance if I am not mistaken. Thanks! On Sat, Nov 6, 2010 at 2:16 PM, Advait Godbole <advaitgodb...@gmail.com>wrote: > Thanks Mike and Sam. This worked perfectly - I am only now realizing how > powerful R and these libraries are. Very elegant and smooth! > > cheers, > > adv > > > On Sat, Nov 6, 2010 at 11:30 AM, Samuel Veloz <sdve...@ucdavis.edu> wrote: > >> You can skip the second step in Michael's code and just write to a tif >> file using raster: >> >> r <- raster("ncfile.nc") #you may need to specify varname here (which >> band you are using) >> writeRaster(r,"r.tif") >> >> Sam >> >> >> On Sat, Nov 6, 2010 at 7:19 AM, Advait Godbole >> <advaitgodb...@gmail.com>wrote: >> >>> Dear Members, >>> >>> I want to convert a 356 x 507 (lat,lon) 2D netcdf file into a raster so >>> that I can read it in to image analysis/GIS programs. I initially adopted >>> an >>> approach whereby I first used NCL to convert it to a Fortran unformatted >>> binary and then convert it to a formatted sequential format using >>> Fortran. >>> This was then read in to ENVI as a "flt" file. I would like to know if >>> there >>> is an elegant way in R to directly convert to a geospatial raster, more >>> so >>> because I recently switched to using a different cluster and am running >>> into >>> i/o problems with all those binary conversions. >>> >>> Regards, >>> >>> -- >>> Advait Godbole, BE Mech >>> Doctoral Student, Global Carbon Cycle Lab >>> Earth and Atmospheric Sciences >>> Purdue University >>> West Lafayette, IN 47906 >>> USA >>> voice: +1 317 730 5235 >>> >>> [[alternative HTML version deleted]] >>> >>> _______________________________________________ >>> R-sig-Geo mailing list >>> R-sig-Geo@stat.math.ethz.ch >>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo >>> >> >> > > > -- > advait godbole > -- advait godbole [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo