pacificclimate / climate-explorer-data-prep

0 stars 0 forks source link

Issue/126 Refactor input validity checks in decompose_flow_vectors #127

Closed sum1lim closed 4 years ago

sum1lim commented 4 years ago

This PR closes issue #126

For the convenience in importing decompose_flow_vectors in other programs such as WPS processes, the input validity checking procedure in main() has been refactored into source_check and variable_check functions. The advantage of the functions is that they do not need terminal input for arguments, thus they can be called in any programs that do not require terminal inputs.

The functions throw an user-defined exception if any error conditions are met, and main() SystemExits the program when it catches an exception. There are two main user-defined exceptions(InvalidSourceError and InvalidVariableError) and 5 other exceptions that inherit the main exceptions. The reason for having many specific exceptions is to manage versatile error conditions when the functions are called in other programs