X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 29 Jan 2013 11:41 AM by  anon
Converting ASD spectra to ASCII
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
29 Jan 2013 11:41 AM
    Hello, I am currently working on a project where I have to create a routine in order to process 2500 spectra from a field spectrometer. The files provided come in a ASD binary format that ENVI can read. I can import the files, then export them to ascii files (2 columns: wavelength, measure) using the spectral library. However, as they are classed in different folders depending on the study area, I would like to process them in IDL directly. When I try to open them using openw, lun,"P003-WRS.002", /get_lun it works. However, I can not export them to ascii. I have tried several solutions, but none work. I tried a solution given by Ethan Gutmann on his website: IDL> spawn, 'portspec -a' + "P003-WRS.000"+''+$ > '../prairie3/'+"test" This returns: % Type conversion error: Unable to convert given STRING to Long. % Detected at: $MAIN$ % PRINTF: File is not open for output. Unit: 0, File: % Error occurred at: $MAIN$ % Execution halted at: $MAIN$ I get the same error when trying to use printf. Does anyone have an idea to help me get out of this tricky situation (I am relatively new to programming). Cheers,

    Deleted User



    New Member


    Posts:
    New Member


    --
    30 Jan 2013 11:46 AM
    Hi Maxx, What about this?: x=indgen(10) y = x*x openw, lun, 'test.dat', /get_lun for i=0,9 do begin printf, lun, x[i], y[i], format='(i4, i4)' endfor free_lun, lun openw, 1, 'test.dat', /append for i=0,9 do begin printf, 1, x[i]+10, y[i]*2, format='(i4, i4)' endfor close,1 I think this is what you are looking for. Cheers. Fernando
    You are not authorized to post a reply.