rice-solar-physics / pydrad

Python tools for setting up HYDRAD runs and parsing output
https://pydrad.readthedocs.io
MIT License
4 stars 3 forks source link

Throw a warning/error if radiative losses undefined #90

Open jwreep opened 4 years ago

jwreep commented 4 years ago

If power law losses are switched off, and both arrays of elements used in the radiation calculation, presumably there would be no radiative losses (or HYDRAD would just crash). Pydrad should throw either an error or warning if such a case happens.

wtbarnes commented 4 years ago

Agreed this is a good idea.

I think there are probably a few other places where we should probably check conditions that are dependent on multiple parameters and it is not completely obvious to me how to do this in a "clean" way.

It's very easy to do validation on single parameters given some input by simply adding a filter and applying it in the Jinja template. This is how the unit and missing parameter checking is done. Maybe we need to add some sort of config validation step that looks at the whole configuration and applies checks that depend on combinations of parameters like this one. Setting this up would also make it easy to apply any additional checks that may arise.

Alternatively, this could all be done in the Jinja templates themselves. The logic might be a bit messy though...