Closed simonrp84 closed 2 years ago
The first thought was that it must be the space pixels, but no, the size 13778944
matches the size of the FD data (3712x3712
). I'll have another look in the morning, getting too tired to figure out what the resampler is doing.
Debugging was fun. The trace points to pyresample.bilinear._base
, but some of the calls actually happen in .xarr
which overloads some of the methods. The index_array
used to expand (slice) the input X/Y coordinates to the output grid is too small to get full shape. I started to think that the resampler ever works only if the output grid is larger in pixels than the input data. But testing that by multiplying the input grid dimensions by 10
I got the exact same failure with the same mismatching shapes.
Need to do other things now, but will get back to this.
Thanks for looking at this Panu!
Hah, it is the space pixels where both lons
and lats
are Inf
. Via debugger:
ipdb> self._get_valid_output_indices().sum()
10280821
ipdb> self._target_lons.size - np.isinf(self._target_lons).sum()
10280821
If I mask these space coordinates to np.nan
, the result is the same, so I think KDTree
does something similar for nan
coordinates. To further validate this hypothesis, I cropped the target area not to contain any space pixels by targ_area = get_area_def('msg_seviri_fes_3km')[1000:2000, 1000:2000]
and that works.
So, how to fix this? Not sure. The tiling of output X and Y coordinates done in pyresample.bilinear._base._get_stride_and_valid_corner_indices()
assumes the X/Y vectors are uniform for all rows/columns, which isn't the case when the space pixels are removed.
Firstly, I'm not sure if this is a
pyresample
issue or asatpy
issue, but I think the former is more likely so I'll put this here.I'm trying to resample some gridded data onto the SEVIRI disk and am coming up against an error:
Which results in the following error:
I've tried various combinations of
radius_of_influence
andreduce_data
and always get the same error. Switching tonearest
orgradient_search
works, but I would prefer to usebilinear
in this case as the results should be better quality for what I need. Any ideas what the problem is?(edit) I also tried this with
SwathDefinition
instead ofGridDefinition
and I get the same error.