Author Topic: ValueError: zero-size array to reduction operation minimum which has no  (Read 13078 times)

Niko Grisel Todorov

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • moi
ValueError: zero-size array to reduction operation minimum which has no identity

Another ValueError run-time error, quite possibly due to Google StreetMap not returning an image in a timely manner; stopped on 2123 out of 10000 requested.

location = 'Gaziantep, TR' 
invGenerator = InventoryGenerator(
    location=location, nbldgs=10000, randomSelection=True,
    GoogleAPIKey="")
invGenerator.generate(attributes=['erabuilt','garage','numstories','buildingheight'])

Can you please catch this (ImHandler.py, line 427) exception with skipping the building instead of crashing?

Here is the full error trace:

Searching for Gaziantep, TR...
Found Gaziantep, Güneydoğu Anadolu Bölgesi, Türkiye

Fetching footprint data for Gaziantep...
Found a total of 302286 building footprints in Gaziantep
Randomly selected 10000 buildings
Found an entry in attributes that was not enabled in InventoryGenerator.
Ignoring entry: occupancy
Traceback (most recent call last):
  File "C:\GitHub\NHERI-GSC-MC-team1\code\startup.py", line 14, in <module>
    # invGenerator.generate(attributes=['occupancy', 'erabuilt', 'garage', 'numstories', 'buildingheight'])
  File "C:\Python310\lib\site-packages\brails\InventoryGenerator.py", line 208, in generate
    image_handler.GetGoogleStreetImage(footprints)
  File "C:\Python310\lib\site-packages\brails\workflow\ImHandler.py", line 697, in GetGoogleStreetImage
    refLine, imagePlane, scale, fov, heading = image_retrieve(fp,'tmp/images/street',count,self.apikey)
  File "C:\Python310\lib\site-packages\brails\workflow\ImHandler.py", line 671, in image_retrieve
    premRefLine = compute_refline(footprint,p1,visibleLineSeg) 
  File "C:\Python310\lib\site-packages\brails\workflow\ImHandler.py", line 427, in compute_refline
    lineFrontal = linesKeep[np.where(linesKeepDist==np.min(linesKeepDist))[0].item(0),:]
  File "<__array_function__ internals>", line 180, in amin
  File "C:\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 2918, in amin
    return _wrapreduction(a, np.minimum, 'min', axis, None, out,
  File "C:\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)

ValueError: zero-size array to reduction operation minimum which has no identity

Process finished with exit code 1

bacetiner

  • Newbie
  • *
  • Posts: 24
    • View Profile
Hi Niko,

Thank you for using the SimCenter Forum, and apologies that this message escaped our attention until today.

A quick look at the error shows that the ImHandler has difficulty extracting the scale for the retrieved image for this particular building. I will need to look deeper into this issue to identify the potential causes.

I will get back to you with an update once this issue is resolved.