jiayuasu commented on code in PR #3108:
URL: https://github.com/apache/sedona/pull/3108#discussion_r3599265932


##########
python/sedona/spark/raster/sample_model.py:
##########
@@ -80,9 +80,9 @@ def as_numpy(self, data_buffer: DataBuffer) -> np.ndarray:
         if self.scanline_stride == self.width and self.pixel_stride == 1:
             # Fast path: no gaps between pixels
             band_arrs = []
-            for bank_index in self.bank_indices:
+            for k, bank_index in enumerate(self.bank_indices):
                 bank_data = data_buffer.bank_data[bank_index]
-                offset = self.band_offsets[bank_index]
+                offset = self.band_offsets[k]

Review Comment:
   Could we calculate the effective start here 
(`data_buffer.offsets[bank_index] + self.band_offsets[k]`) and always slice a 
`width * height` window? I may be missing an invariant, but a component model 
can have a zero band offset with a padded backing bank; then the current branch 
seems to pass the whole bank to `reshape()`. The slow path may need the buffer 
offset too. A zero-offset case in the new test would help confirm it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to