Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drivers should be optional dependencies? #199

Open
Huite opened this issue Oct 24, 2023 · 0 comments
Open

Drivers should be optional dependencies? #199

Huite opened this issue Oct 24, 2023 · 0 comments

Comments

@Huite
Copy link
Contributor

Huite commented Oct 24, 2023

get_driver currently looks like this:

    from imod_coupler.drivers.metamod.config import MetaModConfig
    from imod_coupler.drivers.metamod.metamod import MetaMod
    from imod_coupler.drivers.ribamod.config import RibaModConfig
    from imod_coupler.drivers.ribamod.ribamod import RibaMod

    if base_config.driver_type == "metamod":
        metamod_config = MetaModConfig(config_dir=config_dir, **config_dict["driver"])
        return MetaMod(base_config, metamod_config)
    elif base_config.driver_type == "ribamod":
        ribamod_config = RibaModConfig(config_dir=config_dir, **config_dict["driver"])
        return RibaMod(base_config, ribamod_config)
    else:
        raise ValueError(f"Driver type {base_config.driver_type} is not supported.")

It should probably be more like this?

    if base_config.driver_type == "metamod":
        from imod_coupler.drivers.metamod.config import MetaModConfig
        from imod_coupler.drivers.metamod.metamod import MetaMod

        metamod_config = MetaModConfig(config_dir=config_dir, **config_dict["driver"])
        return MetaMod(base_config, metamod_config)
    elif base_config.driver_type == "ribamod":
        from imod_coupler.drivers.ribamod.config import RibaModConfig
        from imod_coupler.drivers.ribamod.ribamod import RibaMod

        ribamod_config = RibaModConfig(config_dir=config_dir, **config_dict["driver"])
        return RibaMod(base_config, ribamod_config)
    else:
        raise ValueError(f"Driver type {base_config.driver_type} is not supported.")

I don't think we want to make ribasim mandatory for everyone who wants to run MetaSWAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant