Actually the interpolation is linear between the tie-points. Why do you think it’s not?
I was checking the TP_latitude first two tie points in IPython:
In [1]: import osgeo.gdal as gdal
In [2]: d = gdal.Open( 'TP_latitude.img' )
In [3]: lat = d.ReadAsArray()
In [4]: lat.shape
Out[4]: (4091, 77)
In [5]: lat[0,0]
Out[5]: 52.672676
In [6]: lat[0,1]
Out[8]: 52.658318
In the metadata, the STEP_X is 64:
<Tie_Point_Grid_Info>
<TIE_POINT_GRID_INDEX>0</TIE_POINT_GRID_INDEX>
<TIE_POINT_DESCRIPTION>Latitude</TIE_POINT_DESCRIPTION>
<PHYSICAL_UNIT>degrees_north</PHYSICAL_UNIT>
<TIE_POINT_GRID_NAME>TP_latitude</TIE_POINT_GRID_NAME>
<DATA_TYPE>float32</DATA_TYPE>
<NCOLS>77</NCOLS>
<NROWS>4091</NROWS>
<OFFSET_X>0.0</OFFSET_X>
<OFFSET_Y>0.0</OFFSET_Y>
<STEP_X>64.0</STEP_X>
<STEP_Y>1.0</STEP_Y>
<CYCLIC>true</CYCLIC>
</Tie_Point_Grid_Info>
Therefore when I did the Rad2Ref using the per-pixel geocoding, I was expecting equidistant latitude values between the two tie points in the full resolution latitude raster:
In [1]: import osgeo.gdal as gdal
In [2]: d = gdal.Open( 'latitude.tif' )
In [3]: lat_full = d.ReadAsArray()
In [4]: lat_full.shape
Out[4]: (4091, 4865)
In [5]: lat_full[0, 0]
Out[5]: 52.672672
In [6]: lat_full[0,64]
Out[6]: 52.658318
In [7]: np.diff( lat_full[0,0:65] )
Out[7]:
array([-0.00022507, -0.00022125, -0.00022507, -0.00022507, -0.00022507,
-0.00022125, -0.00022507, -0.00022507, -0.00022507, -0.00022507,
-0.00022507, -0.00022125, -0.00022507, -0.00022507, -0.00022507,
-0.00022507, -0.00022125, -0.00022507, -0.00022507, -0.00022507,
-0.00022507, -0.00022125, -0.00022507, -0.00022507, -0.00022507,
-0.00022507, -0.00022125, -0.00022507, -0.00022507, -0.00022507,
-0.00022507, -0.00022125, -0.00022507, -0.00022507, -0.00022507,
-0.00022507, -0.00022507, -0.00022125, -0.00022507, -0.00022507,
-0.00022507, -0.00022507, -0.00022125, -0.00022507, -0.00022507,
-0.00022507, -0.00022507, -0.00022507, -0.00022125, -0.00022507,
-0.00022507, -0.00022507, -0.00022125, -0.00022507, -0.00022507,
-0.00022507, -0.00022507, -0.00022507, -0.00022125, -0.00022507,
-0.00022507, -0.00022507, -0.00022507, -0.00022125], dtype=float32)
As you can see the distance is not always the same, any idea why is that?, if is a linear interpolation the distance between points should be equidistant.
Thanks for your help.
Gerardo
The difference is only at the 6th digit. So it is probably caused by the floating point precision.
Hey Marpet,
is there a way to set the pixel based geocoding without user interface?
thanks!
Dear marpet,
if there is not a way to set these options from command line maybe it would be nice to add them among the reprojection option for s3, what do you think about?
thanks for considering this point!
Carlo
There is a way. You can either create a s3tbx.properties file in the etc folder of the SNAP installation directory and add the property s3tbx.reader.olci.pixelGeoCoding=true.
You can specify this also on the command line. Then add -Ds3tbx.reader.olci.pixelGeoCoding=true to the call.
Similar properties are:
s3tbx.reader.slstrl1b.pixelGeoCodings
s3tbx.reader.meris.pixelGeoCoding (for upcoming MERIS 4th reprocessing in SAFE format)
Solved!
thanks!
C