dustming / basinmaker

An automated GIS toolbox for watershed delineation with lakes
Artistic License 2.0
24 stars 6 forks source link

create a independent main module basinmaker.py #1

Closed dustming closed 3 years ago

dustming commented 3 years ago

It will call functions in sub modules, and it will be the interface to the user.

dustming commented 3 years ago

@cjauvin add a comment here? or inside the code. thanks

dustming commented 3 years ago

@cjauvin Hi Christian all four option in the first tool of basin maker has been modularized. I am not sure if I did it in the right way. Would you please help me check the overall structure when it is convenient for you? many thanks.

Here is my structure.

  1. A main module is created. The name is 'basinmaker.py' . it will import an interface function called "define_project_extent".
  2. the interface function, which is called by the main module, is belonged to the 'extent' submodule, which is located in './extent'
  3. then the interface function "define_project_extent", will call each individual function for each option to define spatial processing extent.
cjauvin commented 3 years ago

Hi @dustming! I'm not sure I understand well what you propose with your 3 points above. What is the "interface function"?

Usually, for a project of that type, a useful way to think about how to organize its structure is to clearly define a command-line interface for your user, and implement it in a "main" module (perhaps with some libraries like argparse of even Click to help you manage the CLI arguments and options). In that main module, the different ways of interacting with your program are well defined and easily identifiable, and it will probably help in terms of how to organize the rest of your code.

dustming commented 3 years ago

Hi @dustming! I'm not sure I understand well what you propose with your 3 points above. What is the "interface function"?

Usually, for a project of that type, a useful way to think about how to organize its structure is to clearly define a command-line interface for your user, and implement it in a "main" module (perhaps with some libraries like argparse of even Click to help you manage the CLI arguments and options). In that main module, the different ways of interacting with your program are well defined and easily identifiable, and it will probably help in terms of how to organize the rest of your code.

Hi @cjauvin , thanks for your comments.
Here is the function in the main module:

https://github.com/dustming/basinmaker/pull/1/files#diff-a8faf72617131bf6d67113128d876029ec2c267446aeede7ac69035b9897c528R240 and here is the function in the sub module

https://github.com/dustming/basinmaker/pull/1/files#diff-6c3704bb859e93399dc6b6dbe4a001f22c3fddbdcf864df4e47afa6e3fce0171R7

Is it looks reasonable?

Thanks