20 Jan 2016 12:40 PM |
|
I have an error while trying to change the output of the mosaic_doit function to a tiff file. It out puts a dat file which is not working with various python functions I need it to. This is the approach I took right now. envi_doit exports out a .dat file. Let me know if there is any other way or if there is something else that I can do to fix this.
envi_doit, 'mosaic_doit', fid=mfid, pos=mpos, $ dims=mdims, out_name=out_name, xsize=xsize, $ ysize=ysize, x0=x0, y0=y0, georef=0,MAP_INFO=map_info, $ out_dt=Data_Type, pixel_size=pixel_size, $ background=0, see_through_val=see_through_val, $ use_see_through=use_see_through envi_output_to_external_format, DIMS= 0, fid = mfid, out_name = "E:\Abhi\desktop\testing\Small script testing\rasters\raster.tif",tiff = tiff
|
|
|
|
MariM Veteran Member
Posts:2396  
20 Jan 2016 01:42 PM |
|
MOSAIC_DOIT will only output to ENVI format (.dat) files. You need to use the returned fid from this routine (r_fid) to pass to ENVI_OUTPUT_TO_EXTERNAL_FORMAT with the /TIFF keyword. For example:
envi_output_to_external_format, DIMS=dims, fid = r_fid, out_name = "E:\Abhi\desktop\testing\Small script testing\rasters\raster.tif", /tiff
It also looks like the DIMS are set to 0 when converting to TIFF. The dims should be the dims returned from the mosaic result. You can do a file query on the result (using the r_fid returned from mosaic_doit) to get the DIMS of the new file in case the dimensions have changed from the original input files of the mosaic.
|
|
|
|
Deleted User New Member
Posts:  
21 Jan 2016 08:18 AM |
|
Thanks for the reply, I tried changing it to this:
envi_doit, 'mosaic_doit', fid=mfid, pos=mpos, $
dims=mdims, out_name=out_name, xsize=xsize, $
ysize=ysize, x0=x0, y0=y0, georef=0,MAP_INFO=map_info, $
out_dt=Data_Type, pixel_size=pixel_size, $
background=0, see_through_val=see_through_val, $
use_see_through=use_see_through, R_fid = R_fid
outtif= strmid(outfile, 0,19)
outtif = outtif + 'tif'
output = "E:\Abhi\desktop\testing\Small script testing\rasters\" + outtif
envi_file_query, fid = R_fid, dims = TDim
envi_output_to_external_format, dims= TDim, fid = R_fid, out_name = output,/tiff
This does not work though, What am I doing wrong?
|
|
|
|
MariM Veteran Member
Posts:2396  
21 Jan 2016 11:34 AM |
|
Do you get an error compiling? Is it failing in the mosaic or the TIFF output?
The syntax for ENVI_FILE_QUERY is to pass the fid as a parameter and not a keyword. For example:
envi_file_query, r_fid, dims=r_dims
|
|
|
|
Deleted User New Member
Posts:  
21 Jan 2016 01:12 PM |
|
It is not failing anymore, instead it is creating a tif that is only 1kb large.
Here is the updated script:
envi_doit, 'mosaic_doit', fid=mfid, pos=mpos, $
dims=mdims, out_name=out_name, xsize=xsize, $
ysize=ysize, x0=x0, y0=y0, georef=0,MAP_INFO=map_info, $
out_dt=Data_Type, pixel_size=pixel_size, $
background=0, see_through_val=see_through_val, $
use_see_through=use_see_through, R_fid = R_fid
outtif = strmid(outfile, 0,19) ;+ '.tif'
outtif = outtif + '.tif'
output = "E:\Abhi\desktop\testing\Small script testing\rasters\" + outtif
envi_file_query, R_fid, dims = r_dim
envi_output_to_external_format, dims= r_dim, fid = R_fid, out_name = output,/tiff
|
|
|
|
MariM Veteran Member
Posts:2396  
21 Jan 2016 01:56 PM |
|
It is unlikely that it is the conversion to TIFF that is the issue.
Is the mosaic image correct? What is the size of the ENVI file it creates?
|
|
|
|
Deleted User New Member
Posts:  
22 Jan 2016 01:42 PM |
|
The .dat files are all 8mbs each and load perfectly well in ENVI. I must be doing something wrong in the two lines below the Mosiac function
|
|
|
|