# Error opening SCIAMACHY files in python

**URL:** https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558
**Category:** CODA
**Tags:** sciamachy, python
**Created:** [September 9, 2022, 8:54pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558 "2022-09-09T20:54:59Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Dhyey](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@Dhyey](https://forum.atmospherictoolbox.org/u/Dhyey)
#### Post date: [September 9, 2022, 8:55pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/1 "2022-09-09T20:55:00Z")

</div>

Hi, I am trying to open SCIAMACHY Level 1b v8.0 data product having `.N1` file format.

I have installed coda using `$ conda install -c conda-forge coda`.

There was no `definitions` directory in `/$prefix/share/coda/definitions`. I have created definitions directory and copied `ENVISAT_SCIAMACHY-20180102.codadef` in that directory.

While using python I am also providing CODA\_DEFINITION by `os.putenv('CODA_DEFINITION', '<your codadef search path>')`

I am still getting error “unsupported product file” while using `coda.open( )`.

I need guidance on what I am missing here.

Thanks,  
Dhyey.

---

<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: [September 12, 2022, 9:05am UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/2 "2022-09-12T09:05:33Z")

</div>

I hope you are not literally using `$prefix` and `<your codadef search path>`. Did you actually replace these with the actual paths?

---

<div class="post-metadata">

### Author: ![Dhyey](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@Dhyey](https://forum.atmospherictoolbox.org/u/Dhyey)
#### Post date: [September 12, 2022, 5:07pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/3 "2022-09-12T17:07:07Z")

</div>

Yes. I replaced it with my paths.

---

<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: [September 13, 2022, 6:08am UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/4 "2022-09-13T06:08:21Z")

</div>

Then please provide the commands/paths that you were actually using. Please also provide the conda environment path of the conda environment in which you installed coda.

---

<div class="post-metadata">

### Author: ![Dhyey](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@Dhyey](https://forum.atmospherictoolbox.org/u/Dhyey)
#### Post date: [September 13, 2022, 6:07pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/5 "2022-09-13T18:07:13Z")

</div>

I have an anaconda environment named `coda` under path, `/Users/dhyey/opt/anaconda3/envs/coda/`.

There was no `definitions` directory under coda. I created a directory and have copied coda definition for SCIAMACHY with the following path `/Users/dhyey/opt/anaconda3/envs/coda/share/coda/definitions`.

The definition I am using is - `ENVISAT_SCIAMACHY-20180102.codadef`.

Thanks a lot. I will be happy to provide any other information required.  
Dhyey.

---

<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: [September 14, 2022, 11:27am UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/6 "2022-09-14T11:27:08Z")

</div>

That all looks ok.

Are you calling the `putenv` before the coda import as is also mentioned [here](https://forum.atmospherictoolbox.org/t/coda-unsupported-product-file-for-aeolus/308/4)?

---

<div class="post-metadata">

### Author: ![Dhyey](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@Dhyey](https://forum.atmospherictoolbox.org/u/Dhyey)
#### Post date: [September 14, 2022, 5:20pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/7 "2022-09-14T17:20:33Z")

</div>

Yes, here are my import statements,  
`import os`  
`os.putenv('CODA_DEFINITION', '/Users/dhyey/opt/anaconda3/envs/coda/share/coda/definitions')`  
`import coda`

---

<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: [September 15, 2022, 8:43am UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/8 "2022-09-15T08:43:55Z")

</div>

Then I don’t know what is going wrong.

If I create a conda environment like that and put the .codadef file in a created definitions subfolder things work for me:

```auto
% ls -l /Users/sander/mambaforge/envs/coda/share/coda/definitions
total 312
-rw-r--r--@ 1 sander staff 158928 Sep 15 10:36 ENVISAT_SCIAMACHY-20180102.codadef

% cat sciatest.py 
import os
os.putenv('CODA_DEFINITION', '/Users/sander/mambaforge/envs/coda/share/coda/definitions')
import coda

with coda.open('SCI_NL__1PYDPA20120408_102637_000017863113_00267_52867_0000.N1') as product:
    print(product.fetch('/mph/product'))

% python sciatest.py                                               
SCI_NL__1PYDPA20120408_102637_000017863113_00267_52867_0000.N1

```

---

<div class="post-metadata">

### Author: ![Dhyey](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/d/9de0a6/32.png) [@Dhyey](https://forum.atmospherictoolbox.org/u/Dhyey)
#### Post date: [September 16, 2022, 11:01pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/9 "2022-09-16T23:01:41Z")

</div>

I was able to run it finally. I deleted the conda environment and repeated all the steps from scratch. I did everything the same and strangely it worked this time. You can close this query. Thank you so much for all your help and time.

Thanks,  
Dhyey.

---

<div class="post-metadata">

### Author: ![Simon](https://forum.atmospherictoolbox.org/letter_avatar_proxy/v4/letter/s/f07891/32.png) [@Simon](https://forum.atmospherictoolbox.org/u/Simon)
#### Post date: [October 28, 2023, 12:35pm UTC](https://forum.atmospherictoolbox.org/t/error-opening-sciamachy-files-in-python/558/10 "2023-10-28T12:35:29Z")

</div>

could you plz tell me how to transform N1 format to nc format or HDF5 format，thank you.  
I am also using this kind of document and hope to discuss it with you.
