HARP Installation

I need to convert my images from L2 to L3 format for this I know I need to install HARP. I know that HARP must be installed in anaconda. But as a requirement for other processes I need to have it all inside a container. I have followed several approaches and I have been able to install it but I always get the same error: unsupported product.

I am working with Sentinel-5P and S5P-PAL images.

I am following this example: Usecase_2_S5P_AAI_Siberia_Smoke

I get the error when doing the import_product of my image.

My first example is:
docker-compose.yml
image

Dockerfile
image

main.py

If I check the version of HARP installed, I have 1.20.2.

Why do I get this error?
Is there something wrong with the installation or my code?
I have tried different images and I always get the same error.

I am not sure where your CHOCHO_PAL_2024-01-06.nc file comes from. This is not a file that can be downloaded from the S5P-PAL data portal. If it was a L2 product from S5P-PAL then you should keep the original filename in order for harp to support importing it. This is because harp in many cases uses the filename to figure out what kind of product it is and what importer to invoke.
Only once you converted and stored the data into a harp format compliant netcdf/hdf file will you be able to give the file any name you want.

Hi @sander.niemeijer I have modified my API to not rename the S5P-PAL image until I do the L3 conversion. So, the image name is as follows: “S5P_PAL__L2__BRO____20240116T181339_20240116T195510_32438_03_010202_20240118T195331.nc”. I still get the same error.

This is the original name of the image, am I missing something else?

This was a bit more tricky to figure out.
But the problem seems to be the use of threading by flask. If you use threaded=False things seem to work.

Although the underlying CODA library can be used in multi-threading situation (although with some caveats), HARP itself is actually not a thread-safe library. So if you want to do something parallel with HARP in python you should use a multiprocessing approach.

Hi @sander.niemeijer now it’s working.

However, I am not able to convert my image from L2 to L3. I am working with a Sentinel 5P NO2 image. I found this website (S5P_L2_NO2 — HARP 1.20.2 documentation) where I saw the mapping between the original image properties and HARP.

What I want is to get a NetCDF where my image is already L3. I’ve followed the use cases on the web but it’s not clear to me.

Applying the following code:


I get a NetCDF image but the parameter I am interested in is of type GeoTraj instead of Geo2D.

What is the way to do the regrid to go from L2 to L3?

Thanks in advance.

You should follow the full Usecase 2 that you mentioned in your initial post.
The trick is the bin_spatial operation, and if you search this forum for that function, you will find many posts that discuss this topic in more detail.