Filtering and exporting CHOCHO

Hello,
I’m trying to filter a glyoxal observation with qa_value > 0.5, but I’m getting “harp._harppy.CLibraryError: could not derive variable ‘longitude {longitude}’”

operations = ';'.join([
        'C2H2O2_column_number_density_validity > 50',
        'keep(latitude, longitude, C2H2O2_column_number_density)',
        'derive(longitude{longitude})',
        'derive(latitude{latitude})'
        ])
  
imported_product = harp.import_product(
    product, 
    operations=operations,
    )
      
try:
    harp.export_product(
        imported_product,
        os.path.join(directory, product_filtered)
    )
    
except FileNotFoundError as e:
    sys.exit(f"File not found: {e}")

except ValueError as e:
    sys.exit(f"Value error: {e}")

except Exception as e:
    sys.exit(f"Error occurred during conversion: {e}")

When I don’t include the derive latitude/longitude line, I get this error when I’m exporting it to tif with rio.to_raster function (rioxarray library):

“Error occurred during conversion: y dimension not found. ‘rio.set_spatial_dims()’ or using ‘rename()’ to change the dimension name to ‘y’ can address this. Data variable: C2H2O2_column_number_density”

What’s the issue here?

The problem is that you are trying to treat the product as raster data while it is not.
If you want to convert the data to a lat/lon grid you will have to use the bin_spatial operation. There is an online use case that demonstrates this, but there are also many topics on this forum that cover this specific operation.