1

I have to work with many Sentinel 2 and 3 images, with two different algorithms. I have to treat both images separately but only with Python and GDAL.

Concerning Sentinel-2 images, I download them on the Scihub, using the L1C-level. I do some corrections and operations on it, and the last step is converting the result into a netCDF file, reprojected in EPSG:4326. To do that, I use GDAL (my first result is in GeoTiff) as follows :

gdalwarp -t_srs EPSG:4326 inFile.tif outFile.nc

I tried to add "-of NetCDF" too, but when I add this, it does not work. Moreover, I have this problem when the output file is in GeoTiff too so I don't think this is where my problem comes from.

On the other side, I work on Sentinel 3 WFR (so downloaded on CODA) images. I only open them in Python, convert them in GeoTiff and crop them on the same Granules as my S2 images. When I try to convert them in GeoTiff via Python, I open the file with the module h5py. I open the file geo_coordinates.nc too, and extract the longitude and latitude on each pixel. Then I match the longitude and latitude to the file (here iop_nn.nc) and I create the GeoTiff with gdal_edit as follows (the file outFile.tif was created before by copying iop_nn.nc array in it) :

gdal_edit.py outFile.tif -a_srs EPSG:4326 -a_nodata -10000 -gcp pixel1 Line1 lon1 lat1 -gcp pixel2 Line2 lon2 lat2 -gcp pixel3 Line3 lon3 lat3 -gcp pixel4 Line4 lon4 lat4 -gcp pixel5 Line5 lon5 lat5 -gcp pixel6 Line6 lon6 lat6 -gcp pixel7 Line7 lon7 lat7 -gcp pixel8 Line8 lon8 lat8 -gcp pixel9 Line9 lon9 lat9

with the gcps taken at corners and centers. Finally, I use gdalwarp. I keep the result before warping and after.

Then I use QGIS to compare the results, and i can notice a shift between S2 location and S3 location. The shift is about 5-6 S3-pixels (way too much). I found it weird, so I tried to georeference with SNAP and then I had no shift anymore !

I tried to use the file tie_geo_coordinates.nc but it did not work neither, and I can't explain it...

I only got one question : How can I create a weel-georeferenced raster from S3 images using Python and/or GDAL ? (And truly, I don't uderstand why my question is considered as "too broad"...)

closed as too broad by PolyGeo Jul 19 '18 at 9:13

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Welcome to GIS SE. Please split your question and create a second one. – pLumo Jul 18 '18 at 14:35