Skip to main content
2 of 2
added 1508 characters in body

Convert Sentinel-5P netCDF O3_TCL (Tropospheric Ozone) subdataset to GeoTiff by GDAL?

I've used these steps below to extract the subdataset of Sentinel-5P netCDF file:

First, extract the latitude and longitude variables as geolocation arrays

gdal_translate -of VRT HDF5:"S5P_OFFL_L2__AER_AI_20190101T013729_20190101T031859_06309_01_010202_20190107T010005.nc"://PRODUCT/latitude lat.vrt
gdal_translate -of VRT HDF5:"S5P_OFFL_L2__AER_AI_20190101T013729_20190101T031859_06309_01_010202_20190107T010005.nc"://PRODUCT/longitude lon.vrt

And create a customized VRT file for a subdataset

<VRTDataset rasterXSize="450" rasterYSize="3245">
lon.vrt 1 lat.vrt 1 0 0 1 1
<SimpleSource>
  <SourceFilename relativeToVRT="1">HDF5:S5P_OFFL_L2__AER_AI_20190101T013729_20190101T031859_06309_01_010202_20190107T010005.nc://PRODUCT/aerosol_index_340_380</SourceFilename>
  <SourceBand>1</SourceBand>
  <SourceProperties RasterXSize="450" RasterYSize="3245" DataType="Float32"/>
  <SrcRect xOff="0" yOff="0" xSize="450" ySize="3245" />
  <DstRect xOff="0" yOff="0" xSize="450" ySize="3245" />
</SimpleSource>

Then, project the subdataset to GeoTIFF

 gdalwarp -geoloc -t_srs EPSG:4326 -srcnodata 9.96921e+36f aerosol_index_340_380.vrt aerosol_index_340_380.tif -tr 0.069 0.069 -tap

The problem is this O3_TCL (Tropospheric Ozone) (e.g: file name: S5P_OFFL_L2__O3_TCL_20190101T120803_20190107T125357_06315_01_010105_20190115T235953.nc) data doesn't have latitude and longitude variables.

Does anyone know how to process this data to GeoTiff?

Below is what it looks like when I open with Panoly software

enter image description here

It has these values for lat and long variables:

float latitude_ccd(latitude_ccd=80);
  :_FillValue = 9.96921E36f; // float
  :long_name = "pixel center latitude for CCD data";
  :units = "degrees_north";
  :standard_name = "latitude";
  :valid_min = -20.0f; // float
  :valid_max = 20.0f; // float
  :_ChunkSizes = 80U; // uint

float latitude_csa(latitude_csa=8);
  :_FillValue = 9.96921E36f; // float
  :long_name = "latitude center for CSA data";
  :units = "degrees_north";
  :standard_name = "latitude";
  :valid_min = -20.0f; // float
  :valid_max = 20.0f; // float
  :_ChunkSizes = 8U; // uint

float longitude_ccd(longitude_ccd=360);
  :_FillValue = 9.96921E36f; // float
  :long_name = "pixel center longitude for CCD data";
  :units = "degrees_east";
  :standard_name = "longitude";
  :valid_min = -180.0f; // float
  :valid_max = 180.0f; // float
  :_ChunkSizes = 360U; // uint

float longitude_csa(longitude_csa=18);
  :_FillValue = 9.96921E36f; // float
  :long_name = "longitude center for CSA data";
  :units = "degrees_east";
  :standard_name = "longitude";
  :valid_min = -180.0f; // float
  :valid_max = 180.0f; // float
  :_ChunkSizes = 18U; // uint