-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
miscalculation in Interpolator._extrapolate_rows
#92
Comments
@Berhinj thanks a lot for performing this investigation! this is indeed a bit worrying. I’m all for simplifying the code, because at the time we wrote this I don’t think the RectBivariateSpline was supporting extrapolation. Also looking at the code (in satpy) that relies on interpolating modis navigation data, I can see that we use two functions depending if we have access to the satellite zenith angles or not:
So that makes three (!!!) ways of interpolating modis navigation data. So back to the function you are using, I think we need to make some serious analysis, find the best alternative, and deprecate what is not performing well. Do you have the possibility to compare with eg
Also could you detail a bit more what data you are using for testing? eg could terrain correction be an issue? |
I'm getting the data through earthaccess nasa package 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-protected/MOD11_L2.061/MOD11_L2.A2023177.1105.061.2023178090735/MOD11_L2.A2023177.1105.061.2023178090735.hdf' here is an example of how I was loading the data and running the modis function
I will try the other modis functions edit1: I tried from geotiepoints.simple_modis_interpolator import interpolate_geolocation_cartesian, values I'm getting are very off, but it doesn't sound desinged for 5 to 1km interpolation - fair |
One note in favour of your existing code, somehow with my logic I'm getting these diagonal artifacts that you don't have they get solved once according to modis user guide, stripping artefact are expect but I'm lacking info on the topic (page 18) ![]() https://modis-land.gsfc.nasa.gov/pdf/MOD21_LST&E_user_guide_C6_gch_10252017.pdf |
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 theRectBivariateSpline
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 yourInterpolator
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
The text was updated successfully, but these errors were encountered: