When I create PM_TOT stacked plots, IMPROVE and simulation have almost same concentrations, which is not consistent with time series plots. I debugged the R codes, and see this issue:
AMET/AQ_Stacked_Barplot.R at 1.5 · USEPA/AMET · GitHub and L210
other_mod ← data.df[[PM_spec_ob]]-(data.df$SO4_mod+data.df$NO3_mod+data.df$NH4_mod+data.df$EC_mod+data.df$OC_mod)
Should we use “PM_spec_mod” instead of “PM_spec_ob”?
Yes, that is indeed an error in the code. That should be “PM_spec_mod” instead of “PM_spec_ob” as you indicate. I suggest making that change to the script and see if the results from the stacked bar plot are more consistent with the time series. I would also suggest trying one of the other stacked barplot scripts (e.g., ggplot, plotly) as another way to compare the results.
I presume you are comparing the total height of the stacked bars to total PM2.5 in the time series. Note that there may be instances where the data points are consistent between the two scripts. The stacked bar plot will eliminate those observations where any of the required speciated values (e.g., SO4, NO3, OC) are missing. So, it’s possible that the time series contains data points that are not contained in the stacked bars. Just something to be aware of.
Please let me know if you find greater consistency once you apply the correction you noted and I confirmed. And thanks for reporting this error.
Hi Wyat: Thanks for your quick response. The stacked plots looks better. I will take more look on ggplot and plotly.