Problem to reproject HARP netcdf output file in EPSG:4326


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 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: No such file or directory

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


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.


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

ERROR 1: Input file 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
1 Like