<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Well use an utility script with few lines of code to parse the output of GRASS commands and make new functions that use the parsed output.
The script use ipython specific syntax like !system_command which allows to run any command available in the user $PATH. The code is saved in a file with .ipy extension and is imported using the ipython magic function %run
Step1:  Use of the g.mapset
* Set the GRASS WORKSPACE to 
Step2:  print projection info with g.proj
Step3:  list vector and raster layers with g.list
Step4:  use the getLayerList function to store the g.list output in a python list
Step5:  print info for a raster layer with r.info
Step6:  use the  'r/v'layerInfo function to store the r.info / v.info  output in a python dictionary
Step7:  use of the makeImage function to display raster and/or vector maps 
(a wrapper around display commands in GRASS using the CAIRO DRIVER)
Step8:  Example on how to repoject raster and vector data between 2 different GRASS LOCATION
<ASSISTANT_TASK:>
Python Code:
!g.gisenv
Explanation: Well use an utility script with few lines of code to parse the output of GRASS commands and make new functions that use the parsed output.
The script use ipython specific syntax like !system_command which allows to run any command available in the user $PATH. The code is saved in a file with .ipy extension and is imported using the ipython magic function %run:
%run file.ipy 
the source code available in grassutil.ipy in the current directory and can be loaded in the notebook using the magic function %load:
%load grassutil.ipy 
It is also possible to save a new file or to overwrite an existing one, from the content of a code cell using the magic function:
%%file filename.
Running the grassutil.py code, the following functions will be immediatly available in the current notebook:
getLayerList
list2dict
vlayerInfo
rlayerInfo
region2dict
makeImage
In the IPython notebook is possinle to execute any command available in the $USER $PATH environment, such all the grass command after exporting the grass environment.
Use of the g.gisenv
End of explanation
!g.mapset location=nc_basic_spm_grass7 mapset=user1
Explanation: Use of the g.mapset
* Set the GRASS WORKSPACE to : 
    - LOCATION  : spearfish 
    - MAPSET : user1
End of explanation
!g.proj -p
Explanation: print projection info with g.proj
End of explanation
!g.list rast
Explanation: list vector and raster layers with g.list
End of explanation
rasterlist = getLayerList(type='rast')
vectorlist = getLayerList(type='vect')
rasterlist
vectorlist
Explanation: use the getLayerList function to store the g.list output in a python list
End of explanation
!r.info elevation@PERMANENT
Explanation: print info for a raster layer with r.info
End of explanation
rasterlayerinfo = rlayerInfo(map='elevation')
vectorlayerinfo = vlayerInfo(map='geology')
rasterlayerinfo.keys()
rlayerInfo('elevation')
Explanation: use the  'r/v'layerInfo function to store the r.info / v.info  output in a python dictionary
End of explanation
!g.mapset location=nc_basic_spm_grass7 mapset=user1
inputlayer={
    'raster': ['elevation'], 
    'vector':['points_of_interest']
}
makeImage(basemap='elevation', inputlayer=inputlayer, maptype='overlay', 
          vsize=10, maptitle='points_of_interest', gridsize=4000, outputimagename='test.png')
from IPython.core.display import Image
Explanation: use of the makeImage function to display raster and/or vector maps 
(a wrapper around display commands in GRASS using the CAIRO DRIVER)
End of explanation
!g.proj -c epsg=4326 location=lonlat
!g.mapset -c location=lonlat mapset=PERMANENT
region = !r.proj input=elevation location=nc_basic_spm_grass7 -g
region
newregion = dict([(i.split('=')[0],i.split('=')[1]) for i in region[-1].split()])
!g.region -p n={newregion['n']}  s={newregion['s']}  e={newregion['e']}  w={newregion['w']} res=0.0001
!r.proj input=elevation location=nc_basic_spm_grass7 output=elevation method=bicubic --o --q
!v.proj input=points_of_interest location=nc_basic_spm_grass7 output=points_of_interest --o --q
#!g.region -p n={newregion['n']}  s={newregion['s']}  e={newregion['e']}  w={newregion['w']} res=0.0001
inputlayer={
    'raster': ['elevation'], 
    'vector':['points_of_interest']
}
makeImage(basemap='elevation', inputlayer=inputlayer, maptype='overlay', 
          vsize=10, maptitle='points_of_interest', outputimagename='test.png')
Explanation: Example on how to repoject raster and vector data between 2 different GRASS LOCATION:
* set the GRASS environment to the previously generated lonlat LOCATION (see GRASS_init.ipynb) 
* reproject GRASS layers : 
    - raster : elevation
    - vector : bugsites
End of explanation
<END_TASK>