Hi,
New user here. I’m trying to get familiar with icepyx for downloading and loading up some ATL06 data for my upcoming thesis project. The following works well:
path_root = 'data/raw/external/IS2/'
pattern = "processed_ATL{product:2}_{datetime:%Y%m%d%H%M%S}_{rgt:4}{cycle:2}{orbistsegment:2}_{version:3}_{revision:2}.h5"
reader = ipx.Read(path_root, "ATL06", pattern)
reader.vars.append(var_list=["h_li", "latitude", "longitude"])
ds = reader.load()
But if I try to add a variable to var_list, e.g ‘bsnow_h’, the load method throws a KeyError (see below). I’m digging into the code to try and find where it is going wrong but thought I’d check here in case I’m missing something obvious in how to use it?
Traceback (most recent call last):
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/xarray/core/dataset.py", line 1394, in _construct_dataarray
variable = self._variables[name]
KeyError: 'data_start_utc'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/spyder_kernels/py3compat.py", line 356, in compat_exec
exec(code, globals, locals)
File "/home/petter/study/master_thesis/untitled0.py", line 25, in <module>
ds = reader.load()
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/icepyx/core/read.py", line 542, in load
self._build_single_file_dataset(file, groups_list)
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/icepyx/core/read.py", line 692, in _build_single_file_dataset
ds = Read._combine_nested_vars(
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/icepyx/core/read.py", line 497, in _combine_nested_vars
is2ds = _make_np_datetime(is2ds, "data_start_utc")
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/icepyx/core/read.py", line 47, in _make_np_datetime
if df[keyword].str.endswith("Z"):
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/xarray/core/dataset.py", line 1498, in __getitem__
return self._construct_dataarray(key)
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/xarray/core/dataset.py", line 1396, in _construct_dataarray
_, name, variable = _get_virtual_variable(
File "/home/petter/anaconda3/envs/geospatial/lib/python3.9/site-packages/xarray/core/dataset.py", line 169, in _get_virtual_variable
ref_var = variables[ref_name]
KeyError: 'data_start_utc'
There is a single file in path_root which I downloaded via icepyx and the following settings:
short_name = 'ATL06'
spatial_extent =[18.13484764933186, 78.2490150412966, 19.482866502306077, 78.41061132951246]
date_range = ['2022-02-01', '2022-05-01']
rgts = ['0831']
spatial_extent
region = ipx.Query(short_name,
spatial_extent,
date_range,
tracks = rgts,
)
Thanks - Petter
Edit: I noticed the similarities to this post: Reader.load() issues with ATL06 - #5 by JennyFArthur. The file I’m trying to laod does include all the GTs though.