In [ ]:
!gdalinfo /usr/local/share/data/north_carolina/rast_geotiff/basin_50K.tif

Generate a new GRASS LOCATION Specifying the projection parameters using the proj-4 string syntax (information retrieved from the gdalinfo output):


In [ ]:
import grass.script as grass

In [ ]:
proj4 = '+proj=lcc +lat_1=36.1667 +lat_2=34.333 +lat_0=33.75 +lon_0=-79 +x_0=609601.22 +y_0=0 +no_defs +a=6378137 +rf=298.2572221010042 +to_meter=1'
try:
    grass.run_command('g.proj', proj4=proj4, location='nc')
except:
    print 'grass location nc already exist'

In [ ]:
!g.mapset location=nc mapset=PERMANENT

In [ ]:
!g.proj -p

In [ ]:
!r.in.gdal input=/usr/local/share/data/north_carolina/rast_geotiff/elevation.tif output=elevation -e --o

In [ ]:
%run grassutil.ipy

In [ ]:
makeImage(basemap='elevation', inputlayer='elevation', maptype='raster', 
          vsize=10, maptitle='elevation', region=region2dict(rast='elevation'), legend=False, outputimagename='test.png')

In [ ]:
!r.in.gdal input=/usr/local/share/data/north_carolina/rast_geotiff/basin_50K.tif output=basin_50K -e --o

In [ ]:
makeImage(basemap='basin_50K', inputlayer='basin_50K', maptype='raster', 
          vsize=10, maptitle='basin_50K', region=region2dict(rast='basin_50K'), legend=False, outputimagename='test.png')

In [ ]:
!m.nviz.image elevation_map=elevation output=elevation position=0.5,0.5 \
              perspective=100 height=800 color_map=basin_50K \
              resolution_fine=1 resolution_coarse=1 format=tif --q

In [ ]:
!convert elevation.tif elevation.png

In [ ]:
from IPython.core.display import Image

In [ ]:
Image('elevation.png')

In [ ]: