@@ -7,6 +7,12 @@ class OceanIOStep(Step):
77 A step that writes input and/or output files for Omega or MPAS-Ocean
88 """
99
10+ # make sure component is of type Ocean
11+ component : Ocean
12+
13+ def __init__ (self , component : Ocean , ** kwargs ):
14+ super ().__init__ (component = component , ** kwargs )
15+
1016 def map_to_native_model_vars (self , ds ):
1117 """
1218 If the model is Omega, rename dimensions and variables in a dataset
@@ -24,10 +30,6 @@ def map_to_native_model_vars(self, ds):
2430 The same dataset with variables renamed as appropriate for the
2531 ocean model being run
2632 """
27- if not isinstance (self .component , Ocean ):
28- raise TypeError (
29- 'component must be an instance of Ocean to map model vars'
30- )
3133 return self .component .map_to_native_model_vars (ds )
3234
3335 def write_model_dataset (self , ds , filename ):
@@ -43,10 +45,6 @@ def write_model_dataset(self, ds, filename):
4345 filename : str
4446 The path for the NetCDF file to write
4547 """
46- if not isinstance (self .component , Ocean ):
47- raise TypeError (
48- 'component must be an instance of Ocean to map model vars'
49- )
5048 self .component .write_model_dataset (ds , filename )
5149
5250 def map_from_native_model_vars (self , ds ):
@@ -65,10 +63,6 @@ def map_from_native_model_vars(self, ds):
6563 ds : xarray.Dataset
6664 The same dataset with variables named as expected in MPAS-Ocean
6765 """
68- if not isinstance (self .component , Ocean ):
69- raise TypeError (
70- 'component must be an instance of Ocean to map model vars'
71- )
7266 return self .component .map_from_native_model_vars (ds )
7367
7468 def open_model_dataset (self , filename , ** kwargs ):
@@ -89,8 +83,4 @@ def open_model_dataset(self, filename, **kwargs):
8983 ds : xarray.Dataset
9084 The dataset with variables named as expected in MPAS-Ocean
9185 """
92- if not isinstance (self .component , Ocean ):
93- raise TypeError (
94- 'component must be an instance of Ocean to map model vars'
95- )
9686 return self .component .open_model_dataset (filename , ** kwargs )
0 commit comments