Skip to content

Commit

Permalink
update decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
freemansw1 committed Jan 9, 2025
1 parent 5243c90 commit 2b8c03e
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions tobac/utils/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,11 @@ def wrapper(*args, **kwargs):
if type(output) == tuple:
output = tuple(
[
output_item.to_iris().copy(output_item.data)
if type(output_item) == xarray.DataArray
else output_item
(
output_item.to_iris().copy(output_item.data)
if type(output_item) == xarray.DataArray
else output_item
)
for output_item in output
]
)
Expand Down Expand Up @@ -244,9 +246,11 @@ def wrapper(*args, **kwargs):
# print("converting xarray to iris and back")
args = tuple(
[
arg.to_iris().copy(arg.data)
if type(arg) == xarray.DataArray
else arg
(
arg.to_iris().copy(arg.data)
if type(arg) == xarray.DataArray
else arg
)
for arg in args
]
)
Expand Down Expand Up @@ -344,11 +348,15 @@ def wrapper(*args, **kwargs):
if type(output) == tuple:
output = tuple(
[
output_item.to_iris().copy(output_item.data)
if type(output_item) == xarray.DataArray
else output_item.to_dataframe()
if type(output_item) == xarray.Dataset
else output_item
(
output_item.to_iris().copy(output_item.data)
if type(output_item) == xarray.DataArray
else (
output_item.to_dataframe()
if type(output_item) == xarray.Dataset
else output_item
)
)
for output_item in output
]
)
Expand Down

0 comments on commit 2b8c03e

Please sign in to comment.