I am trying to visualize Sentinel 5P Ozone using python. I am getting the following errors and how can I fix these
?
I am trying to visualize Sentinel 5P Ozone using python. I am getting the following errors and how can I fix these
?
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
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.
Also, have a look at the use cases that are available online. The examples given there should be instructive enough to get a better understanding of the HARP operations themselves.