0

I have a raster stack (numpy 3d array) of daily MODIS LST quality bands. The quality bands have pixel values that correspond to the quality of the LST data in each pixel. For example, 2 = no data received due to clouds, 3 = possible cloud contamination, 17 = low quality for other reason, etc.

I would like to create a line plot (x axis = proportion of pixels, y axis = day of year) that depicts the proportion of pixels within the MODIS tile that have a given quality value on any day of the year. The line plot would have multiple lines, each representing a value in the quality band. I would like to do this in Python, if possible.

As an example, lets say I have a 2d array, which would represent a MODIS tile for one day, with the following information: [[2,3,0], [17,3,0], [2,2,0]]

For this array I would need to calculate the proportion of pixels that correspond to each value, and then have the output in some form (table or csv file) that I could then plot. I would then repeat this process for each day of the year.

  • What have you tried so far in terms of summing up the values for each layer and plotting, for instance with matplotlib? – Kersten Oct 16 '15 at 7:50
  • @Kersten: thanks, I realized this question was too general and am trying to break down my tasks here: [link]gis.stackexchange.com/questions/167014/… – RyanM Oct 19 '15 at 13:44
1

Using the creation of the summaries from your other question the plotting can be done easily with matplotlib.

Given that the values you are looking for are in val_list and results is a nested list with the portion of values for each MODIS image.

from matplotlib import pyplot as plt
import numpy as np

plt.figure(figsize=(11,7))
for i, val in enumerate(val_list):
    plt.plot(np.array(results)[:,i], label="value %s" % val)
plt.legend(loc="upper right")
plt.show()

Here is how that would look for a time-series of the quality layer of the MOD13Q1 product.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.