def __init__(self, name='', models=[], biomass=[], carbon_sources=[]): self.name = name self.models = util.IntelliContainer() for id, biomass, carbon_source in zip(models, biomass, carbon_sources): model = Proxy( partial(load_model, os.path.join(MODEL_DIRECTORY, id + '.json'))) setattr(model, "biomass", biomass) setattr(model, "carbon_source", carbon_source) self.models[id] = model
def __init__(self, name='', models=[], biomass=[], carbon_sources=[]): self.name = name self.models = util.IntelliContainer() for id, biomass, carbon_source in zip(models, biomass, carbon_sources): model = Proxy( partial(load_model, os.path.join(MODEL_DIRECTORY, id + '.xml'))) model.biomass = biomass model.carbon_source = carbon_source self.models[id] = model
def __init__(self, name='', models=None, biomass=None, carbon_sources=None): models = models or [] biomass = biomass or [] carbon_sources = carbon_sources or [] self.name = name self.models = util.IntelliContainer() for id, biomass, carbon_source in zip(models, biomass, carbon_sources): def lazy_model_init(path): model = load_model(path) setattr(model, "biomass", biomass) setattr(model, "carbon_source", carbon_source) return model model = Proxy( partial(lazy_model_init, os.path.join(MODEL_DIRECTORY, id + '.json'))) self.models[id] = model