# Problem to reproject HARP netcdf output file in EPSG:4326

**URL:** https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653
**Category:** HARP
**Created:** [June 13, 2023, 3:49pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653 "2023-06-13T15:49:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![TheRed86](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/t/919ad9/32.png) [@TheRed86](https://forum.atmospherictoolbox.org/u/TheRed86)
#### Post date: [June 13, 2023, 3:49pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653/1 "2023-06-13T15:49:58Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

### Author: ![sander.niemeijer](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/sander.niemeijer/32/5_2.png) [@sander.niemeijer](https://forum.atmospherictoolbox.org/u/sander.niemeijer)
#### Post date: [June 13, 2023, 4:07pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653/2 "2023-06-13T16:07:56Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![TheRed86](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/t/919ad9/32.png) [@TheRed86](https://forum.atmospherictoolbox.org/u/TheRed86)
#### Post date: [June 13, 2023, 4:11pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653/3 "2023-06-13T16:11:54Z")

</div>

Hi Sander,

format is not a valid key.

PErforming:

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

```

I got the following error:

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

```

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

---

<div class="post-metadata">

### Author: ![sander.niemeijer](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/sander.niemeijer/32/5_2.png) [@sander.niemeijer](https://forum.atmospherictoolbox.org/u/sander.niemeijer)
#### Post date: [June 13, 2023, 4:13pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653/4 "2023-06-13T16:13:16Z")

</div>

Typo from my end. It should be `file_format`. See also the [documentation](http://stcorp.github.io/harp/doc/html/python.html#harp.export_product).

---

<div class="post-metadata">

### Author: ![TheRed86](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/t/919ad9/32.png) [@TheRed86](https://forum.atmospherictoolbox.org/u/TheRed86)
#### Post date: [June 13, 2023, 4:23pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653/5 "2023-06-13T16:23:35Z")

</div>

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:

```auto
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.

```

---

<div class="post-metadata">

### Author: ![sander.niemeijer](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/sander.niemeijer/32/5_2.png) [@sander.niemeijer](https://forum.atmospherictoolbox.org/u/sander.niemeijer)
#### Post date: [June 13, 2023, 5:13pm UTC](https://forum.atmospherictoolbox.org/t/problem-to-reproject-harp-netcdf-output-file-in-epsg-4326/653/6 "2023-06-13T17:13:46Z")

</div>

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:

```auto
gdalwarp -t_srs EPSG:4326 NETCDF:S5P_OFFL_L2 __NO2____ 20220730_merged.nc:tropospheric_NO2_column_number_density prova.nc

```
