Skip to content

Commit

Permalink
fix variable_id definition in postprocessor catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
wrongkindofdoctor committed Feb 21, 2025
1 parent dd7752d commit d61c87a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,9 @@ def normalize_group_time_vals(self, time_vals: np.ndarray) -> np.ndarray:
def drop_attributes(self, xr_ds: xr.Dataset) -> xr.Dataset:
""" Drop attributes that cause conflicts with xarray dataset merge"""
drop_atts = ['average_T2',
'time_bnds',
'lat_bnds',
'lon_bnds',
#'time_bnds',
#'lat_bnds',
#'lon_bnds',
'average_DT',
'average_T1',
'height',
Expand All @@ -853,10 +853,10 @@ def drop_attributes(self, xr_ds: xr.Dataset) -> xr.Dataset:
for att in drop_atts:
if xr_ds.get(att, None) is not None:
xr_ds = xr_ds.drop_vars(att)
for coord in xr_ds.coords:
if 'bounds' in xr_ds[coord].attrs:
if xr_ds[coord].attrs['bounds'] == att:
del xr_ds[coord].attrs['bounds']
#for coord in xr_ds.coords:
# if 'bounds' in xr_ds[coord].attrs:
# if xr_ds[coord].attrs['bounds'] == att:
# del xr_ds[coord].attrs['bounds']
return xr_ds

def check_multichunk(self, group_df: pd.DataFrame, case_dr, log) -> pd.DataFrame:
Expand Down Expand Up @@ -1638,6 +1638,7 @@ def write_pp_catalog(self,
d.update({'time_range': f'{util.cftime_to_str(ds_match.time.values[0]).replace('-',':')}-'
f'{util.cftime_to_str(ds_match.time.values[-1]).replace('-',':')}'})
d.update({'standard_name': ds_match[var.name].attrs['standard_name']})
d.update({'variable_id': var_name})
cat_entries.append(d)

# create a Pandas dataframe from the catalog entries
Expand Down

0 comments on commit d61c87a

Please sign in to comment.