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

Home » Public Forums » archive » ENVI_WRITE_ENVI_FILE will not write header file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
ENVI_WRITE_ENVI_FILE will not write header file [message #84397] Mon, 03 June 2013 17:49 Go to previous message
Oana Coman is currently offline  Oana Coman
Messages: 27
Registered: December 2011
Junior Member
I have sat here for hours trying to figure out this seemingly simple task of writing out an envi file, but this procedure refuses to write a header file for my image.

I took all the code I wrote and just shortened it to these few lines:

startFile = 'file.img'
ENVI_OPEN_FILE, startFile, R_FID=combined, NO_REALIZE=1
if (combined eq -1) then begin
PRINTERROR,2,'Failed to open' + inTRR
return
endif
ENVI_FILE_QUERY, combined, ns=ns, nl=nl, nb=nb, data_type=data_type, descrip=descrip, bnames=bnames, dims=dims
projection = ENVI_GET_PROJECTION(FID=combined, pixel_size=ps, units=units)

combinedImage = fltarr(ns,nl,nb)
for b=0,nb-1,1 do begin
combinedImage[*,*,b] = ENVI_GET_DATA(fid=combined, dims=dims, pos=b)
endfor

out = 'out.img'
ENVI_WRITE_ENVI_FILE, combinedImage, INTERLEAVE=0, MAP_INFO=projection, OUT_NAME=out, NB=nb, NL=nl, NS=ns, OUT_DT=4, OFFSET=0, OUT_NAME=out, PIXEL_SIZE=ps

Then I basically want to resize some other input images, add them to this 'combined image', and output it back out, keeping the same projection/header information as the original combinedImage file (though I'm not even worried about doing the resizing/addition right now). I just want to output the file.

Seems simple enough. Not working though! I get no header when I output.

Then I tried to make my own header file using:
ENVI_SETUP_HEAD, FNAME=out,INTERLEAVE=0, DATA_TYPE=4, MAP_INFO=projection, NB=nb, NL=nl, NS=ns, OFFSET=0, PIXEL_SIZE=ps, units=units, /WRITE

and I get the error 'Tag name O_RPC is undefined for structure ENVI_PROJ_STRUCT.'
I have no idea what that is.

When I print my projection information, this is what I get:
{ Mars Equirectangular Default 17 3396190.0 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000 0.00000000
0 D_Unknown 0 80398784
PROJCS["Mars Equirectangular Default",GEOGCS["GCS_Unknown",DATUM["D_Unknown",SPHEROID[ "S_Unknown",3396190.0,0.0]],PRIMEM["Greenwich",0.0],UNIT[ "Degree",0.0174532925199433]],PROJECTION["Equidistant_Cylindrical "],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing ",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1 ",0.0],UNIT["Meter",1.0]]
0}
That's the projection I've been using all along to run various procedures on my images, and they've been working fine.

Does anyone have any idea why IDL is not wanting to output my header information?
Thanks guys.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: reading multiple FITS files from a directory
Next Topic: A small feature I would love to have for IDL NG

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

Current Time: Wed Oct 08 15:05:36 PDT 2025

Total time taken to generate the page: 0.28883 seconds