Skip to content

[BUG] Bbox error when filtering by minimum overlap #308

@rzinke

Description

@rzinke

Describe the bug
To plot the spatial extent of my ARIA products, I am attempting to filter out scenes using the "minimum overlap" threshold (-mo option in ariaPlot.py). Doing so causes the error described below, indicating that the productBoundingBox for one or more pairs of dates returns "NoneType". It is worth noting that when I use the -croptounion option, or set the -mo to a smaller value, this error does not appear.

To Reproduce
Steps to reproduce the behavior:

  1. Download

ariaDownload.py -t 48 -b 23.0 55.0 63.0 117.0 -s 20160101 -e 20170101 -nt 4 -v

  1. Command used
    ariaPlot.py -f products/*.nc -b ./AOI/track_048_TibetDii.shp -plottracks -nt 4 --figwidth wide -mo 250000

  2. Error Output
    Traceback (most recent call last):
    File "/opt/miniconda3/envs/ARIA-tools/bin/ariaPlot.py", line 21, in
    main(inps)
    File "/opt/miniconda3/envs/ARIA-tools/lib/python3.10/site-packages/ARIAtools/productPlot.py", line 616, in main
    prods_TOTbbox_metadatalyr, arrshape, proj = merged_productbbox(
    File "/opt/miniconda3/envs/ARIA-tools/lib/python3.10/site-packages/ARIAtools/extractProduct.py", line 482, in merged_productbbox
    prods_bbox=open_shapefile(scene['productBoundingBox'][0], 0, 0)
    File "/opt/miniconda3/envs/ARIA-tools/lib/python3.10/site-packages/ARIAtools/shapefile_util.py", line 34, in open_shapefile
    file_bbox = file_bbox.GetLayerByIndex(lyrind).GetFeature(ftind)
    AttributeError: 'NoneType' object has no attribute 'GetLayerByIndex'

Expected behavior
I would expect the track latitude extents to be plotted, excluding the scenes that overlap the AOI by less than 250,000 km2.

Desktop (please complete the following information):

  • ARIA-tools git tag: commit f7a6340 (HEAD -> dev, ariatools/dev, reject_by_extent)
  • OS: MacOS Big Sur v 11.6.6

Additional context
Might be helpful to see the products being output. To show this, I inserted print('Scene: {:s}'.format(scene['productBoundingBox'][0])) in Line 493 of extractProduct.py, and some print statements to that same for loop in merged_productbbox.

Scene: ./productBoundingBox/20160424_20160331.json
	area: 29065 - rejected
Scene: ./productBoundingBox/20160425_20160401.json
	area: 248618 - rejected
Scene: ./productBoundingBox/20160519_20160424.json
	area: 276831 - OK
Scene: ./productBoundingBox/20160612_20160331.json
	area: 276834 - OK
Scene: ./productBoundingBox/20160612_20160519.json
	area: 276834 - OK
Scene: ./productBoundingBox/20160706_20160401.json
	area: 85656 - rejected
Scene: ./productBoundingBox/20160706_20160424.json
	area: 114020 - rejected
Scene: ./productBoundingBox/20160706_20160612.json
	area: 114020 - rejected
Scene: ./productBoundingBox/20160730_20160425.json
	area: 248392 - rejected
Scene: ./productBoundingBox/20160730_20160519.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160823_20160519.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160823_20160612.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160823_20160706.json
	area: 113892 - rejected
Scene: ./productBoundingBox/20160823_20160730.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160916_20160331.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160916_20160519.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160916_20160612.json
	area: 276610 - OK
Scene: ./productBoundingBox/20160916_20160706.json
	area: 113925 - rejected
Scene: ./productBoundingBox/20160916_20160823.json
	area: 276610 - OK
Scene: ./productBoundingBox/20161015_20160401.json
	area: 43192 - rejected
Scene: ./productBoundingBox/20161015_20160424.json
	area: 29053 - rejected
Scene: ./productBoundingBox/20161015_20160425.json
	area: 43192 - rejected
Scene: ./productBoundingBox/20161015_20160706.json
	area: 71566 - rejected
Scene: ./productBoundingBox/20161015_20160706.json
Traceback (most recent call last):
  File "/opt/miniconda3/envs/ARIA-tools/bin/ariaPlot.py", line 21, in <module>
    main(inps)
  File "/opt/miniconda3/envs/ARIA-tools/lib/python3.10/site-packages/ARIAtools/productPlot.py", line 616, in main
    prods_TOTbbox_metadatalyr, arrshape, proj = merged_productbbox(
  File "/opt/miniconda3/envs/ARIA-tools/lib/python3.10/site-packages/ARIAtools/extractProduct.py", line 494, in merged_productbbox
    prods_bbox=open_shapefile(scene['productBoundingBox'][0], 0, 0)
  File "/opt/miniconda3/envs/ARIA-tools/lib/python3.10/site-packages/ARIAtools/shapefile_util.py", line 34, in open_shapefile
    file_bbox = file_bbox.GetLayerByIndex(lyrind).GetFeature(ftind)
AttributeError: 'NoneType' object has no attribute 'GetLayerByIndex'

It's odd that the pair 20161015_20160706 appears twice.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions