Sentinel 5P coordinate data oddity, min value larger than max and rasterization failure, what could be wrong?

Hi!

If I download S-5P netCDF files and dump metadata, in the coordinates section I see

geolocation_grid_from_band=3
geospatial_lat_max=25.532017
geospatial_lat_min=2.1418159
geospatial_lon_max=99.929924
geospatial_lon_min=128.72141

Why is lon_max smaller than lon_min? An example file could be https://s5phub.copernicus.eu/dhus/odata/v1/Products(‘e6e91b26-ca43-43d4-9c08-c9c14dd6737e’)/$value (or by filename S5P_NRTI_L2__SO2____20181030T054006_20181030T054506_05418_01_010102_20181030T062719). The strange thing is that if I try to crete a georefenced TIFF image by gdal_translate -ot float32 -unscale -CO COMPRESS=deflate -of GTiff -a_srs EPSG:4326 -a_ullr 25.532017 99.929924 2.1418159 128.72141 HDF5:"S5P_NRTI_L2__SO2____20181030T054006_20181030T054506_05418_01_010102_20181030T062719.nc"://PRODUCT/sulfurdioxide_total_vertical_column so2.tif and then dumping the metadata, I get

Corner Coordinates:
Upper Left  (      25.532,      99.930) ( 25d31'55.26"E, 99d55'47.73"N)
Lower Left  (      25.532,     128.721) ( 25d31'55.26"E,128d43'17.08"N)
Upper Right (       2.142,      99.930) (  2d 8'30.54"E, 99d55'47.73"N)
Lower Right (       2.142,     128.721) (  2d 8'30.54"E,128d43'17.08"N)
Center      (      13.837,     114.326) ( 13d50'12.90"E,114d19'32.40"N)

where Upper Right and Lower Left have been inverted. Also checking on Google Maps the projection is otherwise slightly off (having EPSG:3857 didn’t seem to help).

I’m not sure if this could be related to Sentinel 5p raster creation.

My main question is how to get a properly georeferenced TIFF? Otherwise it’d be nice to know what’s going on here. I’m a rookie with this data, so might be an issue there too.

SNAP is not specifically supporting S5p. have you tried the ESA Atmospheric Toolbox already?

I got this solved with plain GDAL already. It’s probably more work to extract values, apply masks and do projections, but seem to be working. I haven’t tried to ESA Atmospheric Toolbox.

Hello @veikkoeeva
Can you please share the work that you have done to process sentinel 5p data or can you please suggest me some library, packages to process sentinel 5p data with GDAL.

Sure! The steps are documented at https://gis.stackexchange.com/questions/300825/geotiff-esa-copernicus-data-georeferencing-coordinates-are-mirrored-and-projec along with some GDAL commands and further links.

As tangentially, while I’m not currently actively working on this, I would be interested to see the actual algorithms to do translations, though. Since The S-5P API seem to allow slicing the raster data out of the file format, I could perhaps avoid GDAL or it’s .NET wrapper if the equations were more easily available. I see there are also .NET libraries on HDF5 are some more being worked on too.

Thank you so much. Similarly, can you please suggest me further sentinel-5p OFFL data.
Thanks again.