Skip to content

Commit

Permalink
Only check len(PFT_keys) if append_keys is True
Browse files Browse the repository at this point in the history
The original way I wrote this was causing problems in the CESM-SPECTRA test
  • Loading branch information
mnlevy1981 committed May 11, 2023
1 parent f512bd3 commit a9b02b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions MARBL_tools/MARBL_settings_file_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,19 +237,19 @@ def _process_variable_value(self, category_name, variable_name):
# Is the derived type an array? If so, treat each entry separately
if ("_array_shape" in this_var.keys()):
for n, elem_index in enumerate(_get_array_info(this_var["_array_shape"], self.settings_dict, self.tracers_dict)):
if n < len(PFT_keys):
PFT_keys.append('null')
# Append "(index)" to variable name
base_name = "%s%s%%" % (variable_name, elem_index)

if append_to_keys:
if n < len(PFT_keys):
PFT_keys.append('null')
# Add key for specific PFT
if variable_name == 'zooplankton_settings':
self._config_keyword.append('((zooplankton_sname)) == "%s"' % PFT_keys[n])
self._config_keyword.append('((zooplankton_sname)) == "%s"' % PFT_keys[n])
elif variable_name == 'autotroph_settings':
self._config_keyword.append('((autotroph_sname)) == "%s"' % PFT_keys[n])
self._config_keyword.append('((autotroph_sname)) == "%s"' % PFT_keys[n])
elif variable_name == 'grazing_relationship_settings':
self._config_keyword.append('((grazer_sname)) == "%s"' % PFT_keys[n])
self._config_keyword.append('((grazer_sname)) == "%s"' % PFT_keys[n])

for key in _sort_with_specific_suffix_first(this_var["datatype"].keys(),'_cnt'):
if key[0] != '_':
Expand Down

0 comments on commit a9b02b9

Please sign in to comment.