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

Consider using a class or decorators to manage the workflow of each operation (function) #77

Closed
agstephens opened this issue Oct 20, 2020 · 1 comment
Assignees

Comments

@agstephens
Copy link
Collaborator

We can see from clisops.ops.subset::subset that most of the workflow will be independent of the actual operation:

def subset(

The differences are:

  • input arguments
  • mapping those arguments
  • calling the actual operation(s) - from clisops.core.*

Would it make sense to create a class that worked through the stages?

  1. validate/parse inputs
  2. map args
  3. call operation
  4. get outputs

The latter, get_outputs could, in turn, be a class that brings together:

  • file-naming
  • format management
  • time-splitting
  • output file/object generation

The clisops.ops.subset could then be a class or function with dectorators:

@validate_ds
def subset(ds, .....):
      mapped_args = utils.map_params(...)
      ds = clisops.core.subset(ds, ...)
      
      output_handler = OutputHandler(ds, ...)
      return output_handler.get_outputs()

NOTE: we also need to simplify, or find a way to remove: clisops.ops.subset::_subset

@agstephens agstephens self-assigned this Oct 20, 2020
@agstephens
Copy link
Collaborator Author

Implemented with op_average branch.

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