hector icon indicating copy to clipboard operation
hector copied to clipboard

Table of Hector R parameters and outputs.

Open kdorheim opened this issue 5 years ago • 8 comments

This is related to PR #346 and how we want handle the ability to fetch all of the output variables. @bpbond and I thought it might be worth having a clear table of Hector outputs, the strings R hector will recognize, a description, and the units.

Brain storming but could we save this table online? wiki or some other documentation then have a function that scrapes that info into a table for R? Do we want to have that for the C++ hector or just the variables that are exposed to the R bindings?

kdorheim avatar May 13 '20 20:05 kdorheim

It would be great if this could be auto-generated from Hector itself.

bpbond avatar May 22 '20 13:05 bpbond

Agreed that would be ideal. Just brain storming here but do you think we could set up some data-raw script (something like the dsr generate package data) to parse that information out from src/rcpp_constants.cpp or inst/include/component_data.hpp to determine the variable name, and units? (we may have to reorganize those scripts or add some sort of useful documentation tag to make scraping the variable names from those files easier). If we include a discerption column that might have to be manually added... 🤔unless we are also able to scrape that information from the text included after the @describeIn tag

kdorheim avatar May 22 '20 14:05 kdorheim

One way or another, an automated scraping (external to Hector) or generation (internal) capability sure seems like the way to go.

bpbond avatar May 22 '20 14:05 bpbond

What do you mean by internal vs external?

Would internal be like a function that users interact with to generate the table like https://github.com/FoRTExperiment/ed4forte/blob/master/R/ed2-variables.R while external would be https://github.com/JGCRI/gcamdata/blob/master/data-raw/generate_package_data.R?

kdorheim avatar May 22 '20 14:05 kdorheim

Yep, that's what I mean.

bpbond avatar May 22 '20 14:05 bpbond

👍 Personally I tend to prefer the external data method, because it is one less function that can break for users but the internal method would probably be a smaller commit to the repo. 🤷‍♀️ I am not to well versed in the pros and cons of generating tables of information using internal vs external methods.

kdorheim avatar May 22 '20 14:05 kdorheim

Pyhector does some parsing of component_names.hpp and component_data.hpp

https://github.com/openclimatedata/pyhector/blob/master/scripts/write_constants_py.sh

Output: https://github.com/openclimatedata/pyhector/blob/master/pyhector/constants.py

rgieseke avatar May 22 '20 16:05 rgieseke

Make sure whatever we end up using to make this, unlike https://github.com/JGCRI/hector/blob/v3_dev/data-raw/lookup-data.R is more flexible/less hard coded

kdorheim avatar Jan 05 '23 02:01 kdorheim