[gradsusr] Fwd: How to calculate the difference between two NDVI datasets

Yaqian He yahe at mix.wvu.edu
Fri Jun 20 09:48:06 EDT 2014


Hi,

   I want to calculate the average seasonal (Dec to Feb) mean difference
between GIMMS and MODIS NDVI, here is script I wrote:

'reinit'
*gimms
'sdfopen /Users/geog493/ndvi/ndvi0.5deg.2006.nc'
'sdfopen /Users/geog493/ndvi/ndvi0.5deg_modis_westafrica.nc'
'set lat 13 20.0'
'set lon -15.0 20.0'
* DJF
'define gy01=ave(ndvi.1,t=467,t=472)'
'define gy02=ave(ndvi.1,t=491,t=496)'
'define gy03=ave(ndvi.1,t=515,t=520)'
'define gy04=ave(ndvi.1,t=539,t=544)'
'define gy05=ave(ndvi.1,t=563,t=568)'
'define gy06=ave(ndvi.1,t=587,t=592)'
'define gyclim=(gy01+gy02+gy03+gy04+gy05+gy06)/6.'
*'modis ndvi'
'set dfile 2'
'set t 1 307'
* DJF
'define my01=ave(ndvi.2,t=15,t=20)'
'define my02=ave(ndvi.2,t=38,t=43)'
'define my03=ave(ndvi.2,t=61,t=66)'
'define my04=ave(ndvi.2,t=84,t=89)'
'define my05=ave(ndvi.2,t=107,t=112)'
'define my06=ave(ndvi.2,t=130,t=135)'
'define myclim=(my01+my02+my03+my04+my05+my06)/6.'
'define difyclim=gyclim-myclim'
'd gyclim-myclim'

However, it always shows the error "Error in gagchk: axis sizes are not the
same
Operation error:  Incompatable grids"

The two datasets have the same resolution (0.5X0.5), the original
information for the two datasets are:
modis
xdef 81 linear -20 0.5
ydef 81 linear 0 0.5
gimms
xdef 720 linear -179.75 0.5
ydef 304 linear -61.75 0.5
 Are there something wrong here? Could you help me?

Thanks in advance!

Best wishes!
Yaqian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140620/41aaef7b/attachment.html 


More information about the gradsusr mailing list