[GRASS-user] using GDAL to view netcdf files in GRASS

John A Stevenson john.stevenson at manchester.ac.uk
Tue Dec 1 05:01:38 EST 2009


Carbonari, Katie (IS) wrote:
>
> Hello. I'm trying to use GDAL to convert my netcdf file into a GTiff 
> so it can be read into GRASS. I tried using  "gdal_translate -of GTiff 
> -b 1 NETCDF:FILE.nc:Outfile Outfile.tiff"
>
You probably need to specify a coordinate system, too.  Do this with the 
-a_srs option. 

See http://www.gdal.org/gdal_utilities.html for details.  The easiest 
way is using the epsg codes.  On my system, I can find them by:

cat /usr/share/proj/epsg | grep -i lambert -A 1

There is also a list at (http://www.epsg-registry.org/) - look under 
Projected CRS type.  Choose the one that you need, and amend your code. 
e.g.

gdal_translate -of GTiff -a_srs epsg:12345 -b 1 NETCDF:FILE.nc:Outfile 
Outfile.tiff

You might also need to warp your map into the new projection

gdalwarp -t_srs epsg 12345 Outfile.tiff Outfile_warped.tiff

See the first parts of this tutorial for details
http://blog.thematicmapping.org/2008/03/generating-map-tiles-with-gdal2tiles.html

Hope that helps,

John

-- 


Dr John Stevenson
Postdoctoral Research Associate
School of Earth, Atmospheric and Environmental Sciences
Williamson Building (Room 2.42)
University of Manchester
Manchester M13 9PL, UK
tel. +44(0)161 306 6585; fax. +44(0)161 306 9361;
john.stevenson at manchester.ac.uk 



More information about the grass-user mailing list