# Trying to merge S (VNIR) and L (IR) into one single cube image

## Recommended Posts

Hello There,

I'm trying to merge the S (VNIR) and L (IR) into one single cube as discussed in the topic "Complete Near-infrared Spectrum" in the forum.
I go along with the following steps:

1- Download the CTX covers the S/L cubes area in ODE (using Geotiff format CTX product).
2- In CAT, do map projection for both S and L cubes.
3- Register map projected S and L cubes to the CTX product by using "Image Registration Workflow".
4- Rename the attached SL_alignment_v5.txt to  SL_alignment_v5.pro and open it in IDL,  In IDL interface, click "Run', it will ask you select L cubes (results from step 3) , then select S cubes (results from step 3) and output the merged data.

However, the code stops running and the following error has occurred:

% Execution halted at: REVERSE_RASTER_BANDS  144 C:\Users\Rochdi Khalid\Desktop\in_progress\ritchey_analysis\draft\SL_alignment_v5.pro
%                      SL_ALIGNMENT_V5    50 C:\Users\Rochdi Khalid\Desktop\in_progress\ritchey_analysis\draft\SL_alignment_v5.pro
%                      $MAIN$

You help is much appreciated,

Best.

##### Share on other sites

After separately registering the S and L mapped data to the CTX data I would use New File Builder under Raster Management to make an S, L combined mapped cube.

Ray

##### Share on other sites

I followed your instructions, but the following error has occurred:
file: l_warped.dat
Problem: Dimensions for this file: (2952 x 2358) are inconsistent with previous file (2984 x 2366)

##### Share on other sites

No need to run IDL directly. Just launch the New File Builder under Raster Management tool bar to combine the two cubes.

Ray

##### Share on other sites

Absolutely, I launched the process with "New File Builder" under "Raster Management", but the same error has occurred once I added the second cube (as been below).

Any help?

##### Share on other sites

Hello there,

Please any help concerning my question? I'm trying to dedug the errors occurred in the code above but nothing seems to work as well as "New File Builder" and layer stacking tools. The first requires to have files that share the same size, and second tool gives inconvenient results.

##### Share on other sites

You must join files of the same size, in terms of lines and samples. Subset the larger file using the smaller file to generate a mask of for the smaller size and then use the mask to subset the larger file to fit the size of the smaller file. Then use New File Builder. Read the instructions on doing New File Builder and you will see where you went astray. Rochdi, as before in our many emails, may I suggest that you need to read the documentation before embarking on a new process.

Ray

##### Share on other sites

Hello Sir,

Please I don't clearly understand your instructions above, I read about "New File Builder" from I3harrisgeospatial.com, but it doesn't include what you mentioned, they give only instructions about files of the same size.

Rochdi.

##### Share on other sites

You need files of the same size to do New File Builder. Read up on making and using masks to subset another data set.

Ray