NREL/OpenOA

Programmatically generate requirements for analysis

jordanperr opened this issue · 1 comments

We would like to be able to use the analysis_requirements to generate a query for the ENTR warehouse. This works now if you're only using required columns, but becomes tricky when you want to use optional columns. The problem is that the use of optional columns are dictated by the arguments provided to the analysis, and these may not be known at the time the PlantData is created. I propose adding an "Analysis.generate_schema()" method to analysis classes, which generates the requirements dictionary on-the-fly, based on the arguments provided to init.

Old Workflow:

plant = PlantData.from_entr("La Haute Borne", analysis_type="MonteCarloAEP")
pa = MonteCarloAEP(plant, arg1="foo", arg2="bar")
pa.run(arg3="baz")

Proposed Workflow:

pa = MonteCarloAEP(arg1="foo", arg2="bar")
plant = PlantData.from_entr("La Haute Borne", schema=pa.get_schema())
pa.run(plant, arg3="baz").

As discussed in #255, this needs more details to be a workable request, and should be reconsidered at a later time.