diff --git a/icepyx/core/read.py b/icepyx/core/read.py index b62e5d2fe..e136a1d64 100644 --- a/icepyx/core/read.py +++ b/icepyx/core/read.py @@ -320,7 +320,7 @@ class Read: # ---------------------------------------------------------------------- # Constructors - + def __init__( self, data_source=None, # DevNote: Make this a required arg when catalog is removed @@ -336,7 +336,7 @@ def __init__( "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: raise ValueError("data_source is a required arguemnt") # Raise warnings for deprecated arguments @@ -457,7 +457,7 @@ def vars(self): if not hasattr(self, "_read_vars"): self._read_vars = Variables(path=self.filelist[0]) return self._read_vars - + @property def filelist(self): """ @@ -591,13 +591,11 @@ def _add_vars_to_ds(is2ds, ds, grp_path, wanted_groups_tiered, wanted_dict): .assign_coords( { spot_dim_name: (spot_dim_name, [spot]), - "delta_time": ("delta_time", photon_ids), + "photon_idx": ("delta_time", photon_ids), } ) .assign({spot_var_name: (("gran_idx", spot_dim_name), [[track_str]])}) - .rename_dims({"delta_time": "photon_idx"}) - .rename({"delta_time": "photon_idx"}) - # .set_index("photon_idx") + .swap_dims({"delta_time": "photon_idx"}) ) # handle cases where the delta time is 2d due to multiple cycles in that group @@ -605,8 +603,6 @@ def _add_vars_to_ds(is2ds, ds, grp_path, wanted_groups_tiered, wanted_dict): ds = ds.assign_coords( {"delta_time": (("photon_idx", "cycle_number"), hold_delta_times)} ) - else: - ds = ds.assign_coords({"delta_time": ("photon_idx", hold_delta_times)}) # for ATL11 if "ref_pt" in ds.coords: @@ -721,15 +717,15 @@ def load(self): if not self.vars.wanted: raise AttributeError( - 'No variables listed in self.vars.wanted. Please use the Variables class ' - 'via self.vars to search for desired variables to read and self.vars.append(...) ' - 'to add variables to the wanted variables list.' + "No variables listed in self.vars.wanted. Please use the Variables class " + "via self.vars to search for desired variables to read and self.vars.append(...) " + "to add variables to the wanted variables list." ) - + # Append the minimum variables needed for icepyx to merge the datasets # Skip products which do not contain required variables - if self.product not in ['ATL14', 'ATL15', 'ATL23']: - var_list=[ + if self.product not in ["ATL14", "ATL15", "ATL23"]: + var_list = [ "sc_orient", "atlas_sdp_gps_epoch", "cycle_number", @@ -743,7 +739,7 @@ def load(self): var_list.remove("sc_orient") self.vars.append(defaults=False, var_list=var_list) - + try: groups_list = list_of_dict_vals(self.vars.wanted) except AttributeError: