useeior icon indicating copy to clipboard operation
useeior copied to clipboard

Error writing model to xlsx when flows don't match

Open bl-young opened this issue 3 years ago • 4 comments

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

bl-young avatar Dec 13 '22 14:12 bl-young

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.

WesIngwersen avatar Dec 14 '22 02:12 WesIngwersen

The more immediate fix is to take the flows not in B out of flows.csv, until a B_h is created.

WesIngwersen avatar Dec 01 '23 18:12 WesIngwersen

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

WesIngwersen avatar Dec 01 '23 21:12 WesIngwersen

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

Though in that case you think this would have been an issue in the past as well? as these PM flows are not new.

bl-young avatar Dec 01 '23 21:12 bl-young