Skip to content

Error when using delayed writing using one area but several (writers) formats #3285

@adybbroe

Description

@adybbroe

Describe the bug

I get an error when trying to make AVHRR images using the delayed writing functionality (as is used in trollflow2). See the example code below. The original error was discovered when running trollflow2 with a the minimal productlist, see extract outlined below:

  reader: avhrr_l1b_aapp
  mask_area: true
  delay_composites: true
  use_tmp_file: true
  radius_of_influence: 10000
  metadata_aliases:
    variant:
      GDS: global
      EARS: regional
      DR: direct_readout
  min_coverage: 25
  areas:
    euron1:
      areaname: euron1
      products:
        overview:
          min_sunlight_coverage: 10
          productname: overview
          formats:
            - format: tif
              writer: geotiff
              blockxsize: 512
              blockysize: 512
              tiled: true
            - format: png
              writer: simple_image
            - format: jpg
              writer: simple_image
              fill_value: 0
...

If comment out either the png and jpg and leave only the tiff, it works fine. If I comment out the tiff, and leave the png/jpeg it also works fine!

To Reproduce

I managed to reproduce it with this minimal code below:

# Your code here
    scene = Scene(filenames=filenames, reader='avhrr_l1b_aapp')
    parameters = ['overview']
    scene.load(parameters)

    AREAID = 'euron1'
    local_scn = scene.resample(AREAID)

    start_time_txt = local_scn.start_time.strftime('%Y-%m-%d %H:%M')
    timestamp = local_scn.start_time.strftime('%Y%m%d_%H%M')

    obj1 = local_scn.save_dataset('overview', writer='geotiff',
                                  blockxsize=512,
                                  blockysize=512,
                                  tiled=True,
                                  compute=False,
                                  filename='avhrr_ovw_%s_%s.tif' % (timestamp,
                                                                    AREAID))
    obj2 = local_scn.save_dataset('overview', writer='simple_image', fill_value=0,
                                  compute=False,
                                  filename='avhrr_ovw_%s_%s.jpg' % (timestamp,
                                                                    AREAID))
    obj3 = local_scn.save_dataset('overview', writer='simple_image',
                                  compute=False,
                                  filename='avhrr_ovw_%s_%s.png' % (timestamp,
                                                                    AREAID))

    objs = [obj1, obj2, obj3]
    compute_writer_results(objs)

Expected behavior
I would expect three images being written, now I get only two, the png and the tiff.

Actual results
Text output of actual results or error messages including full tracebacks if applicable.

Traceback (most recent call last):
  File "/home/myuser/test_satpy_save_images.py", line 73, in <module>
    compute_writer_results(objs)
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/path/to/conda/env/lib/python3.13/site-packages/satpy/writers/core/compute.py", line 139, in compute_writer_results
    da.compute(delayeds)
    ~~~~~~~~~~^^^^^^^^^^
  File "/path/to/conda/env/lib/python3.13/site-packages/dask/base.py", line 681, in compute
    results = schedule(expr, keys, **kwargs)
  File "/path/to/conda/env/lib/python3.13/site-packages/pyresample/future/resamplers/nearest.py", line 62, in query_no_distance
    distance_array, index_array = kdtree.query(
                                  ~~~~~~~~~~~~^
        coords,
        ^^^^^^^
    ...<2 lines>...
        distance_upper_bound=radius,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        mask=mask)
        ^^^^^^^^^^
  File "pykdtree/kdtree.pyx", line 274, in pykdtree.kdtree.KDTree.query
ValueError: Mask must have the same size as data points

Screenshots
If applicable, add screenshots to help explain your problem.

Environment Info:

  • OS: Linux (RHEL9)
  • Satpy Version: 0.57.0
  • Pyresample Version:
  • bokeh: 3.8.0
  • trollimage=1.26.0
  • Readers and writers dependencies (when relevant): [run from satpy.utils import check_satpy; check_satpy()]

See requirements file attached!

requirements-conda.txt

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions