Problem to reproject HARP netcdf output file in EPSG:4326

Hi,

I must convert the HARP output file to raster data projected in EPSG:4326 CRS.
However, using gdal to extract latitude_bounds or longitude_bounds, I get the following error:

gdal_translate -of VRT HDF5:S5P_OFFL_L2__NO2____20220730_merged.nc:latitude_bounds prova.vrt
HDF5-DIAG: Error detected in HDF5 (1.10.7) thread 1:
  #000: ../../../src/H5F.c line 429 in H5Fopen(): unable to open file
    major: File accessibility
    minor: Unable to open file
  #001: ../../../src/H5Fint.c line 1803 in H5F_open(): unable to read superblock
    major: File accessibility
    minor: Read failed
  #002: ../../../src/H5Fsuper.c line 420 in H5F__super_read(): file signature not found
    major: File accessibility
    minor: Not an HDF5 file
ERROR 4: HDF5:S5P_OFFL_L2__NO2____20220730_merged.nc:latitude_bounds: No such file or directory

How can I solve this issue with Harp output and being able to reproject my SP5 data?

Regards,
Monica

HARP by default writes data as netcdf3 files. This means that trying to open these as HDF5 files with gdal will not work. You should either use the netcdf interface of gdal or use the format="hdf5" option when exporting your HARP product to a file.

1 Like

Hi Sander,

format is not a valid key.

PErforming:

harp.export_product(no2_map, output_file, format="hdf5", operations="squash(time, (latitude, longitude, latitude_bounds, longitude_bounds))")

I got the following error:

TypeError: export_product() got an unexpected keyword argument 'format'

Are you sure it is “format” the correct key?

Typo from my end. It should be file_format. See also the documentation.

1 Like

Thanks Sander, even though it correctly export the file, I still have issue trying to reproject the output data from HaRP.

Using gdal, I get:

gdalwarp -t_srs EPSG:4326 S5P_OFFL_L2__NO2____20220730_merged.nc prova.nc

ERROR 1: Input file S5P_OFFL_L2__NO2____20220730_merged.nc has no raster bands.

This is not really a forum about gdal support, but you can’t call gdalwarp on a full netcdf file like that. You need to specify a specific variable. For instance:

gdalwarp -t_srs EPSG:4326 NETCDF:S5P_OFFL_L2__NO2____20220730_merged.nc:tropospheric_NO2_column_number_density prova.nc
1 Like