You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some obsarray functionality raises an error for uncertainty variables where the unc_comp attribute is a string rather than a list. This can arise when there is only one uncertainty component for a variable. Obsarray should be able to handle unc_comps as a list or a string.
e.g.
line run:
del ds.unc[obs_var][var]
error:
Traceback (most recent call last):
File "C:\Users\mes\Anaconda3\envs\eoio\lib\site-packages\IPython\core\interactiveshell.py", line 3508, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
del ds.unc[obs_var][var]
File "c:\users\mes\code\pycharmprojects\obsarray\obsarray\unc_accessor.py", line 424, in delitem
self._obj.unc._remove_unc_var(self._var_name, unc_var)
File "c:\users\mes\code\pycharmprojects\obsarray\obsarray\unc_accessor.py", line 898, in _remove_unc_var
self._obj[obs_var].attrs["unc_comps"].remove(unc_var)
AttributeError: 'str' object has no attribute 'remove'
Still an issue for del ds.unc[obs_var][unc_var], which fails with AttributeError: 'str' object has no attribute 'remove' when unc_comps is a string.
Also found that ds.unc.rename breaks a string unc_comps (i.e. a variable with a single uncertainty component) - e.g. ds.unc.rename({"u_temperature": "u_t2"}) leaves unc_comps as ['u', '_', 't', 'e', 'm', ...], the characters of the old name, rather than renaming it.
Activity
shunt16 commentedon Oct 27, 2026
Still an issue for
del ds.unc[obs_var][unc_var], which fails withAttributeError: 'str' object has no attribute 'remove'whenunc_compsis a string.Also found that
ds.unc.renamebreaks a stringunc_comps(i.e. a variable with a single uncertainty component) - e.g.ds.unc.rename({"u_temperature": "u_t2"})leavesunc_compsas['u', '_', 't', 'e', 'm', ...], the characters of the old name, rather than renaming it.