it's a bit old but here I am.
Unfortunately GDAL does not fully support the NetCDF standard and Sentinel 3 netcdf are one of those unfortunate case.
The following is a simple script written in kotlin unsing the java bindings:
println(" * Converting $prodName...")
val wgs84 = SpatialReference()
wgs84.ImportFromEPSG(4326)
val lst = gdal.Open("NETCDF:$prodName/LST_in.nc:LST")
val map = mapOf(
"LINE_OFFSET" to "1", "LINE_STEP" to "1",
"PIXEL_OFFSET" to "1", "PIXEL_STEP" to "1",
"X_BAND" to "1", "X_DATASET" to "NETCDF:$prodName/geodetic_in.nc:longitude_in",
"Y_BAND" to "1", "Y_DATASET" to "NETCDF:$prodName/geodetic_in.nc:latitude_in"
)
lst.SetMetadata(Hashtable(map), "GEOLOCATION")
val warp = gdal.AutoCreateWarpedVRT(lst, wgs84.ExportToWkt())
gdal.Translate("$prodName/lst.tif", warp, TranslateOptions( gdal.ParseCommandLine("-of gtiff -oo COMPRESS=LZW ") ) )
println(" * Complete")
this perfectly works with Sentinel 1 OCN products, but with Sentinel 3 GDAL gives some strange errors while parsing the file:
Warning 1: NetCDF driver detected file type=5, but libnetcdf detected type=3
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Warning 1: NetCDF driver detected file type=5, but libnetcdf detected type=3
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Warning 1: NetCDF driver detected file type=5, but libnetcdf detected type=3
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
ERROR 1: Too many points (441 out of 441) failed to transform, unable to compute output bounds.
ERROR 1: IReadBlock failed at X offset 2, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 2, Y block offset 0
After some throubleshooting it seems that it does not automatically apply the scale factor and offset of each variable, and so he have to deal with raw lat-lon coordinates and he does not know what to do with it.
I hope this will get fixed soon
Best Answer
Try