# SCIAMACHY L2 to L3 with CODA?

**URL:** https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283
**Category:** CODA
**Tags:** python
**Created:** [March 8, 2021, 3:44pm UTC](https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283 "2021-03-08T15:44:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![corisanucci](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/corisanucci/32/120_2.png) [@corisanucci](https://forum.atmospherictoolbox.org/u/corisanucci)
#### Post date: [March 8, 2021, 3:44pm UTC](https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283/1 "2021-03-08T15:44:23Z")

</div>

Hi! Sander, you have helped me a lot for working with the SCIAMACHY CH4 data in HARP, thank you so much! Now I have a new problem haha ​​(cries). I was communicating with Mr. Lichtenberg from the German Aerospace Center, he explained to me that the limit values ​​of some parameters (alpha errors) necessary for the correct filtering of the CH4 data are not set correctly in the `flag_vcd_flags` field within the files. This is because the code had to be ready for testing, and the exact limit values ​​were not known at that time.

So he recommends that I filter directly from the `non_linear_fit_param_err` field (this contains the alpha errors). Since this field is not ingested by HARP, he recommends that I work directly with CODA. My problem is that I cannot find examples of how to use CODA, I have no idea, and in addition to this I know that geolocation of SCIAMACHY can be complicated, this is something that HARP already solved very well.

My question at this point is, is there a way to filter from that field using CODA and then derive the output to HARP?

---

<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 8, 2021, 4:39pm UTC](https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283/2 "2021-03-08T16:39:08Z")

</div>

This is possible. You would have to read the additional parameter with coda. And then add it to the HARP product before you perform any filtering.  
And after combining the data you can perform the filtering.

For instance:

```
product = harp.import_product("SCI_OL__2PYDPA20060101_010721_000035612043_00475_20068_0000.N1", options="dataset=nad_ir1_ch4")
pf = coda.open("SCI_OL__2PYDPA20060101_010721_000035612043_00475_20068_0000.N1")
product.err0 = harp.Variable(coda.fetch(pf, "nad_ir1_ch4", -1, "non_linear_fit_param_err", 0), ["time"])
product.err1 = harp.Variable(coda.fetch(pf, "nad_ir1_ch4", -1, "non_linear_fit_param_err", 1), ["time"])
product.err2 = harp.Variable(coda.fetch(pf, "nad_ir1_ch4", -1, "non_linear_fit_param_err", 2), ["time"])
coda.close(pf)
filtered_product = harp.execute_operations(product, 'scan_direction_type=="forward";err0>=0')
```

---

<div class="post-metadata">

### Author: ![corisanucci](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/corisanucci/32/120_2.png) [@corisanucci](https://forum.atmospherictoolbox.org/u/corisanucci)
#### Post date: [March 14, 2021, 11:22pm UTC](https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283/3 "2021-03-14T23:22:54Z")

</div>

This is great! Thank you very much for your quick response. I am already testing it in my code and everything runs perfectly.

I’m not sure if I fully understand the -1 argument. I understand that with the indexes at the end (0,1,2) you are calling each entry of the field (each of the errors separately). In the [documentation](https://stcorp.github.io/coda/doc/html/python/index.html#coda_fetch) it says that _“If you supply a -1 for one or more of the dimensions of an array, you will get all the elements in the specified dimensions”_, then I guess that I’m fetching the errors in time dimension? (because of the [“time”] argument at the end), or is it something different?

---

<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 15, 2021, 8:12am UTC](https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283/4 "2021-03-15T08:12:00Z")

</div>

You have indeed understood it correctly. The -1 argument is provided for the ‘list of measurement data set records’. And this list corresponds to the time dimension, since there is one record for each measurement.

---

<div class="post-metadata">

### Author: ![corisanucci](https://forum.atmospherictoolbox.org/user_avatar/forum.atmospherictoolbox.org/corisanucci/32/120_2.png) [@corisanucci](https://forum.atmospherictoolbox.org/u/corisanucci)
#### Post date: [March 15, 2021, 2:22pm UTC](https://forum.atmospherictoolbox.org/t/sciamachy-l2-to-l3-with-coda/283/5 "2021-03-15T14:22:54Z")

</div>

Thank you very much! 🖥 🤩
