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

get list of required variables from a forcing source #419

Open
RolfHut opened this issue May 30, 2024 · 3 comments
Open

get list of required variables from a forcing source #419

RolfHut opened this issue May 30, 2024 · 3 comments
Labels
enhancement New feature or request forcing Issue related to forcing (generation, loading, etc.)

Comments

@RolfHut
Copy link
Contributor

RolfHut commented May 30, 2024

It would be nice to be able to get the list of variables that a forcing source needs to succesfully be able to generate a forcing object. I'm thinking something like:

forcing['genericLumped'].get_variables()

would return a list: ["tas","pr"]

@RolfHut RolfHut added enhancement New feature or request forcing Issue related to forcing (generation, loading, etc.) labels May 30, 2024
@BSchilperoort
Copy link
Member

We can add this as the following:

    @classmethod
    def get_input_variables(
        cls: type["DefaultForcing"],
    ) -> tuple[str, ...] | None:
        return ("pr", "tas", "rsds")  # for example
  • tuple is immutable: better for returning here.
  • UserForcings have "variables" as input argument, so we cannot know which ones are required based on the class definition. Therefore the possibility of the method returning None.

@RolfHut
Copy link
Contributor Author

RolfHut commented May 30, 2024

I like that. Should we add that as a template in the central repos and implement it in the model repos?

@BSchilperoort
Copy link
Member

I like that. Should we add that as a template in the central repos and implement it in the model repos?

I'll add it as an abstractmethod to the base forcing class, which will force plugin maintainers (i.e. us) to implement it for any implementations of the forcing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request forcing Issue related to forcing (generation, loading, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants