DigitalGlobe / gbdxtools

(Deprecated) Python SDK for using GBDX
MIT License
74 stars 57 forks source link

window_cover() pad = False setting does not work properly #773

Closed mhansen4 closed 2 years ago

mhansen4 commented 5 years ago

GBDXTools New Issue

Please provide some background information:

GBDX Username

[megan.hansen@digitalglobe.com]

GBDX Account Tier

GBDXTools Version

Run pip show gbdxtools in a terminal or !pip show gbdxtools in a Jupyter notebook cell

[0.16.5 in GBDX Notebooks, 0.16.7 locally]

Python Version

Environment

[ If local, please provide more information about your local Python environment. For example, which Python executable - system or Anaconda? ]

Description

[I am experiencing issues with filtering out padded chips using the window_cover function and its 'pad' parameter.]

Expected behavior:

[I expect to receive chips that have not been padded with black space when I set 'pad' equal to False and try to generate chips.]

Actual behavior:

[When I try to generate chips from a CatalogImage using the window_cover method and set the 'pad' parameter to False, I still get chips from the edge of the CatalogImage that have been padded. According to the docs, if 'pad' is False, chips that have been padded should not be returned.]

Example

cat_id = '103001008513F200'
img = CatalogImage(cat_id)
desired_chip_count = 100
chip_size=(256,256)
chip_count = 0
image_chips = []
dask_chips = []
chip_generator = img.window_cover(chip_size, pad = False)
while chip_count < desired_chip_count:
    chip = next(chip_generator)
    image_chips.append(chip.rgb())
    dask_chips.append(chip)
    chip_count += 1
drwelby commented 5 years ago

So 'padded' means when a chip extends outside of the bounds of the image array, the area outside the array is filled with zeros.

But the edge of the image can have a black collar around it which is also just zeros. So if you see black pixels it could be the collar, or it could be the padding, or a combination of both.

Can you check that the padded tile's bounds are not completely within the image object bounds?

drwelby commented 4 years ago

@mhansen4 is this still a problem?