stacking the images according to julian date [message #85594] |
Tue, 20 August 2013 13:10  |
ansul
Messages: 1 Registered: August 2013
|
Junior Member |
|
|
Hello all,
I am a newbie in IDL and thought I might get some information here.
I need to do a time series analysis with landsat images (almost 500 images). I need to stack the image according to the julian dates. So I have 500 images in a folder which are named lndsr.LT50140331989278XXX01. In this naming format the Julian date starts from the 20th position to 22nd position. And I need to use this information to stack the image.
All your help will be much appreciated.
Thanks
|
|
|
Re: stacking the images according to julian date [message #85595 is a reply to message #85594] |
Tue, 20 August 2013 13:27   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
ansul writes:
> I am a newbie in IDL and thought I might get some information here.
>
> I need to do a time series analysis with landsat images (almost 500 images). I need to stack the image according to the julian dates. So I have 500 images in a folder which are named lndsr.LT50140331989278XXX01. In this naming format the Julian date starts from the 20th position to 22nd position. And I need to use this information to stack the image.
>
> All your help will be much appreciated.
filenames = File_Search("lndsr.*", COUNT=count)
juldates = DblArr(count)
; Parse the filename for the Julian date.
FOR j=0,count-1 DO BEGIN
thisFile = filenames[j]
year = Fix(StrMid(thisFile, 15, 4))
doy = Fix(StrMid(thisFile, 19, 3))
juldates[j] = JulDay(1, doy, year)
ENDFOR
; Sort the Julian dates.
sorted = Sort(juldates)
; Sort the filenames in the right order for stacking.
filenames = filenames[sorted]
I don't think you REALLY want to stack these images, but now you have
them in the right order, in case you want to process them in the right
order.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: stacking the images according to julian date [message #85596 is a reply to message #85595] |
Tue, 20 August 2013 14:02   |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
And to be an annoying kibbutzer-- I believe this can also be done without loops:
filenames = File_Search("lndsr.*", COUNT=count)
year = Fix(StrMid(filenames,15,4))
doy = Fix(StrMid(filenames,19,3))
juldates = JulDay(1,doy, year)
; Sort the Julian dates.
sorted = Sort(juldates)
; Sort the filenames in the right order for stacking.
filenames = filenames[sorted]
On Tuesday, August 20, 2013 4:27:24 PM UTC-4, David Fanning wrote:
>>
>
>> All your help will be much appreciated.
>
>
>
> filenames = File_Search("lndsr.*", COUNT=count)
>
> juldates = DblArr(count)
>
>
>
> ; Parse the filename for the Julian date.
>
> FOR j=0,count-1 DO BEGIN
>
> thisFile = filenames[j]
>
> year = Fix(StrMid(thisFile, 15, 4))
>
> doy = Fix(StrMid(thisFile, 19, 3))
>
> juldates[j] = JulDay(1, doy, year)
>
> ENDFOR
>
>
>
> ; Sort the Julian dates.
>
> sorted = Sort(juldates)
>
>
>
> ; Sort the filenames in the right order for stacking.
>
> filenames = filenames[sorted]
>
>
>
> I don't think you REALLY want to stack these images, but now you have
>
> them in the right order, in case you want to process them in the right
>
> order.
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|
Re: stacking the images according to julian date [message #85597 is a reply to message #85596] |
Tue, 20 August 2013 14:17  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Wayne Landsman writes:
> And to be an annoying kibbutzer-- I believe this can also be done without loops:
>
> filenames = File_Search("lndsr.*", COUNT=count)
> year = Fix(StrMid(filenames,15,4))
> doy = Fix(StrMid(filenames,19,3))
> juldates = JulDay(1,doy, year)
>
> ; Sort the Julian dates.
> sorted = Sort(juldates)
>
> ; Sort the filenames in the right order for stacking.
>
> filenames = filenames[sorted]
Even better, if harder for a newby to understand! ;-)
Cheers,
David
P.S. It's even hard for old guys to understand. I almost always have to
read your article on STRMID to understand how it works on arrays.
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|