# Find maximum NO2 consentration in monthly analysis

**URL:** https://forum.atmospherictoolbox.org/t/find-maximum-no2-consentration-in-monthly-analysis/769
**Category:** HARP
**Tags:** sentinel-5p, python
**Created:** [March 13, 2024, 11:35am UTC](https://forum.atmospherictoolbox.org/t/find-maximum-no2-consentration-in-monthly-analysis/769 "2024-03-13T11:35:12Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![IreB](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/i/58956e/32.png) [@IreB](https://forum.atmospherictoolbox.org/u/IreB)
#### Post date: [March 13, 2024, 11:35am UTC](https://forum.atmospherictoolbox.org/t/find-maximum-no2-consentration-in-monthly-analysis/769/1 "2024-03-13T11:35:12Z")

</div>

Hello! I’m doing a monthly mean analysis about NO2 with python and HARP. I’m wondering how i can compute, e.g for 31 products for January 2024, the product that has the maximum average consentration and plot it. Any ideas?

Thank you very much!

---

<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: [March 13, 2024, 12:06pm UTC](https://forum.atmospherictoolbox.org/t/find-maximum-no2-consentration-in-monthly-analysis/769/2 "2024-03-13T12:06:06Z")

</div>

If you want a global average, you can rebin the data to a grid that is just 1x1 (i.e. a single cell).  
If you do that per grid, you can create a time series of these global averages like so:

```auto
product = harp.import_product("s5p-grid*.nc", "rebin(latitude,latitude_bounds [degree_north],2,-90,180);rebin(longitude,longitude_bounds [degree_east],2,-180,360);squash(latitude, tropospheric_NO2_column_number_density);squash(longitude, tropospheric_NO2_column_number_density)")
print(product.tropospheric_NO2_column_number_density.data)

```

You can then find the index of the maximum value from that array and use that index to retrieve the corresponding daily grid.

---

<div class="post-metadata">

### Author: ![IreB](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/i/58956e/32.png) [@IreB](https://forum.atmospherictoolbox.org/u/IreB)
#### Post date: [March 14, 2024, 11:49am UTC](https://forum.atmospherictoolbox.org/t/find-maximum-no2-consentration-in-monthly-analysis/769/3 "2024-03-14T11:49:52Z")

</div>

Thank you for your response and your time!

I’m a little bit confused about the case i want to do the process in a specific region. The region I’m interested in is Cyprus. I’m doing first the validity filter, bin\_spatial and then the method you suggested.  
I suppose it is not the right way as something goes wrong and also returns NaN values.  
The operations im using are the following:

operations = “;”.join([  
“tropospheric\_NO2\_column\_number\_density\_validity\>75”,  
“keep(latitude\_bounds,longitude\_bounds,tropospheric\_NO2\_column\_number\_density)”,  
“bin\_spatial(101, 34, 0.02, 201, 31, 0.02)”,  
“rebin(latitude,latitude\_bounds [degree\_north],2,34.56,35.70);rebin(longitude,longitude\_bounds [degree\_east],2, 32.27,34.59)”,  
“squash(latitude, tropospheric\_NO2\_column\_number\_density)”,  
“squash(longitude, tropospheric\_NO2\_column\_number\_density)”,  
])

---

<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: [March 14, 2024, 12:11pm UTC](https://forum.atmospherictoolbox.org/t/find-maximum-no2-consentration-in-monthly-analysis/769/4 "2024-03-14T12:11:17Z")

</div>

The idea is to first generate the daily grid files (based on the 14 a 15 orbits per day). And then call harp again on those daily grid files with the steps I provided.
