PlanetScope - ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between...

Technical questions about ACOLITE
Post Reply
hnthang
Posts: 25
Joined: Fri Oct 12, 2018 11:24 am

PlanetScope - ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between...

Post by hnthang »

Hi Quinten,

I read the issue here:

Code: Select all

https://odnature.naturalsciences.be/remsem/acolite-forum/viewtopic.php?t=266
however can not solve my problem and since the last comments turned into another topic (i.e., cloud shadow), I open a new topic here for PlanetScope.

I cloned the latest ACOLITE version from Github to process a scene of PlanetScope (6 sub-scenes inside).
My problem:
ACOLITE only processed to L1R.nc and stopped with the following error:

Code: Select all

Traceback (most recent call last):
  File "/run/media/metal/TH/soft/acolite/launch_acolite.py", line 75, in <module>
    launch_acolite()
  File "/run/media/metal/TH/soft/acolite/launch_acolite.py", line 69, in launch_acolite
    ac.acolite.acolite_run(args.settings, inputfile=inputfile, output=output)
  File "/run/media/metal/TH/soft/acolite/acolite/acolite/acolite_run.py", line 109, in acolite_run
    ret = ac.acolite.acolite_l1r(bundle, setu_user)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/metal/TH/soft/acolite/acolite/acolite/acolite_l1r.py", line 143, in acolite_l1r
    l1r_files, setu = ac.planet.l1_convert(bundle, settings = setu)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/run/media/metal/TH/soft/acolite/acolite/planet/l1_convert.py", line 440, in l1_convert
    ac.output.nc_write(ofile, ds, data, replace_nan=True, attributes=gatts,
  File "/run/media/metal/TH/soft/acolite/acolite/output/nc_write.py", line 224, in nc_write
    var[:] = data
    ~~~^^^
  File "src/netCDF4/_netCDF4.pyx", line 5477, in netCDF4._netCDF4.Variable.__setitem__
  File "/home/metal/miniconda3/envs/thang/lib/python3.11/site-packages/netCDF4/utils.py", line 359, in _StartCountStride
    datashape = broadcasted_shape(shape, datashape)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/metal/miniconda3/envs/thang/lib/python3.11/site-packages/netCDF4/utils.py", line 967, in broadcasted_shape
    return np.broadcast(a, b).shape
           ^^^^^^^^^^^^^^^^^^
ValueError: shape mismatch: objects cannot be broadcast to a single shape.  Mismatch is between arg 0 with shape (3484, 1828) and arg 1 with shape (3483, 1827)

Code: Select all

ValueError: shape mismatch: objects cannot be broadcast to a single shape.  Mismatch is between arg 0 with shape (3484, 1828) and arg 1 with shape (3483, 1827)
I tested various options of the setting files, including use of the defaults file with three changes of input, output and l2w = Rrs_*, but still failed. Attached is the setting file I used.

Previously, I successfully processed PlanetScope with ACOLITE, but failed this time.

May I miss songthing?

Many thanks.
Thang
Attachments
defaults.txt
(9.3 KiB) Downloaded 195 times
acolite_run_20230228_154211_log_file.txt
(7.18 KiB) Downloaded 188 times
quinten
Posts: 1019
Joined: Tue Mar 03, 2015 8:13 am

Re: PlanetScope - ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between...

Post by quinten »

Hi Thang

Thanks for your report. It seems like it can convert the four first files (L1R are generated) and then fails on the fifth. It seems that the dimensions of the data and the computed lat/lon are off. Can you try separating the files into different folders?

Could you perhaps share this bundle of files so I can test it locally?

Quinten
Post Reply