Skip to content

Commit e0ea544

Browse files
committed
Add conversion to iris cube
1 parent a9d1571 commit e0ea544

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/access_mopper/driver.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,20 @@ def to_dataset(self):
106106
"""
107107
return self.cmoriser.ds
108108

109+
def to_iris(self):
110+
"""
111+
Converts the underlying xarray Dataset to Iris CubeList format.
112+
Requires iris and iris.experimental.xarray to be installed.
113+
"""
114+
try:
115+
from iris.experimental.xarray import as_cubes
116+
117+
return as_cubes(self.cmoriser.ds)
118+
except ImportError:
119+
raise ImportError(
120+
"iris and iris.experimental.xarray are required for to_iris(). Please install iris."
121+
)
122+
109123
def run(self, write_output: bool = False):
110124
"""
111125
Runs the CMORisation process, including variable selection, processing,

0 commit comments

Comments
 (0)