Skip to content

Commit

Permalink
updating returned a and b as xarray dataarray
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmargraf committed Nov 9, 2023
1 parent 0a84889 commit 1680ef7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pycomlink/processing/k_R_relation.py
Expand Up @@ -187,13 +187,14 @@ def a_b(f_GHz, pol, approx_type="ITU_2005"):
"""
if isinstance(f_GHz, xr.DataArray):
return_xarray = True
f_GHz_coords = f_GHz.coords
else:
return_xarray = False

f_GHz = xr.DataArray(f_GHz)

if isinstance(pol, str):
pol = np.full_like(f_GHz, pol, dtype=object)
pol = xr.full_like(f_GHz, pol, dtype=object)
pol = xr.DataArray(pol)

tmp_dims_f_GHz = f_GHz.dims
Expand Down Expand Up @@ -244,8 +245,9 @@ def a_b(f_GHz, pol, approx_type="ITU_2005"):
b[pol_mask_v] = b_v[pol_mask_v]

if return_xarray:
a = xr.DataArray(a, dims=tmp_dims_f_GHz)
b = xr.DataArray(b, dims=tmp_dims_f_GHz)
if tmp_dims_f_GHz != ():
a = xr.DataArray(a, coords=f_GHz_coords)
b = xr.DataArray(b, coords=f_GHz_coords)

return a, b

Expand Down

0 comments on commit 1680ef7

Please sign in to comment.