Skip to content

miscalculation in Interpolator._extrapolate_rows #92

@Berhinj

Description

@Berhinj

Hello!

Somehow I was recreating something similar to your modis5kmto1km function, when I realized we were building the same thing I thought let's compare and noticed some differences, so I deconstructed the code behind to understand the differences and I believe I found a major issue into it:

In the modis5kmto1km function I noticed at line 83 (on main) what I believe is the root of the issue:

satint.fill_borders("y", "x") => here

Somehow that line increases the dimensions of your self.tie_data entries containing the x, y, z coordinnates.
A typical 406 x 271 modis latitude 2d array becomes a 812 x 273. Going from 271 to 273 make sense to allow the interpolation of border but I can't get how going from 406 to 812 can make sense.

Especially considering the fact that your self.row_indices (which reflects the increment of the axis been used later in the RectBivariateSpline function), in cahnging in such a way as if it meant one pixel was added to the top border while 405 pixels are added at the bootom of the image.

The culprit to me is the _extrapolate_rows function from your Interpolator class which receives two rows as entry and systematically returns 4 while looping over the rows.

I hope I'm wrong, please correct me if so.

Note, the RectBivariateSpline function support the bbox parameter that would strongly simplify your code by allowing the extrapolation natively.
https://docs.scipy.org/doc/scipy-1.15.0/reference/generated/scipy.interpolate.RectBivariateSpline.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions