File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11"""obsarray.concat - module with extension to xarray.concat for obs_vars and unc_vars"""
22
3+ import numpy as np
34import xarray as xr
45from typing import Union , Any
56from xarray .core .types import T_Dataset , T_DataArray , T_Variable
@@ -20,8 +21,6 @@ def obs_concat(
2021 ** kwargs
2122):
2223 """
23- **NB: THIS FUNCTION IS NOT CURRENTLY IMPLEMENTED AND JUST ACTS AS A WRAPPER FOR XR.CONCAT**
24-
2524 Concatenate xarray *obs_vars* along a new or existing dimension, safely handling also
2625 concatenating associated *unc_vars*. Extension to :py:func:`xarray.concat`.
2726
@@ -44,7 +43,19 @@ def obs_concat(
4443 """
4544
4645 concat_obs_vars = xr .concat (objs , dim , * args , ** kwargs )
47- concat_unc_vars = None
46+ concat_unc_vars = xr .Dataset
47+
48+ n_uc = np .array ([len (obj .attrs ["unc_comps" ]) for obj in objs ])
49+
50+ if np .all (n_uc != n_uc [0 ]):
51+ raise ValueError ()
52+ else :
53+ n_uc = n_uc [0 ]
54+
55+ for i_uc in range (n_uc ):
56+ unc_i = [unc [obj .attrs ["unc_comps" ][i_uc ]] for obj in objs ]
57+
58+
4859 return concat_obs_vars , concat_unc_vars
4960
5061
You can’t perform that action at this time.
0 commit comments