pyam icon indicating copy to clipboard operation
pyam copied to clipboard

Add known functions for aggregation methods to docs

Open danielhuppmann opened this issue 2 years ago • 4 comments

The aggregation methods know several common functions so that a string can be passed instead of the actual function. This is implemented via https://github.com/IAMconsortium/pyam/blob/2dffec07ce86b2f3fb8133ac369fa3c172589064/pyam/utils.py#L50

Per a suggestion by @phackstock, it would be useful to show the known functions in the documentation such that this information can be cross-referenced from the docstrings of the aggregation methods (rather than simply repeating all known functions on each method that uses it).

danielhuppmann avatar Mar 10 '22 09:03 danielhuppmann

This should be a really quick addition, I'll take care of that. Is there a way to reference a variable (like KNOWN_FUNCS) in sphinx and get its value? This way it would update automatically in case there's new members in KNOWN_FUNCS. Maybe that's unnecessarily complicated though....

phackstock avatar Mar 10 '22 12:03 phackstock

I think the best approach would be to have KNOWN_FUNCS as a recognized pyam module, then include it in the API docs, and cross-reference it from the methods-docstrings using intersphinx...

danielhuppmann avatar Mar 10 '22 12:03 danielhuppmann

Ah yes that would be the most elegant way, let's see if I can get sphinx to do that. Would KNOWN_FUNCS live in the API-reference?

phackstock avatar Mar 10 '22 12:03 phackstock

Would KNOWN_FUNCS live in the API-reference?

Yes, maybe as new "Utility" page...?

danielhuppmann avatar Mar 10 '22 12:03 danielhuppmann