Error writing model to xlsx when flows don't match
Some satellite tables can contain flows that are exclusively assigned to households. These flows do not get added to the B matrix. However they are written to model$SatelliteTables$flows. As a result writing the flows to csv fails
https://github.com/USEPA/useeior/blob/6e6b2a6c73efce8a077af76857da71cae8b4bdbf/R/WriteModel.R#L280-L283
This can be addressed with the addition of the final user B matrix, #226. For this reason the current B and B_h will need to have the same index... so there will be zeroes across some rows when this happens, but it will resolve this error.
The more immediate fix is to take the flows not in B out of flows.csv, until a B_h is created.
Discovered its not just a matter of presence/absence and order, but because the flow names may have special characters, it appears model$B index values and model$SatelliteTables$flows may have not translate to the same
e.g.
| model$SatelliteTables$flows$ID | rownames(model$B) |
|---|---|
| Particulate matter, > 2.5μm and ≤ 10μm/emission/air/kg | Particulate matter, ≤ 2.5μm/emission/air/kg |
| Particulate matter, ≤ 2.5μm/emission/air/kg | Particulate matter, > 2.5μm and ≤ 10μm/emission/air/kg |
Discovered its not just a matter of presence/absence and order, but because the flow names may have special characters, it appears
model$Bindex values and model$SatelliteTables$flowsmay have not translate to the same
Though in that case you think this would have been an issue in the past as well? as these PM flows are not new.