I'm trying to plot only the points that have integer values to them. I know that "dh" has nan values for many iterations of the loop, but I have also confirmed that it has real values at points. How can I get it to plot only the real values. Everything I've tried either seems to make "if dh == True:" seems to pass through the nan values, to the print statement for dh_list, or I'm left with it being empty and it doesn't even enter the if statement loop although there should be values.
Here is my code:
dh_list = list()
#dh = list()
dh_x = list()
dh_y = list()
for (x, y, icesat2_h,) in zip(x_list, y_list, height_list):
dem_h = raster.sampleRasterAtPoint(dem, gt_dem, x, y) #RasterAtPoint takes DEM at points X and Y and gives info for those.
dh = icesat2_h-dem_h #calculating icesat2_h minus elevation from DEM_h and get difference
if dh == True:
dh1 = dh
dh_list.extend([dh1])
print('dh_list1', dh_list)
dh_x.extend([x])
#print('dh_x', dh_x)
dh_y.extend([y])
m.scatter(dh_x, dh_y, \
c=dh_list, \
vmin=-150., vmax=0., cmap=cmap_dh, zorder=10)
The dem_h line is where the nan's come from, but it does give values as well on different loop runs, that simply gives me a single value, which I know is working. I know dh has values at times. I've taken a look at .notnull and ~dh.isnull() to no success.
Aucun commentaire:
Enregistrer un commentaire