# Error while trying to open ATL08 file with icepyx

**URL:** <https://discourse.pangeo.io/t/error-while-trying-to-open-atl08-file-with-icepyx/2313>\
**Category:** ICESat-2\
**Created:** [March 12, 2022, 6:08pm UTC](https://discourse.pangeo.io/t/error-while-trying-to-open-atl08-file-with-icepyx/2313 "2022-03-12T18:08:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlourenco](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/rlourenco/32/2667_2.png) [@rlourenco](https://discourse.pangeo.io/u/rlourenco)\
**Post date:** [March 12, 2022, 6:08pm UTC](https://discourse.pangeo.io/t/error-while-trying-to-open-atl08-file-with-icepyx/2313/1 "2022-03-12T18:08:00Z")

</div>

Hi everyone! New icepyx user here 🙂

I am trying to open a single ATL8 file (manually from the Earthdata portal), and everything goes fine up to a weird crash (a full gist is [here](https://gist.github.com/ricardobarroslourenco/4edc56827862bb64c3aa0985e5b9d6e2)):

```auto
filepath = './ATL08_20200614005307_12140704_005_01.h5'
reader = ipx.Read(filepath, "ATL08")
reader.vars.append(beam_list=['gt1l','gt1r','gt2l','gt2r','gt3l','gt3r'], var_list=["h_canopy", "latitude", "longitude"])

ds = reader.load()
ds

---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Input In [7], in <cell line: 1>()
----> 1 ds = reader.load()
      2 ds

File ~/miniconda3/envs/cpu-pangeo/lib/python3.8/site-packages/icepyx/core/read.py:443, in Read.load(self)
    436 # DevNote: I'd originally hoped to rely on intake-xarray in order to not have to iterate through the files myself,
    437 # by providing a generalized url/source in building the catalog.
    438 # However, this led to errors when I tried to combine two identical datasets because the single dimension was equal.
    439 # In these situations, xarray recommends manually controlling the merge/concat process yourself.
    440 # While unlikely to be a broad issue, I've heard of multiple matching timestamps causing issues for combining multiple IS2 datasets.
    441 for file in self._filelist:
    442 all_dss.append(
--> 443 self._build_single_file_dataset(file, groups_list)
    444 ) # wanted_groups, vgrp.keys()))
    446 if len(all_dss) == 1:
    447 return all_dss[0]

File ~/miniconda3/envs/cpu-pangeo/lib/python3.8/site-packages/icepyx/core/read.py:577, in Read._build_single_file_dataset(self, file, groups_list)
    575 for grp_path in ["orbit_info"] + list(wanted_groups_set):
    576 ds = self._read_single_var(file, grp_path)
--> 577 is2ds = Read._add_var_to_ds(
    578 is2ds, ds, grp_path, wanted_groups_tiered, wanted_dict
    579 )
    581 return is2ds

File ~/miniconda3/envs/cpu-pangeo/lib/python3.8/site-packages/icepyx/core/read.py:342, in Read._add_var_to_ds(is2ds, ds, grp_path, wanted_groups_tiered, wanted_dict)
    339 wanted_vars = list(wanted_dict.keys())
    341 if grp_path in ["orbit_info", "ancillary_data"]:
--> 342 grp_spec_vars = [
    343 wanted_vars[i]
    344 for i, x in enumerate(wanted_groups_tiered[0])
    345 if x == grp_path
    346 ]
    348 for var in grp_spec_vars:
    349 is2ds = is2ds.assign({var: ("gran_idx", ds[var].data)})

File ~/miniconda3/envs/cpu-pangeo/lib/python3.8/site-packages/icepyx/core/read.py:343, in <listcomp>(.0)
    339 wanted_vars = list(wanted_dict.keys())
    341 if grp_path in ["orbit_info", "ancillary_data"]:
    342 grp_spec_vars = [
--> 343 wanted_vars[i]
    344 for i, x in enumerate(wanted_groups_tiered[0])
    345 if x == grp_path
    346 ]
    348 for var in grp_spec_vars:
    349 is2ds = is2ds.assign({var: ("gran_idx", ds[var].data)})

IndexError: list index out of range

```

Any suggestions on what may be going on?

---

<div class="post-metadata">

**Author:** ![weiji14](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pangeo.io/weiji14/32/389_2.png) [@weiji14](https://discourse.pangeo.io/u/weiji14)\
**Post date:** [March 28, 2022, 5:30pm UTC](https://discourse.pangeo.io/t/error-while-trying-to-open-atl08-file-with-icepyx/2313/2 "2022-03-28T17:30:17Z")

</div>

Hi @rlourenco, just to follow up in case anyone has the same issue. This `IndexError` was a bug in the read.py code (see details [IndexError: list index out of range · Issue #277 · icesat2py/icepyx · GitHub](https://github.com/icesat2py/icepyx/issues/277)), which has since been fixed in [add read-in functionality for deeply nested variables by JessicaS11 · Pull Request #281 · icesat2py/icepyx · GitHub](https://github.com/icesat2py/icepyx/pull/281).

So if you update to IcePyx v0.6.2 or newer (instructions at [Installation — icepyx documentation](https://icepyx.readthedocs.io/en/latest/getting_started/install.html)), this shouldn’t be a problem anymore.
