lnferris/ocean_data_tools

Demo script hard-coded paths

kakearney opened this issue · 1 comments

This issue is part of the JOSS review (openjournals/joss-reviews#2497)

The demo script provides a nice overview of the various tools, while also allowing users to make sure they have everything set up properly. However, right now the demo script includes a number of hard-coded file paths that point to the author's personal computer. As a result, the demo script crashes if not modified. This is particularly problematic because the first function to make use of one of these hard-coded paths (netcdf_info) fails silently, and the next (argo_build) does not check that the path exists before using it, leading to very unintuitive error:

Index in position 1 exceeds array bounds.

Error in argo_build (line 100)
    is_matrix = sz1(1,:)~=1;

Error in demos (line 30)
[argo,~] = argo_build(argo_dir,region,start_date,end_date,variable_list);

This is not an easy-to-diagnose error for a new user.

The demo should be written so it can be run without any modifications, out of the box. If you absolutely cannot avoid hard-coded paths, make sure the script checks the specified paths for the appropriate files and directs the user exactly where to modify the script if the path is not found or does not contain the expected files.

Good suggestion. I have fixed it so pathways to test data are generated relative to demo.m itself. To help the new user transition to specifying paths to their own data, there is a subsequent block in which the user can experiment with hard-coding pathways.

Screen Shot 2020-09-06 at 10 31 38 AM