opendatacube / datacube-core

Open Data Cube analyses continental scale Earth Observation data through time
http://www.opendatacube.org
Apache License 2.0
513 stars 177 forks source link

Virtual product warnings (select_unique may have failed) #1203

Open benjimin opened 3 years ago

benjimin commented 3 years ago

VirtualDatasetBag.group verbosely issues "_UserWarning: selectunique may have failed" three times, saying that False is not True, a GeoBox is not None, and None is not a Geometry.

To replicate:

import yaml, datacube.virtual
from datacube.utils.geometry import Geometry, CRS

feat = Geometry({'type': 'Polygon', 'coordinates': (((147.28271484375003, -35.89238773935897), (147.03277587890628, -35.663990911348115), (146.65237426757815, -35.90684930677119), (147.09182739257815, -36.15894422111004), (147.28271484375003, -35.89238773935897)),)}, CRS('EPSG:4326'))

spec = yaml.safe_load("""
       juxtapose:
           - collate:
                  - product: ls5_fc_albers
                    group_by: solar_day
                    measurements: [BS, PV, NPV]
                  - product: ls7_fc_albers
                    group_by: solar_day
                    measurements: [BS, PV, NPV]
                  - product: ls8_fc_albers
                    group_by: solar_day
                    measurements: [BS, PV, NPV]
           - product: wofs_albers
             measurements: [water]
             group_by: solar_day
             fuse_func: digitalearthau.utils.wofs_fuser""") #datacube_wps.processes.wofls_fuser

product = datacube.virtual.construct(**spec)
dc = datacube.Datacube()
bag = product.query(dc, geopolygon=feat, time=("2019-03-05", "2019-07-10"))
print(bag)
box = product.group(bag)
print(box)

Output on dev sandbox (datacube 1.8.5):

<VirtualDatasetBag of 68 datacube datasets>
<VirtualDatasetBox of shape {'time': 17, 'y': 2208, 'x': 2268}>

/env/lib/python3.8/site-packages/datacube/virtual/utils.py:16: UserWarning: select_unique may have failed: GeoBox(Geometry({'type': 'Polygon', 'coordinates': (((146.62349744588062, -35.70273335048077), (146.69355477162244, -36.19687547403131), (147.31908398863132, -36.13696212625085), (147.2461000005716, -35.643186470762565), (146.62349744588062, -35.70273335048077)),)}, CRS('EPSG:4326'))) is not the same as None
  warnings.warn("select_unique may have failed: {} is not the same as {}"
/env/lib/python3.8/site-packages/datacube/virtual/utils.py:16: UserWarning: select_unique may have failed: False is not the same as True
  warnings.warn("select_unique may have failed: {} is not the same as {}"
/env/lib/python3.8/site-packages/datacube/virtual/utils.py:16: UserWarning: select_unique may have failed: None is not the same as Geometry({'type': 'Polygon', 'coordinates': (((147.28271484375003, -35.89238773935897), (147.03277587890628, -35.663990911348115), (146.65237426757815, -35.90684930677119), (147.09182739257815, -36.15894422111004), (147.28271484375003, -35.89238773935897)),)}, CRS('EPSG:4326'))
  warnings.warn("select_unique may have failed: {} is not the same as {}"
benjimin commented 3 years ago

@uchchwhash any thoughts on either this issue or the linked wps issue?