On 26.4.2021 21.27, Israel Brewster wrote:
Hi,
> I am attempting to use pyresample to grid some (OMPS) data that I
> have. When I load the raw, unguided data, I have fairly full coverage
> of an area, as shown in this first screen shot:
The first screenshot shows the data resampled with nearest neighbour
resampling, so it's not ungridded. The nearest duplicates pixels to
locations where there's no data, and causes the swath edge (here on the
left edge) to elongate the features in the data.
> However, after gridding, most of the data is now missing:
The bilinear resampler needs four samples that surround the target
location. The "surround" here means that in the target projection there
should be one source location in each of the four quadrants around the
target location. The current implementation of bilinear interpolation
uses the nearest neighbour interpolation to find 32 closest (regardless
of the direction they are in) source locations. From these the four
closest are within each of the quadrants. With very sparse data, or very
low resolution, these quadrant neighbours might not be found. This is
certain to happen close to the swath, like in your example, where
there's no data beyond the swath edge.
> presumably this is me doing something wrong, but having tried tweaking
> a number of parameters, I’m at a loss as to what.
It's not you doing anything wrong, it's just a limitation with the
*current* implementation. The current implementation is also very
inefficient with large datasets.
> 3) get_bil_info:
>
> t_params, s_params, input_idxs, idx_ref =
> bilinear.get_bil_info(source_def, target_def, radius=radius) # Have
> tried radius from 100,000 to an insane 2e20
As the data are very coarse, you could also try to increase the
neighbours that are searched with the "neighbours" keyword argument. The
default is 32, so you try with a larger value. This will increase the
memory use a lot, but might be worth a try.
> So am I doing something wrong with the above procedure/parameters? How
> can I get the gridded data to show full coverage?
The surest way is to use nearest neighbour interpolation like in your
first example image.
> More information:
>
> When loaded, my data is formatted into 1D, essentially treated as
> “time series” data, since the points are all recorded sequentially. As
> such, and due to this bug that I reported:
>
https://github.com/pytroll/pyresample/issues/316
> <
https://github.com/pytroll/pyresample/issues/316>, I am currently
> using pyresample 1.16, and am unable to update. If there is good
> reason to believe that this is an issue with the version of pyresample
> I am using, I could probably re-write the data import routines to pull
> in the data as a 2D lat/lon structure, such that it would work with
> the newer versions of pyresample, but that would take a lot of work
> that I’d prefer to avoid for now unless there is some definite benefit.
Ah. Yeah, I hit a snag when trying to fix that, so no progress. But as
there's no change in the actual interpolation algorithm, the new version
wouldn't help here.
There is a new interpolation in the works
(
https://github.com/pytroll/pyresample/pull/341), but it isn't yet ready
for general use.
P
--
Finnish Meteorological Institute
Erik Palménin aukio 1, P.O.Box 503, FIN-00101 Helsinki, Finland
Room: 4B15a, Phone:
+358 50 380 3261