# Plotting L3 data with avl.Geo

**URL:** https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764
**Category:** AVL
**Created:** [March 1, 2024, 2:27pm UTC](https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764 "2024-03-01T14:27:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jvgent](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/j/8e7dd6/32.png) [@jvgent](https://forum.atmospherictoolbox.org/u/jvgent)
#### Post date: [March 1, 2024, 2:27pm UTC](https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764/1 "2024-03-01T14:27:07Z")

</div>

Dear forum,  
I am trying to use avl in a Jupyter notebook to plot L3 data on a map with a command like:  
`avl.Geo(l3product, varname, colorrange=(0.,6.e16))`

l3product is the result of an `harp.import_product` command.

However, I get an error message, saying `UnboundLocalError: cannot access local variable 'data_type' where it is not associated with a value` plus a bunch of diagnostics that boil down to: `raise Exception('invalid lat/lon/data dimensions')`

According to: `https://github.com/stcorp/avl-demo-lps2022/blob/main/geo2d.md`, plotting of L3 should be possible. The L3 data dimensions look okay to me.

What am I missing here?

---

<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 1, 2024, 3:11pm UTC](https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764/2 "2024-03-01T15:11:18Z")

</div>

Can you let me know the content of the l3product (e.g. `print(l3product)`). This might be due to the existence of a `time` dimension.

---

<div class="post-metadata">

### Author: ![jvgent](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/j/8e7dd6/32.png) [@jvgent](https://forum.atmospherictoolbox.org/u/jvgent)
#### Post date: [March 1, 2024, 3:16pm UTC](https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764/3 "2024-03-01T15:16:43Z")

</div>

`print(l3product)` shows indeed a time dimension, but of length 1, which is normal, no?

```auto
history = "2024-03-01T15:15:38Z [harp-1.20.2] harp.import_product('C:/Users/jeroenv/Data/avl/2023/06/13\\S5P_OFFL_L2 __HCHO___ 20230613T230204_20230614T004334_29362_03_020401_20230615T150140.nc',operations='tropospheric_HCHO_column_number_density_validity>50;keep(latitude_bounds,longitude_bounds,datetime_start,datetime_length,tropospheric_HCHO_column_number_density);derive(datetime_stop {time} [days since 2000-01-01]);derive(datetime_start [days since 2000-01-01]);exclude(datetime_length);bin_spatial(361,-90,0.5,721,-180,0.5);derive(latitude {latitude});derive(longitude {longitude})',reduce_operations='squash(time, (latitude, longitude, latitude_bounds, longitude_bounds));bin()')"

double datetime_start {time=1} [days since 2000-01-01]
double tropospheric_HCHO_column_number_density {time=1, latitude=360, longitude=720} [mol/m^2]
double datetime_stop {time=1} [days since 2000-01-01]
long count {time=1}
float weight {time=1, latitude=360, longitude=720}
double latitude_bounds {latitude=360, 2} [degree_north]
double longitude_bounds {longitude=720, 2} [degree_east]
double latitude {latitude=360} [degree_north]
double longitude {longitude=720} [degree_east]

```

---

<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 4, 2024, 8:53am UTC](https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764/4 "2024-03-04T08:53:22Z")

</div>

Having a time dimension for grids is still something we need to support better in AVL (specifically the length=1 case), but for now you can explicitly remove the time dimension of the grid by using the `squash` operation (as is already done for the lat/lon variables):

You can add a `post_operations` argument to your import having: `squash(time, (tropospheric_HCHO_column_number_density, weight))`.

---

<div class="post-metadata">

### Author: ![jvgent](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/j/8e7dd6/32.png) [@jvgent](https://forum.atmospherictoolbox.org/u/jvgent)
#### Post date: [March 4, 2024, 9:23am UTC](https://forum.atmospherictoolbox.org/t/plotting-l3-data-with-avl-geo/764/5 "2024-03-04T09:23:13Z")

</div>

Ah yes, of course. Thank you very much.
