You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There seems to be a diagonal ~ half-pixel shift between the DEM.show() displays and the DEM.value_at_coord() output.
To Reproduce import xdem img = xdem.DEM(gu.examples.get_path('everest_landsat_b4')) target_x, target_y = 486811, 3097050 # example of coordinate fig,ax=plt.subplots(1,1) img.show(vmin=50, vmax=200, ax=ax) ax.set_xlim(target_x-60,target_x+60); ax.set_ylim(target_y-60,target_y+60) # zoom on the area ax.scatter(target_x, target_y,c='r') # plot the desired coordinate on the image plot ax.set_title('at ({}, {}), dem.value_at_coords={}'.format(target_x, target_y, np.round(img.value_at_coords(target_x, target_y), 2))) # prints as figure title the value returned by value_at_coords() ax.plot([486805, 486805, 486805+30, 486805+30, 486805],[3097056,3097056-30, 3097056-30, 3097056, 3097056]) # if coord falls in this blue polygon ax.plot([486820, 486820, 486820+30, 486820+30, 486820],[3097040,3097040-30, 3097040-30, 3097040, 3097040]) # it returns the value of this orange one
Expected behavior
The value_at_coord() value does not return same value as the plot most of the time, I expect that the value_at_coords() (169 in the example, value of the orange box pixel) matches the show() pixels (131 in the example, under the red point).
System (please complete the following information):
Describe the bug
There seems to be a diagonal ~ half-pixel shift between the DEM.show() displays and the DEM.value_at_coord() output.
To Reproduce
import xdem
img = xdem.DEM(gu.examples.get_path('everest_landsat_b4'))
target_x, target_y = 486811, 3097050 # example of coordinate
fig,ax=plt.subplots(1,1)
img.show(vmin=50, vmax=200, ax=ax)
ax.set_xlim(target_x-60,target_x+60); ax.set_ylim(target_y-60,target_y+60) # zoom on the area
ax.scatter(target_x, target_y,c='r') # plot the desired coordinate on the image plot
ax.set_title('at ({}, {}), dem.value_at_coords={}'.format(target_x, target_y, np.round(img.value_at_coords(target_x, target_y), 2))) # prints as figure title the value returned by value_at_coords()
ax.plot([486805, 486805, 486805+30, 486805+30, 486805],[3097056,3097056-30, 3097056-30, 3097056, 3097056]) # if coord falls in this blue polygon
ax.plot([486820, 486820, 486820+30, 486820+30, 486820],[3097040,3097040-30, 3097040-30, 3097040, 3097040]) # it returns the value of this orange one
Expected behavior
The value_at_coord() value does not return same value as the plot most of the time, I expect that the value_at_coords() (169 in the example, value of the orange box pixel) matches the show() pixels (131 in the example, under the red point).
System (please complete the following information):
The text was updated successfully, but these errors were encountered: