Write 3dimensional array as bsq-file without using ENVI Methods [message #91713] |
Fri, 14 August 2015 01:22  |
Ina
Messages: 2 Registered: August 2015
|
Junior Member |
|
|
Hey guys,
I have to replace all ENVI-Methods in my IDL-Code. Actually I am trying to write several 2- and 3-dimensional integer- and float-arrays as bsq-files without using ENVI-Methods such as "ENVI_WRITE_ENVI_FILE". More precisely the file type should be "ENVI Classification", "ENVI Standard" or "ENVI Spectral Library", if it is possible. Is there a way to do this? Thanks in advance.
Actually my IDL Code (including the ENVI Method: ENVI_WRITE_ENVI_FILE) is looking like this:
> mask_unclassified_urban = intarr(no_columnsX_org, no_linesY_org)
>
> file_type_standard = ENVI_FILE_TYPE('ENVI Standard')
>
> ENVI_WRITE_ENVI_FILE, mask_unclassified_urban, file_type = file_type_standard, map_info=map_info_output, out_name=out_name_unclassified_mask_urban
|
|
|
|
|
Re: Write 3dimensional array as bsq-file without using ENVI Methods [message #91731 is a reply to message #91730] |
Mon, 17 August 2015 01:41  |
Yngvar Larsen
Messages: 134 Registered: January 2010
|
Senior Member |
|
|
On Monday, 17 August 2015 09:52:46 UTC+2, jil...@googlemail.com wrote:
> Hi thanks for your suggestion. However, I need bsq-files as output... is there no possibility for that? I have both licences, ENVI and IDL but it should run without opening ENVI, so that is applicable without ENVI and therefore everywhere... :/.
> best regards,
> Ina
To write the binary (bsq) file itself is no problem. Just make sure that your array has the band dimension last (using TRANSPOSE if necessary), and write to disk:
A = fltarr(npixels, nlines, nbands)
openw, unit, 'myfile.bsq', /get_lun
writeu, unit, A
free_lun, unit
However, you must write code to dump the corresponding ENVI header file yourself. In simple cases this is rather easy, but a general solution is a lot of work.
--
Yngvar
|
|
|