Geographic Information Systems Asked by Bằng Rikimaru on April 7, 2021
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
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
At the risk of being redundant. netCDF files contain dimensions and then data stored in matrices controlled by these dimensions. Would you please add to the Questions the dimensions of the file?
My guess is that there will be lat and on dimensions and based on the geographical extent of the file you should be able to calculate the size of each cell.
Answered by Mahmoud Abdelrazek on April 7, 2021
You have two sets of latitude and longitude value arrays. I don't know which one you need, but I'm guessing that either you know which one it is from the metadata, or you maybe guess it from the shape of these arrays and the shape of your target variable.
At any rate, assume you want to use the _csa
parameters, just edit your gdal_translate
to
gdal_translate -of VRT 'HDF5:"S5P_OFFL_L2__AER_AI_20190101T013729_20190101T031859_06309_01_010202_20190107T010005.nc"://PRODUCT/latitude_csa' lat.vrt
gdal_translate -of VRT 'HDF5:"S5P_OFFL_L2__AER_AI_20190101T013729_20190101T031859_06309_01_010202_20190107T010005.nc"://PRODUCT/longitude_csa' lon.vrt
Answered by Jose on April 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP