Atmospheric Toolbox

Error: Plot latitude grid should be the same

I’m developing a python script in order to obtain a 7 days average of NO2 values from Sentinel 5p and then dinamically visualize the change over a period of time (5 months). So I merge this 7 days average results keeping the time variable.

It works (apparently) but when I try to visualize the result into VISAN using wplot(product), I get this error:
ValueError: plot latitudeGrid should be the same for all grids

What’s strange is that depending of the products I merge, I don’t get this error.

Could someone help me?

Thanks in advance,


You probably need to explain a bit more what you are doing exactly to generate your ‘product’ variable.
The error you are getting happens if your latitude axis variable is 2 dimensional (time,latitude) and the latitude grid is not the same for different times.
It is recommended to perform a squash(time,(latitude,longitude)) as a final operation to remove the time dimension of your lat/lon axis variables.

Dear Sander,

first of all I import the products into harp in that way:

product_name = harp.import_product(base_file + ext,
operations=“latitude > -55 [degree_north]; latitude < 60 [degree_north]; tropospheric_NO2_column_number_density_validity > 75;bin_spatial(271,-55,0.5,721,-180,0.5)”,
post_operations=“bin();squash(time, (latitude,longitude))”)

This happens inside a loop, and the variable product_name change every time.

The products from one week are stored into a list. And when the list is filled with 7 products, I merge them using:

product_bin = harp.execute_operations(products, “”, “bin()”)

And then I export the result of this merge into a NetCDF file.
harp.export_product(product_bin, str(nombre_nc)+".nc")

Finally, I merge the products from several weeks using the command line:

harpmerge week*.nc

My idea is to visualize the evolution of the weekly NO average.

Thanks for your help.


Try using:

harpmerge -ap 'squash(time,(latitude,longitude))' week*.nc

Dear @svniemeijer,
thanks for your reply.

But if I execute this harpmerge command, I get this error:

ERROR: variable ‘latitude’ does not exist

Then what you have described above is not what you are actually doing.
You should still have latitude and longitude variables.

Thanks @svniemeijer,
I’ve made some changes, but now I get this error:
ERROR: variable ‘latitude’ does not have the same values in each subdimension block for squash operation

Do you know what can happen?


You probably did not create all files using the same bin_spatial() configuration.
You can’t mix grids with different lat/lon grids.

Hi @svniemeijer,
I used the same bin_spatial()
I don’t know what is the reason of this error.

Working with products from european region, do you think a bin_spatial like that is correct?


Thanks @svniemeijer