TNC-NMFO / NWLAND

carbon accounting model
0 stars 0 forks source link

write_caland_inputs.R | object 'accum' not found #146

Open sbassett opened 2 years ago

sbassett commented 2 years ago

This may be several compound errors. The error blocking the script is:

Error in merge(area, accum, by = c("Land_Cat_ID", "Region", "Land_Type",  : 
  object 'accum' not found

It happens in this console context:

Start write_caland_inputs at Wed Mar 30 10:50:40 2022 

start NA area (ha) =  
ref NA area (ha) =  
start-ref NA area (ha) =  

start lcat mismatch area (ha) = 0 
ref lcat mismatch area (ha) = 0 
start-ref lcat mismatch area (ha) = 0 

start total land area (ha) = 31492483 
ref total land area (ha) = 31492483 
start-ref total land area (ha) = 0.0003653057 
Error: no veg or soil uptake records!
Error in merge(area, accum, by = c("Land_Cat_ID", "Region", "Land_Type",  : 
  object 'accum' not found

Note the Error: no veg or soil uptake records! on the line prior to the 'real' error, which may trigger the merge error.

The merge error appears to be triggered on line 2086 of write_caland_inputs.R

accum = merge(area, accum, by = c("Land_Cat_ID", "Region", "Land_Type", "Ownership", "Area_ha"), all.x = TRUE)
sbassett commented 2 years ago

AE is null, length(AE) is 0 line 2069 requires AE to have a positive length

> nrow(complete_recs)
[1] 0

> nrow(allown_recs)
[1] 0

> nrow(allreg_recs)
[1] 0

> nrow(allownreg_recs)
[1] 0

so if statements on lines 2031, 2039, 2048, and 2057 aren't triggered.