From eb668bdbd7a11adfa441fc9321040c011fc22919 Mon Sep 17 00:00:00 2001 From: Jessica Scheick Date: Tue, 14 Nov 2023 14:57:27 -0500 Subject: [PATCH] fix ATL08 delta_time dimension read error (#470) Co-authored-by: GitHub Action --- .../documentation/classes_dev_uml.svg | 88 +++++++++---------- icepyx/core/read.py | 13 ++- 2 files changed, 49 insertions(+), 52 deletions(-) diff --git a/doc/source/user_guide/documentation/classes_dev_uml.svg b/doc/source/user_guide/documentation/classes_dev_uml.svg index fd5033938..8e83d4dc1 100644 --- a/doc/source/user_guide/documentation/classes_dev_uml.svg +++ b/doc/source/user_guide/documentation/classes_dev_uml.svg @@ -33,13 +33,13 @@ EarthdataAuthMixin -_auth : Auth, NoneType -_s3_initial_ts : NoneType, datetime -_s3login_credentials : NoneType, dict -_session : NoneType, Session -auth -s3login_credentials -session +_auth : NoneType +_s3_initial_ts : NoneType, datetime +_s3login_credentials : NoneType +_session : NoneType +auth +s3login_credentials +session __init__(auth) __str__() @@ -48,14 +48,14 @@ icepyx.core.query.GenQuery - -GenQuery - -_spatial -_temporal - -__init__(spatial_extent, date_range, start_time, end_time) -__str__() + +GenQuery + +_spatial +_temporal + +__init__(spatial_extent, date_range, start_time, end_time) +__str__() @@ -229,8 +229,8 @@ icepyx.core.query.Query->icepyx.core.query.GenQuery - - + + @@ -238,7 +238,7 @@ Read -_filelist : list, NoneType +_filelist : NoneType, list _out_obj : Dataset _pattern : str _prod : str @@ -259,37 +259,37 @@ icepyx.core.spatial.Spatial - -Spatial - -_ext_type : str -_gdf_spat : GeoDataFrame, DataFrame -_geom_file : NoneType -_spatial_ext -_xdateln -extent -extent_as_gdf -extent_file -extent_type - -__init__(spatial_extent) -__str__() -fmt_for_CMR() -fmt_for_EGI() + +Spatial + +_ext_type : str +_gdf_spat : GeoDataFrame +_geom_file : NoneType +_spatial_ext +_xdateln +extent +extent_as_gdf +extent_file +extent_type + +__init__(spatial_extent) +__str__() +fmt_for_CMR() +fmt_for_EGI() icepyx.core.spatial.Spatial->icepyx.core.query.GenQuery - - -_spatial + + +_spatial icepyx.core.spatial.Spatial->icepyx.core.query.GenQuery - - -_spatial + + +_spatial @@ -308,9 +308,9 @@ icepyx.core.temporal.Temporal->icepyx.core.query.GenQuery - - -_temporal + + +_temporal diff --git a/icepyx/core/read.py b/icepyx/core/read.py index a7ee15db7..627395be2 100644 --- a/icepyx/core/read.py +++ b/icepyx/core/read.py @@ -279,7 +279,7 @@ class Read: String that shows the filename pattern as required for Intake's path_as_pattern argument. The default describes files downloaded directly from NSIDC (subsetted and non-subsetted) for most products (e.g. ATL06). The ATL11 filename pattern from NSIDC is: 'ATL{product:2}_{rgt:4}{orbitsegment:2}_{cycles:4}_{version:3}_{revision:2}.h5'. - + catalog : string, default None Full path to an Intake catalog for reading in data. If you still need to create a catalog, leave as default. @@ -313,8 +313,8 @@ def __init__( # Raise error for depreciated argument if catalog: raise DeprecationError( - 'The `catalog` argument has been deprecated and intake is no longer supported. ' - 'Please use the `data_source` argument to specify your dataset instead.' + "The `catalog` argument has been deprecated and intake is no longer supported. " + "Please use the `data_source` argument to specify your dataset instead." ) if data_source is None: @@ -616,11 +616,8 @@ def _combine_nested_vars(is2ds, ds, grp_path, wanted_dict): except (AttributeError, KeyError): pass - try: - is2ds = is2ds.assign(ds[grp_spec_vars]) - except xr.MergeError: - ds = ds[grp_spec_vars].reset_coords() - is2ds = is2ds.assign(ds) + ds = ds[grp_spec_vars].swap_dims({"delta_time": "photon_idx"}) + is2ds = is2ds.assign(ds) return is2ds