ACCESS-NRI / amami

ACCESS Models Accessory Multitool Interface (AMAMI) is a Python package that bundles a set of commands to handle ACCESS models input and output files.
Apache License 2.0
0 stars 0 forks source link

Refactoring: remove helpers.get_abspath() #42

Open truth-quark opened 5 months ago

truth-quark commented 5 months ago

The helpers.get_abspath() function is not required once #40 is complete:

atteggiani commented 5 months ago

Hmm yes that is true, but the helpers.get_abspath() function might still be needed to get the path we want logged. I think Python's IOError does not necessarily output the absolute path, but whatever argument was given as a path.

truth-quark commented 5 months ago

Ooops, Python throws a FileNotFound error which shows the path (abs or relative, whichever is passed to the func). This is fine as um2nc doesn't change the working directory.

atteggiani commented 5 months ago

Yeah, I created the get_abspath() function to log the absolute paths. Even though um2nc does not change working directory, I usually prefer working with absolute paths in general.

truth-quark commented 5 months ago

In the interest of simplicity, I recommend going with a minimal implementation, deferring to Python defaults etc. Each specialisation, additional code branching etc contributes to more complexity, more testing and so forth. The less code we have, the easier it is for different devs to understand & maintain :-)

atteggiani commented 5 months ago

Yes that makes sense. Well, for now we can remove it, then if we need a way to work with absolute paths we will reinstate it.

However, if we remove it, we neeed a function to check existence of files and directories to replace the logic of the check and checkdir input arguments to get_abspath().