Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error writing model to xlsx when flows don't match #244

Open
bl-young opened this issue Dec 13, 2022 · 4 comments
Open

Error writing model to xlsx when flows don't match #244

bl-young opened this issue Dec 13, 2022 · 4 comments
Assignees

Comments

@bl-young
Copy link
Collaborator

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

useeior/R/WriteModel.R

Lines 280 to 283 in 6e6b2a6

checkNamesandOrdering(flows$ID, rownames(model$B),
"flows in flows.csv and rows in B matrix")
utils::write.csv(flows, paste0(dirs$model, "/flows.csv"), na = "",
row.names = FALSE, fileEncoding = "UTF-8")

@WesIngwersen
Copy link
Collaborator

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
Copy link
Collaborator

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

@WesIngwersen WesIngwersen self-assigned this Dec 1, 2023
@WesIngwersen
Copy link
Collaborator

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

@bl-young
Copy link
Collaborator Author

bl-young commented Dec 1, 2023

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.

WesIngwersen added a commit that referenced this issue Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants