stevenpawley / Pyspatialml

Machine learning modelling for spatial data
GNU General Public License v3.0
145 stars 29 forks source link

AxisError: axis 1 is out of bounds for array of dimension 0 #14

Closed tanghailong0214 closed 4 years ago

tanghailong0214 commented 4 years ago

Hi, Steve I have a shapefile with multiple points and a tiff image with 10 bands, I wanted to extract the pixel values from each point for training and testing using Pyspatialml, but i am getting an error, AxisError: axis 1 is out of bounds for array of dimension 0. img_fp = r'.........\file.tif' stack = Raster(img_fp) shapefile = r'.........\file.shp' training_py = geopandas.read_file(shapefile) df_polygons = stack.extract_vector(response=training_py, columns='waterClass',return_array=True) x_text= np.array(df_polygons[0]) y_text= np.array(df_polygons[1])

Can you offer some suggestion. Thank you!

tanghailong0214 commented 4 years ago

When i do "stack.predict",i get an eror ValueError: Input contains NaN, infinity or a value too large for dtype('float32'). How can i ignore the NaN