comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Spatial and temporal image correlation
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Spatial and temporal image correlation [message #85546 is a reply to message #85543] Thu, 15 August 2013 10:48 Go to previous messageGo to previous message
Andy Sayer is currently offline  Andy Sayer
Messages: 127
Registered: February 2009
Senior Member
Looks like a good start!

I use file_search instead of findfile and believe file_search is considered preferable for some reason, although forget what it actually is. Note you don't need the CD command and could do e.g. thesefiles=file_search('C:\anomalies\year\*.dat',count=numfi les) instead.

Are you trying to do a spatial correlation or a temporal correlation? If spatial (e.g. correlate NDVI and SST anomalies for June 2003) then you can pass the 2D array containing your data to correlate(), you don't need to reform() it to a 1D array first.

You will also want to modify your loop a bit. As written, the variable 'file' will be redefined and overwritten each time and the contents lost. So for example you might want to define ndvi=fltarr(nyears,nmonths,620,500) and then loop over years and months to populate the appropriate part of the array (and ditto for SST and your other variables). Also, (I think) you'll want to close,lun before free_lun,lun .

Hope this helps,

Andy

On Thursday, August 15, 2013 12:19:01 PM UTC-4, Cornelio Zolin wrote:
> Dear all,
>
> Hi all,
>
> I have just started using IDL and I’m having hard times even with simple tasks. I’m trying to do the following task:
>
>
>
> I have 12 folders (2001, 2002 ….2012) and in each folder I have 35 files .dat of anomalies (7 months NDVI, 7 months Surface temperature and so on) and I would like to do a correlation (pixel by pixel) for each index in each month for each year.
>
>
>
> After that I want to make one plot per year: each index in a different column and each row representing a different month.
>
>
>
> I started writing the code bellow, but I’m confused now. I think the next step would be REFORM the images, so for each image I will have a vector that I could use to do the correlation.
>
> Is there anyone that could help me on that?
>
>
>
> Thanks a lot,
>
>
>
>
>
> PRO ImgCorr,
>
> CD, 'C:\Anomalies\year'
>
> theseFiles = FindFile('*.dat', Count=numFiles)
>
> Print, 'Number of files found: ', numFiles
>
> FOR j=0,numFiles-1 DO BEGIN
>
> OpenR, lun, theseFiles(j), /Get_Lun
>
> File = fltarr(620, 500)
>
> ReadU, lun, File
>
> JustNumbers= where(File eq -9999, count)
>
> File[JustNumbers]=!VALUES.F_NAN
>
> *
>
> *
>
> *
>
> *
>
> Free_Lun, lun
>
> ENDFOR
>
> END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL routines for Rayleigh optical depth/US Standard Atmospheres?
Next Topic: Map issue wth IDL8 new graphics: conformal or equal-area maps in rectangular shape

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:03:42 PDT 2025

Total time taken to generate the page: 0.00418 seconds