Hi,

> I asked him if he had a solution for plotting standard MODIS hdf products
> available here:
> http://rapidfire.sci.gsfc.nasa.gov/realtime/2009300/
>
> In more general terms, what are people using for a 'MODIS workflow'? I
> can't
> imagine I'm the first to want to plot MODIS images using basemap. Does
> anyone have a 'roadmap' (as Christian phrased it)? I am interested in the
> steps from A-Z. That is, what tool to read the hdf files (modis is hdf4),
> what tool to reproject the data, and finally, the basemap plotting.
>

Really, it's what you want to do with your MODIS data. My "workflow" is
usually as follows:
1.- Access MODIS data (and ancillary stuff, such as QA flags etc) using
Python's GDAL bindings.
2.- Manipulate the MODIS data from (1) using numpy, scipy. If there's
significant looping involved, use weave to speed things up.
3.- Plot using matplotlib. Usually, as imshow ("vanilla matplotlib"),
sometimes using basemap. The difference is whether I'm just quickly plotting
something together, or whether I want to actually have a map where I want to
plot other stuff on top of the MODIS data.

In terms of rapidfire, you can even access the WMS data using GDAL, so no
need to download the data. An example for monitoring El NiƱo related fires
in Borneo is attached. You need to get the fires in the last 7days file (we
download it as a crontab jobby), and the attached script just plots the data
on a basemap for quick visualisation.

I am in the process of putting most of my notes on <
http://sites.google.com/site/spatialpython/> and there's also the Unofficial
Python GIS SIG <http://groups.google.com/group/python-gis-sig>, another
useful resource.

Your particular example is plotting RGB composites derived from Level 1
data, it seems? As I said, if you tell us what you want to do with it, we
may be able to provide more information.

Cheers,

Jose
# -*- coding: utf-8 -*-
#Copyright: J Gomez-Dans <j.gomez-d...@geog.ucl.ac.uk>
#
#2009-10-27
#
#This code is licensed under the terms of the GNU General Public License (GPL),
#version 2 or above; See /usr/share/common-licenses/GPL , or see
#http://www.fsf.org/licensing/licenses/gpl.html

from osgeo import ogr
import pylab
from mpl_toolkits.basemap import Basemap

g = ogr.Open("SouthEast_Asia_7d.shp")
L = g.GetLayer(0)
x=[] ; y=[]
while True:
	feat = L.GetNextFeature()
	if not feat: break
	geom = feat.GetGeometryRef()
	x.append( geom.GetX()) ; y.append( geom.GetY())
m = Basemap( llcrnrlon=108, llcrnrlat=-5, urcrnrlon=120,urcrnrlat=8, projection='merc',\
			lat_ts=0.0,resolution='h')
m.bluemarble()
m.drawcoastlines (linewidth=0.25,color='w')
m.drawcountries(linewidth=0.25,color='w')
m.drawmeridians(pylab.arange(0,360,5))
m.drawparallels(pylab.arange(-90,90,5))
m.drawmapboundary()
(X,Y) = m( x, y )

m.plot ( X, Y , 'rs', ms=7.0, mew=0)
pylab.title("Fires in Borneo in the last 7 days")
pylab.savefig ("Borneo.png")
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to