On Monday, June 3, 2013 8:49:08 PM UTC-4, Kat wrote:
> 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.
Do you have permissions to write where you are trying to write? The error messages (if any) are not helpful if this is the case.
|