Index: wflow-py/wflow/wflow_bmi_combined.py =================================================================== diff -u -r2ec31f8c54e4f5c6c5dbabb267e52e44fa098bc0 -r1feddff5d948c0bc4a3f7abecf2c0bf2624efcb0 --- wflow-py/wflow/wflow_bmi_combined.py (.../wflow_bmi_combined.py) (revision 2ec31f8c54e4f5c6c5dbabb267e52e44fa098bc0) +++ wflow-py/wflow/wflow_bmi_combined.py (.../wflow_bmi_combined.py) (revision 1feddff5d948c0bc4a3f7abecf2c0bf2624efcb0) @@ -9,6 +9,7 @@ import ConfigParser import logging import numpy as np +import json from pcraster import * def iniFileSetUp(configfile): @@ -123,16 +124,30 @@ exchange_from = item.split(self.comp_sep) if len(exchange_from)==3: - indices = np.loadtxt(exchange_from[2],delimiter=',',dtype=int) - self.indices_from.append([list(indices[0]),list(indices[1])]) + if exchange_from[2].startswith('['): + ind = json.loads(exchange_from[2]) + else: + ind_temp = np.loadtxt(exchange_from[2],delimiter=',',dtype=int) + if ind_temp.size == 2: + ind = [[ind_temp[0]],[ind_temp[1]]] + else: + ind = [list(ind_temp[0]),list(ind_temp[1])] + self.indices_from.append(ind) else: self.indices_from.append([]) + exchange_to = self.config.get('exchanges',item).split(self.comp_sep) if len(exchange_to)==3: - indices = np.loadtxt(exchange_to[2],delimiter=',',dtype=int) - print indices - self.indices_to.append([[indices[0]],[indices[1]]]) + if exchange_to[2].startswith('['): + ind = json.loads(exchange_to[2]) + else: + ind_temp = np.loadtxt(exchange_to[2],delimiter=',',dtype=int) + if ind_temp.size == 2: + ind = [[ind_temp[0]],[ind_temp[1]]] + else: + ind = [list(ind_temp[0]),list(ind_temp[1])] + self.indices_from.append(ind) else: self.indices_to.append([])