RMI-PACTA / r2dii.plot

A package containing functions to create standard 2DII plots using ggplot, together with data processing functions needed for the charts.
https://rmi-pacta.github.io/r2dii.plot
Other
8 stars 1 forks source link

Add more specific input checks for `plot_emission_intensity` and `prep_emission_intensity` #551

Closed jdhoffa closed 8 months ago

jdhoffa commented 8 months ago

The crucial difference between the input to prep_emission_intensity and the input to plot_emission_intensity (that I can see) is that the latter has the additional label column.

There is an "optional" difference, dependent on the value of span_5yr, but I don't think it makes sense to check for that since plot_* can't know a-priori what the argument passed to prep_* was.

The rest of the checks (that the input data is a data-frame etc.) are shared between the two functions.

Note: I wonder, perhaps we should add an exclusion test that the column label is NOT in the input to prep_emission_intenstiy(). @MonikaFu let me know if you have thoughts there.

Note: Adding the check brought a few bugs in the unit tests to light! woo 👯

Maybe closes #546 Relates to #548

MonikaFu commented 8 months ago

Thanks @jdhoffa. Reviewing now.

As for this

Note: I wonder, perhaps we should add an exclusion test that the column label is NOT in the input to prep_emission_intenstiy(). @MonikaFu let me know if you have thoughts there.

This check is not necessary. The label column is an optional column for the input. Function works with and without it.

MonikaFu commented 8 months ago

There is an "optional" difference, dependent on the value of span5yr, but I don't think it makes sense to check for that since plot can't know a-priori what the argument passed to prep_ was.

I agree. We don't need to test for that.