I read an satellite image, and got the data, lat and lon out of the image and put in an array. The dimension of the lat is (135,90) and lon is also (135,90). The dimension of the data was originally (135,90,4,9,8), which 4 represent the band of the image. After processing( which used a for loop to put all band in a single image), the dimension of data is biw (1215,720), which is (135 x9, 90 x 8). I have a piece of code, which is:
x = lat # dimension (135,90)
y = lon # dimension (135,90)
z = data # dimension ( 1215, 720)
plt.figure()
plt.pcolor(x,y,z)
plt.colorbar()
plt.savefig("proj1.png")
But then it produced a very bad image below:
My friend told me before I should take more points in the lat and lon, so to make it same dimension as data. But don't know how to do it. Is the method he said correct?
解决方案X and Y, if given, specify the (x, y) coordinates of the colored quadrilaterals; the quadrilateral for C[i,j] has corners at:
(X[i, j], Y[i, j]),
(X[i, j+1], Y[i, j+1]),
(X[i+1, j], Y[i+1, j]),
(X[i+1, j+1], Y[i+1, j+1]).
Ideally the dimensions of X and Y should be one greater than those of C; if the dimensions are the same, then the last row and column of C will be ignored.
Yet dimension (or shape) of C is totally different from X and Y. The matplotlib idally want you to prepare (1) X, Y being x and y coordinate of grid point (or corner point), and (2) C being value of the tile surouded by 4 adjacent grid points. so you have shape of x,y being 135 and 90. Then the color should be either 134 by 89, or 135 and 90.
My understanding is that the data for this C is from modis pixels, and you already have them 135x90. So you should specify corner points of those 12150 tiles... Make sense? if you know lat/lon of the center point, you shift them by half distance to left/below, then add one row and column at right/above to create grid points. If you use projected coordinate instead of lat/lon, it's same thing. Or you can forget about these half distance deal and just plug that X and Y you already got (135x90) as is, along with C, which has to be 135x90, in order to use pcolor.
What's the meaning of 9,8 in (135,90,4,9,8)? do you have 9*8 different property at each horizontal grid cell? e.g. vertical layer, different kind of chemical species, or physical property? If so, you have to pick one and make a plot one at a time (i.e., feed only C of 135x90 along with your X and Y). Also, you mentioned that 4 is for "band". If this id color band like RGBK and you want to show that color, then probably pcolor is not good, and you have to look for some other function or something that understands those 4 number. pcolor simply read range of number, then apply scale between min and max then apply color scale from blue to red (or whatever you choose if you do)
EDIT
I grabbed a data set for Level-1B, VISIBLE along with documentation from http://disc.sci.gsfc.nasa.gov/AIRS/data-holdings/by-access-method.
This data set is generated from AIRS level 1A digital numbers (DN), including 4 channels in the 0.4 to 1.0 um region of the spectrum. A day's worth of AIRS data is divided into 240 scenes each of 6 minute duration. For the AIRS visible/near IR measurements, an individual scene contains 135 scanlines with a scanline containing 720 cross-track pixels and 9 along-track pixels; there is a total of 720 x 9 x 135 = 874,800 visible/near-IR pixels per scene.
So easiest would be to get average of 8x9 values for each location, and pick one of four tracks one at a time. Alternatively, since these band corresponds to different colors, as shown in wave length below,
Channel 1: 0.41 um - 0.44 um
Channel 2: 0.58 um - 0.68 um
Channel 3: 0.71 um - 0.92 um
Channel 4: 0.49 um - 0.94 um
you may be used these as RGBK values for pylab's imshow() function's input, maybe. You may not like the coarse resolution of output after spatial averaging. In that case you have to take coordinate of each of (9,8) pixel within each location, somehow. There should be a standard way though, the data is a widely used public data.