pytroll / pytroll/pyresample

BucketResampler doesn't accept numpy arrays.

Open
#459 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

lon_swath, lat_swath  = swath_def.get_lonlats()
resampler = BucketResampler(target_area, lon_swath, lat_swath)

Gives following error.

121 result = da.map_blocks(self._get_proj_coordinates, lons, lats,

--> 122 new_axis=0, chunks=(2,) + lons.chunks)
123 proj_x = result[0, :]
124 proj_y = result[1, :]

AttributeError: 'numpy.ndarray' object has no attribute 'chunks'

...

Problem was solved by changing the arrays to Dask arrays.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at BucketResampler and trace the da.map_blocks call shown in the traceback, especially its use of lons.chunks and lats.chunks. Check how numpy arrays are handled before this point, then add a regression test using the issue's numpy-array example. Done means BucketResampler accepts numpy longitude and latitude arrays without requiring callers to convert them to Dask arrays.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.