Purpose: gradual exposure to Python programming, using pre-written objects, to access fire data for use as input in the FLEXPART modeling environment
These exercises utilise data and programs that have been pre-packaged for this course. In the following,
<path to course>
refers to the path
/home/kurs/donmor/CourseFiles/
For this (and most of the following) exercise, you should create a working directory in your $HOME filesystem. Then, copy the FIRMS.py module into it:
<path to course>/WorkingSystem/FIRMS.py
In the same directory, using the following program as guidance, create a simple Python program that retrieves, lists and plots fire data from the following FIRMS file (it's one that I downloaded before the course):
<path to course>/center/w/morton/ZAMGCourse2013/LabExerciseData/FIRMS/FIRMS-Europe_24h-20130404.csv
#!/usr/bin/env python
import FIRMS
# European source data
EU_SOURCE_DATA = 'http://firms.modaps.eosdis.nasa.gov/active_fire/text/Europe_24h.csv'
# Alaskan source data
AK_SOURCE_DATA = 'http://firms.modaps.eosdis.nasa.gov/active_fire/text/Alaska_24h.csv'
# Instantiate an object with Europe fire data - this will automatically go
# to the source, retrieve, and store the data
EUDat = FIRMS.FIRMS(EU_SOURCE_DATA)
# Instantiate an object with Alaska fire data
AlaskaDat = FIRMS.FIRMS(AK_SOURCE_DATA)
# Print the full listing of the Alaska data
AlaskaDat.printFullListing()
# Create a bounding box (lower left and upper right corners) for EU region
llLat = 40.0; llLon = 0.0; urLat = 55.0; urLon = 20.0
# Store this in a tuple (LL_LAT, LL_LON, UR_LAT, UR_LON)
boundingBox = (llLat, llLon, urLat, urLon)
# Set region, then print listing
EUDat.setRegion(boundingBox)
EUDat.printRegionalListing()
# Plot the region
EUDat.plotRegion('EUFires.png')
Once this is working, go to the FIRMS website (Look for the "Download Data" section and Text link)
https://earthdata.nasa.gov/data/near-real-time-data/firms
and choose your own area of interest. You might want to go to the web mapper first to make sure there is data in your area of interest. Modify your program to ingest and plot the data for your area of interest. Note that if you choose an area with lots of data, it will take longer to run your plotting routine.
Finally, as an exercise in coding, note that the only information you currently see on the plots is s circle that marks a data point, but there is no additional information. It would be a little more interesting if the plot had colour-coded circles to indicate the magnitude (or FRP) of the data, and/or the circle size varied in proportion to the FRP. Try to modify the method plotRegion() to do this.
References you might want for this:
http://matplotlib.org/basemap/users/examples.html - this won't be very helpful, but is a good, authoritative basemap reference. It will likely lead you to the following reference, with more information on the plot() routine and how you can adjust things like colours and sizes of markers
http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot - don't let it scare you. In your case, all you want to change is the markersize and/or colour. You should focus more on building the if-then-else code in the FIRMS.plotRegion() method that makes this happen.