Stochastic behavior in XRSite.from_pwc
In XRSite.from_pwc, there are the following lines
pwc['A'] = (tuple(set(ws_mean.dims) - set(xy_dims)), median['A'].values)
pwc['k'] = (tuple(set(ws_mean.dims) - set(xy_dims)), median['k'].values)
as sets are by default unordered, the first field can come back as either ('height', 'sector') or ('sector', 'height'). However, the median['A']
and median['k']
fields remain in the same order.
- Why are we making a new xr.DataArray here rather than just passing in the values from median directly?
- If we need to create the new DataArray, can we make the dims a list, and pop the fields we don't need? This would be done as below.
weib_dims = list(ws_mean.dims) for dim in xy_dims: weib_dims.remove(dim)