title: How to query stored PostGIS Raster data from within the IPython Notebook
body: <p>Test data</p>
  
  <ul>
  <li><a href="http://pastelink.me/dl/de3b6a" rel="nofollow">1 TIF file</a> (159KB)</li>
  </ul>
  
  <p>Goal threefold:</p>
  
  <ol>
  <li>Load raster into PostGIS using <code>raster2pgsql</code> and visualize in QGIS</li>
  <li>In my IPython Notebook connect to PostGIS and load raster into NumPy array</li>
  <li>In my IPyhton Notebook use Pandas to load a time-series of one pixel of rasters with different time step stored in PostGIS</li>
  </ol>
  
  <p>Process so far
  I've managed to get one raster image into PostGIS Raster using the <code>raster2pgsql</code> command and visualize it in QGIS using the DB Manager:</p>
  
  <pre><code>raster2pgsql -s 4326 -d -I -C -M -R -l 4 D:\Downloads\raster//modis.tif -F -t 100x100 public.ndvi | psql -U postgres -d rastertest -h localhost -p 5432
  </code></pre>
  
  <p>But how to access/query this raster from within IPython Notebook?</p>
  
  <p>I found this <a href="http://www.slideshare.net/camptocamp/geoalchemy" rel="nofollow">presentation</a>, which is going about SQLALchemy and GeoAlchemy2. And where it is mentioned that it support PostGIS Raster as well. It seems to be very interesting! But using the <a href="https://geoalchemy-2.readthedocs.org/en/latest/core_tutorial.html" rel="nofollow">documentation</a> I don't see how I can apply this to Raster data</p>
  
  <p>I think I can make a connection to my PostGIS database using the following code, where <code>postgres=user</code>, <code>password=admin</code> and <code>database=rastertest</code>:</p>
  
  <pre><code>from sqlalchemy import create_engine
  engine = create_engine('postgresql://postgres:admin@localhost/rastertest', echo=True)
  </code></pre>
  
  <p>But then.. 
  any advice is very much appreciated.</p>