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

James T. Potemra jimp at hawaii.edu
Fri Jun 20 14:39:36 EDT 2014


Yaqian,

I think you need to specify all ranges for each file since the grids are 
different.  You only define the lat/lon based on the first file 
(GIMMS).  To be safe you should set the lat/lon/z/t for each data set.  
So, add the 'set lat 13 20' and 'set lon -15 20' after 'set dfile 2' to 
ensure your two grids are the same.

Jim

On 6/20/14 3:48 AM, Yaqian He wrote:
> 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 
> <http://ndvi0.5deg.2006.nc>'
> 'sdfopen /Users/geog493/ndvi/ndvi0.5deg_modis_westafrica.nc 
> <http://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
>
>
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20140620/f7419945/attachment.html 


More information about the gradsusr mailing list