Skip to content

Commit

Permalink
update group handling for unicode data types
Browse files Browse the repository at this point in the history
  • Loading branch information
sliu008 committed Nov 30, 2023
1 parent 810990d commit dd345b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion podaac/subsetter/group_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,16 @@ def _rename_variables(dataset: xr.Dataset, base_dataset: nc.Dataset, start_date,
elif variable.dtype in ['|S1', '|S2']:
var_group.createVariable(new_var_name, variable.dtype, var_dims, fill_value=fill_value)
else:
if np.issubdtype(variable.dtype, np.unicode_):
comp_args["zlib"] = False
var_group.createVariable(new_var_name, variable.dtype, var_dims, fill_value=fill_value, **comp_args)

# Copy attributes
var_group.variables[new_var_name].setncatts(var_attrs)

# Copy data
var_group.variables[new_var_name].set_auto_maskandscale(False)
if variable.dtype in ['|S1', '|S2']:
if variable.dtype in ['|S1', '|S2'] or np.issubdtype(variable.dtype, np.unicode_):
var_group.variables[new_var_name][:] = variable.values
else:
var_group.variables[new_var_name][:] = var_data
Expand Down

0 comments on commit dd345b8

Please sign in to comment.