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

Home » Public Forums » archive » Re: newbie question.. again :)
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: newbie question.. again :) [message #35745 is a reply to message #35742] Wed, 09 July 2003 20:24 Go to previous messageGo to previous message
Timm Weitkamp is currently offline  Timm Weitkamp
Messages: 66
Registered: August 2002
Member
Alex,

What follows below may or may not run like this (it should, but it's sort
of late here now). But I hope it helps anyway.

Timm

<http://people.web.psi.ch/weitkamp>


storeDir = 'g:\goes9_processed\btcloudfree\subtraction'
cd, storeDir
files02=findfile('*2.tiff', count=num02files)

; You want one single output .csv file, right? So you'll have to open it
; *outside* the loop that goes over the images

outfilename = 'g:\test\out.csv'
openw, uOut, /get_lun

; Now loop over all the Tiffs, and every time write one more line
; to the output file

for y = 0, num02files-1 do begin

; Read your TIFF image in a 2D array

tiff = read_tiff(files02[y])

; Extract a 5x5 region of interest

radianceValues = tiff[145:145+4, 180:180+4]

; Calculate moments

stats = MOMENT(radianceValues)

; Concatenate 5x5 image data and moments
; into one single 1D array. This will be
; the line to write to the .csv file.

outValues = [radiancevalues[*], stats]

; How many numbers are there in that line?
; (need this information for the format code)

nVal = N_ELEMENTS(outValues)
formStr = '(' + STRTRIM(nVal,2) + '(F1, :,", "))'

fileLine = STRING(outValues, FORMAT=formStr)
printf, uOut, fileLine

endfor

free_lun, uOut



On 09.07.03 at 14:12 -0700, Alexandra Panton wrote:

> hey thanks for replying:) i didn't post my code 'cos its a bit on the
> messy side bare in mind i have only been using this for about 2 weeks
> ! I re read my post hmm, I have like 91 files, I want to extract the
> same 5 by 5 area on each image. Put this all into one row (this is
> cool can do this) what i can't do is get say, image2 to go into row 2
> .. if that makes sense? .csv or anything really just want to be able
> to export it to something evil like a spreadsheet :)
>
> here goes ....
>
> store=('g:\goes9_processed\btcloudfree\subtraction')
> outstore=('g:\test')
> cd, store
> y=3
> x=1
> files02=findfile('*2.tiff', count=num02files)
> print, num02files
>
>
> while(num02files gt y) do begin
> cd, store
> InfileName02=files02(y)
> print, Infilename02
> ok=query_tiff(Infilename02) ;checks to see if the tiff file exists
>
> if (ok eq 1) then begin
>
> tiffread=read_tiff(Infilename02) ; reads tiff
> storage_array=make_array(25,y ,/byte) ;my array that i want to
> write to
> radiancevalues=extrac(tiffread,145,180,5,5) ;extracts a 5 by 5
> array from the coordinates given
> radiancevalues=rebin(radiancevalues,25,1) ;puts it all on one line
> len02=strlen(InfileName02)
> striptext02=strmid(Infilename02,0,len02-7)
> stats=moment(radiancevalues)
> outname=striptext02+'test'+'.csv' ;configures the output filename
> storage_array=radiancevalues[*] ;*trying* to get radiance values
> into one array but can't get it to work *sighs*
> cd, outstore
> openw,1,outname, width=2000 ;opens outputfile
>
> for i=0,num02files-1 do begin
> printf,1,storage_array,stats, format='(25(f,","),f)'
> endfor
> close,1
> free_lun,1
> ;endfor
>
> endif else begin
> print, 'no matching file name found in directory'
> endelse
>
> y=y+1
> endwhile
>
> end
>
> ..and google groups messed up my format something chronic, my
> apologies
>
> cheers for any help you can give
>
> alex
>
>
>
>
>
> Timm Weitkamp <timm.weitkamp@nowhere> wrote in message news:<Pine.LNX.4.44.0307091614210.15330-100000@localhost.localdomain>...
>> Today at 09:31 -0400, Haje Korth wrote:
>>
>>> Alex,
>>> I am not quite sure what you are trying to do and I for sure do not know
>>> what a .csv file is
>>
>> I think a .csv file is a "comma-separated values" Ascii file.
>>
>>> but here is an idea: The area you extravt is a 2-d
>>> array with dimensions xdim and ydim if rectangular. If I understand you
>>> correctly your number of collumns x is xdim*ydim. In order to map the 2d
>>> array into a 1d array, which is one row in your file, you use
>>> 'reform(2d-array,xdim*ydim)'. In order to process all your files you just
>>> loop through them.
>>
>> Or, even simpler (assuming that you want to map a 2D array "a" into a 1D
>> array "b"): b = a[*].
>>
>> Alex: I understand you already wrote some code but it doesn't work as you
>> would like it to. Would you mind posting it and pointing out to us the
>> part where you're stuck?
>>
>> Timm
>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: IDL 6.0 release schedule
Next Topic: UNIX v. Windows Filepaths

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

Current Time: Sat Oct 11 00:57:20 PDT 2025

Total time taken to generate the page: 1.43689 seconds