The error message you're encountering indicates that the level value you specified for the SWT (Stationary Wavelet Transform) is too high for the given data size and start level.
In your code snippet, you set `level=2` when calling `pywt.swt`, which means you are attempting to perform the SWT with a level of 2. However, the error suggests that the maximum level allowed for your data size and start level is 1.
To resolve this issue, you can either decrease the level value or adjust the start level. Here are a couple of possible solutions:
1. Reduce the level value:
```python
temp = pywt.swt(twoD_hsi_data[i, :], db1, level=1, axis=-1)
```
By setting `level=1`, you perform the SWT with a level of 1, which is within the allowed range.
2. Adjust the start level:
```python
temp = pywt.swt(twoD_hsi_data[i, :], db1, level=2, start_level=0, axis=-1)
```
Here, you keep the `level=2` but set `start_level=0` to start the SWT from level 0. This allows you to go up to level 1 within the allowed range.
Choose the approach that suits your requirements and the nature of your data.
Note: Keep in mind that the maximum level for the SWT is determined by the size of the data. If you need to go beyond the maximum level, you might need to downsample or resize your data to accommodate the desired level.
I hope this helps! Let me know if you have any further questions.