File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
polaris/tasks/ocean/customizable_viz Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,16 @@ def runtime_setup(self):
1818 self .mesh_file = section .get ('mesh_file' )
1919 self .input_file = section .get ('input_file' )
2020
21+ section_name = 'customizable_viz_horiz_field'
22+ self .variables = self .config .getlist (
23+ section_name , 'variables' , dtype = str
24+ )
25+ if not self .variables :
26+ raise ValueError (
27+ f'No variables specified in the { section_name } section of '
28+ 'the config file.'
29+ )
30+
2131 def run (self ): # noqa:C901
2232 section_name = 'customizable_viz_horiz_field'
2333 section = self .config [section_name ]
@@ -97,9 +107,8 @@ def run(self): # noqa:C901
97107 f'and input { ds .sizes ["nCells" ]} do not match. '
98108 )
99109 viz_dict = get_viz_defaults ()
100- variables = self .config .getlist (section_name , 'variables' , dtype = str )
101110
102- for var_name in variables :
111+ for var_name in self . variables :
103112 if 'accumulated' in var_name :
104113 full_var_name = var_name
105114 else :
Original file line number Diff line number Diff line change @@ -18,10 +18,18 @@ def runtime_setup(self):
1818 section = self .config ['customizable_viz' ]
1919 self .mesh_file = section .get ('mesh_file' )
2020 self .input_file = section .get ('input_file' )
21+ section_name = 'customizable_viz_transect'
22+ self .variables = self .config .getlist (
23+ section_name , 'variables' , dtype = str
24+ )
25+ if not self .variables :
26+ raise ValueError (
27+ f'No variables specified in the { section_name } section of '
28+ 'the config file.'
29+ )
2130
2231 def run (self ):
2332 section_name = 'customizable_viz_transect'
24- variables = self .config .getlist (section_name , 'variables' , dtype = str )
2533 section = self .config [section_name ]
2634 layer_interface_color = section .get ('layer_interface_color' )
2735 x_start = section .getfloat ('x_start' )
@@ -61,7 +69,7 @@ def run(self):
6169 )
6270
6371 viz_dict = get_viz_defaults ()
64- for var_name in variables :
72+ for var_name in self . variables :
6573 mpas_field = ds [f'{ prefix } { var_name } ' ]
6674 if self .config .has_option (section_name , 'vmin' ):
6775 vmin = section .getfloat ('vmin' )
You can’t perform that action at this time.
0 commit comments