# Cannot keep non-existent variable

**URL:** https://forum.atmospherictoolbox.org/t/cannot-keep-non-existent-variable/331
**Category:** HARP
**Tags:** sentinel-5p, python
**Created:** [May 24, 2021, 12:20pm UTC](https://forum.atmospherictoolbox.org/t/cannot-keep-non-existent-variable/331 "2021-05-24T12:20:15Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sgudimella](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@sgudimella](https://forum.atmospherictoolbox.org/u/sgudimella)
#### Post date: [May 24, 2021, 12:20pm UTC](https://forum.atmospherictoolbox.org/t/cannot-keep-non-existent-variable/331/1 "2021-05-24T12:20:15Z")

</div>

Hi Sander

I am trying to derive some variables from a L2 NO2 product as shown below:

harp.import\_product([‘S5P\_OFFL\_L2\_\_NO2\_\_\_\_20200706T110830\_20200706T125000\_14146\_01\_010302\_20200708T040350.nc’, ‘S5P\_OFFL\_L2\_\_NO2\_\_\_\_20200706T092701\_20200706T110830\_14145\_01\_010302\_20200708T020157.nc’, ‘S5P\_OFFL\_L2\_\_NO2\_\_\_\_20200706T005932\_20200706T024102\_14140\_01\_010302\_20200707T172142.nc’, ‘S5P\_OFFL\_L2\_\_NO2\_\_\_\_20200707T004028\_20200707T022158\_14154\_01\_010302\_20200708T165056.nc’, ‘S5P\_OFFL\_L2\_\_NO2\_\_\_\_20200707T090756\_20200707T104926\_14159\_01\_010302\_20200709T013018.nc’,‘S5P\_OFFL\_L2\_\_NO2\_\_\_\_20200707T104926\_20200707T123056\_14160\_01\_010302\_20200709T034441.nc’], operations=“tropospheric\_NO2\_column\_number\_density\_validity \> 75;derive(NO2\_column\_number\_density[Pmolec/cm2]);derive(NO2\_column\_number\_density\_uncertainty[Pmolec/cm2]);derive(NO2\_slant\_column\_number\_density[Pmolec/cm2]);derive(NO2\_slant\_column\_number\_density\_uncertainty[Pmolec/cm2]);derive(tropospheric\_NO2\_column\_number\_density[Pmolec/cm2]);derive(tropospheric\_NO2\_column\_number\_density\_uncertainty[Pmolec/cm2]);derive(stratospheric\_NO2\_column\_number\_density[Pmolec/cm2]); derive(stratospheric\_NO2\_column\_number\_density\_uncertainty[Pmolec/cm2]);keep(tropospheric\_NO2\_column\_number\_density,tropospheric\_NO2\_column\_number\_density\_uncertainty,tropospheric\_NO2\_column\_number\_density\_validity,tropospheric\_NO2\_column\_number\_density\_amf,NO2\_column\_number\_density,NO2\_column\_number\_density\_uncertainty,NO2\_column\_number\_density\_amf,cloud\_fraction,absorbing\_aerosol\_index,cloud\_albedo,cloud\_pressure,surface\_albedo,surface\_altitude,surface\_altitude\_uncertainty,surface\_pressure,surface\_meridional\_wind\_velocity,surface\_zonal\_wind\_velocity,NO2\_column\_number\_density,tropospheric\_NO2\_column\_number\_density, stratospheric\_NO2\_column\_number\_density,NO2\_slant\_column\_number\_density, tropopause\_pressure,absorbing\_aerosol\_index,cloud\_fraction, sensor\_altitude,sensor\_azimuth\_angle, sensor\_zenith\_angle,solar\_azimuth\_angle,solar\_zenith\_angle, latitude, longitude);bin\_spatial(1975,38.025,0.01,2355,11.815,0.01);derive(longitude{longitude});derive(latitude{latitude});;keep(latitude,longitude,solar\_zenith\_angle,sensor\_zenith\_angle,NO2\_column\_number\_density,tropospheric\_NO2\_column\_number\_density,stratospheric\_NO2\_column\_number\_density,NO2\_column\_number\_density\_uncertainty,tropospheric\_NO2\_column\_number\_density\_uncertainty,stratospheric\_NO2\_column\_number\_density\_uncertainty,cloud\_fraction,cloud\_pressure, orbit\_index,NO2\_slant\_column\_number\_density,NO2\_slant\_column\_number\_density\_uncertainty)”, post\_operations=“bin()”)

When I run this I get this error:  
CLibraryError: cannot keep non-existent variable NO2\_column\_number\_density\_uncertainty

I am not sure if I’m doing it correctly or not and if the order of the derive functions are correct or not. Could you please advise?

Also, all the examples I’ve seen are deriving NO2 values in [Pmolec/cm2] but I need it molec/m2. Based on the harp documentation I tried this with both [mol/m^2] as well as [molec/m2] but neither worked. How can I do this?

Really appreciate your help.

Thanks!

---

<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: [May 25, 2021, 11:04am UTC](https://forum.atmospherictoolbox.org/t/cannot-keep-non-existent-variable/331/2 "2021-05-25T11:04:50Z")

</div>

You are probably using a HARP version older than v1.12.  
In HARP v1.12 we introduced uncertainty propagation when you perform a `bin_spatial` and/or `bin` operation.

---

<div class="post-metadata">

### Author: ![sgudimella](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/s/a6a055/32.png) [@sgudimella](https://forum.atmospherictoolbox.org/u/sgudimella)
#### Post date: [May 25, 2021, 5:49pm UTC](https://forum.atmospherictoolbox.org/t/cannot-keep-non-existent-variable/331/3 "2021-05-25T17:49:35Z")

</div>

Thanks for responding! I am unable to upgrade harp to v1.12. My current version is v1.11. Is there a specific to upgrade? I couldn’t find anything online either about this.

---

<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: [May 26, 2021, 7:26am UTC](https://forum.atmospherictoolbox.org/t/cannot-keep-non-existent-variable/331/4 "2021-05-26T07:26:06Z")

</div>

You can find the change history in the [CHANGES file](https://github.com/stcorp/harp/blob/master/CHANGES) or in the description for each of the HARP releases (e.g. [HARP v1.12](https://github.com/stcorp/harp/releases/tag/1.12)).  
Note that we are currently at HARP v1.13 and it is recommended to use the latest release.
