0

I am working on hyperspectral satellite imagery and I am trying to implement SAM algorithm on my dataset.I am trying to use spectral_angle and msam functions which are available in spectral python library. I am using following commands. Dataset after preprocessing has dimensions (2000,2000,20)

signature=image_cube[300,500,:] mmn=spectral_angles(image_cube,signature.reshape(1,20))

I am getting an numpy array containing all values 'Nan'.

KHIZER
  • 21
  • 4

1 Answers1

0

You apparently have NaN values in your data. Assuming image_cube, try this:

image_cube[np.isnan(image_cube)] = 0
signature=image_cube[300,500,:]
mmn=spectral_angles(image_cube,signature.reshape(1,20))

Depending on the data type of image_cube, you may have to convert it to a floating point type first. Also, you can replace the zero with whatever floating point value you like (e.g., the mean spectrum).

bogatron
  • 18,639
  • 6
  • 53
  • 47