# What are the errors in my code to visualize Sentinel 5P Ozone using python

**URL:** https://forum.atmospherictoolbox.org/t/what-are-the-errors-in-my-code-to-visualize-sentinel-5p-ozone-using-python/618
**Category:** HARP
**Tags:** sentinel-5p, python
**Created:** [March 3, 2023, 4:37pm UTC](https://forum.atmospherictoolbox.org/t/what-are-the-errors-in-my-code-to-visualize-sentinel-5p-ozone-using-python/618 "2023-03-03T16:37:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kmmrao](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/k/a5b964/32.png) [@kmmrao](https://forum.atmospherictoolbox.org/u/kmmrao)
#### Post date: [March 3, 2023, 4:37pm UTC](https://forum.atmospherictoolbox.org/t/what-are-the-errors-in-my-code-to-visualize-sentinel-5p-ozone-using-python/618/1 "2023-03-03T16:37:17Z")

</div>

I am trying to visualize Sentinel 5P Ozone using python. I am getting the following errors and how can I fix these

 ![Screenshot (242)](https://forum.atmospherictoolbox.org/uploads/default/original/1X/4cf60e8db961a2163117ffd6d4ab6e49b7ed878c.png)

?

---

<div class="post-metadata">

### Author: ![kmmrao](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/k/a5b964/32.png) [@kmmrao](https://forum.atmospherictoolbox.org/u/kmmrao)
#### Post date: [March 3, 2023, 4:41pm UTC](https://forum.atmospherictoolbox.org/t/what-are-the-errors-in-my-code-to-visualize-sentinel-5p-ozone-using-python/618/2 "2023-03-03T16:41:59Z")

</div>

import os  
import harp  
import numpy as np  
import pandas as pd  
import sentinelsat  
import shutil

path = r’H:\’  
filename = ‘S5P\_OFFL\_L2\_\_O3\_\_\_\_\_20221207T213046\_20221207T231216\_26694\_03\_020401\_20221213T142046.nc’  
o3\_basic = harp.import\_product(path+filename)

operations = “;”.join([  
“O3\_column\_number\_density\_validity\>50”,  
“keep(latitude\_bounds,longitude\_bounds,datetime\_start,datetime\_length,O3\_column\_number\_density\_validity)”,  
“derive(datetime\_stop {time} [days since 2000-01-01])”,  
“derive(datetime\_start [days since 2000-01-01])”,  
“exclude(datetime\_length)”,  
“bin\_spatial(721,-90,0.25,1441,-180,0.25)”, # lat\_cells, corner\_lat, lat\_resolution, lon\_cells, corner\_lon, lon\_resolution,  
“derive(O3\_column\_number\_density)”,  
“derive(latitude {latitude})”,  
“derive(longitude {longitude})”,  
])

reduce\_operations = “squash(time, (latitude, longitude, latitude\_bounds, longitude\_bounds));bin()”  
merged = harp.import\_product(path+filename, operations, reduce\_operations=reduce\_operations)

The above is my code

---

<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 5, 2023, 1:31pm UTC](https://forum.atmospherictoolbox.org/t/what-are-the-errors-in-my-code-to-visualize-sentinel-5p-ozone-using-python/618/3 "2023-03-05T13:31:55Z")

</div>

There are two things wrong with your code.

First, you are not including `O3_column_number_density` in the `keep()` operation, so you are effectively throwing it away yourself.

Second, I don’t know what you are trying to achieve with the `derive(O3_column_number_density)` operation, since it effectively does nothing. You either have to pass a dimension to have the variable be derived from other variables in the product (if possible, which in this case it will not be, because you need to take the variable as-is). Or you will have to provide a unit or data type in case you just want to perform a unit or data type conversion of the variable. See also the [documentation](http://stcorp.github.io/harp/doc/html/operations.html).

Also, have a look at the [use cases that are available online](https://atmospherictoolbox.org/usecases/). The examples given there should be instructive enough to get a better understanding of the HARP operations themselves.
