lnferris / ocean_data_tools

A MATLAB toolbox for interacting with bulk freely-available oceanographic data.
MIT License
83 stars 24 forks source link

Add function headers #2

Closed kthyng closed 4 years ago

kthyng commented 4 years ago

Related to JOSS review.

Opening on behalf of @chadagreene. This comment was originally here.

@lnferris as I mentioned, it will be a few weeks before I can focus on a detailed review, but based on a quick glance through the .m files, one request I will have is that each function be given a header that can be accessed by typing help myfunction into the command line. Ideally, I'd like to see either .mlx or .html files with rich documentation as well so users can see and follow along with examples, but for starters it's important to at least include headers for every function.

If you want to get started on that now, I recommend following the template of official Matlab documentation, listing Syntax, Description, and Examples. The Syntax is generally a list of all the different ways users can specify inputs. The Description section describes in words what each type of syntax does and when you might want to use it. And provide a couple of Examples, starting with the simplest case scenario and then getting more complex. The Examples are good not only to help users learn how to use your functions, but the Examples also serve as reliable tests to ensure your function is working as expected. Here's a dummy template:

function b = myfunction(a,varargin)
% myfunction magically transforms a into b. 
% 
%% Syntax
% 
%  b = myfunction(a) 
%  b = myfunction(a,'Option',Value)
% 
%% Description 
% 
% b = myfunction(a) converts a into b. Input a can be any MxN matrix
% containing numerical values. 
%  
% b = myfunction(a,'Option',Value) specifies a value of an optional
% input 'Option'. By default, Value is 0, but may be set to any finite
% scalar value. 
% 
%% Example 1
% Determine the value of b if a equals five: 
% 
%  a=5; 
%  b=myfunction(a)
%
%% Example 2
% Convert a 5x4 matrix of values of a into b, and specify an Option  
% value of 16: 
% 
%  a=rand(5,4); 
%  b=myfunction(a,'Option',16)
%
%% Citation Info 
% Link to your GitHub here. 
% 
% See also myotherfunction and myotherotherfunction.
lnferris commented 4 years ago

I added help-accessible added headers (Syntax, Description, Examples, Info) to all functions. 👍

lnferris commented 4 years ago

@kthyng do I close issues once fixed or do I let reviewers decide whether to close them? Thanks!

kthyng commented 4 years ago

Ideally wait until @chadagreene is working on his review so he can give feedback and then close after you've both agreed it's finished.