TNC-NMFO / NWLAND

carbon accounting model
0 stars 0 forks source link

error while replacing the "orig" method with "annual" method for modeling landcover change. #51

Closed sbassett closed 2 years ago

sbassett commented 3 years ago
 Error in `[<-.data.frame`(`*tmp*`, match(new_area_changes$Landcat, out_scen_df_list[[2]][,  : 
  missing values are not allowed in subscripted assignments of data frames 
4.
stop("missing values are not allowed in subscripted assignments of data frames") 
3.
`[<-.data.frame`(`*tmp*`, match(new_area_changes$Landcat, out_scen_df_list[[2]][, 
    "Land_Cat_ID"]), "Area_change_ha", value = c(0, 0, 0, 0, 
0, 0, 0, 0, 2.59714285714286, 0, 0, 0, 0.558, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, -1.89, 0, -0.838285714285714, 0, 0, 0, 0, 0, 0,  ... at write_caland_inputs.r#710
2.
`[<-`(`*tmp*`, match(new_area_changes$Landcat, out_scen_df_list[[2]][, 
    "Land_Cat_ID"]), "Area_change_ha", value = c(0, 0, 0, 0, 
0, 0, 0, 0, 2.59714285714286, 0, 0, 0, 0.558, 0, 0, 0, 0, 0, 
0, 0, 0, 0, 0, -1.89, 0, -0.838285714285714, 0, 0, 0, 0, 0, 0,  ... at write_caland_inputs.r#710
1.
write_caland_inputs(c_file = "2021_05_14_carbon_input_nwland_testV.xls", 
    inputs_dir = "2021_05_14_carbon_input_nwland_testV", parameter_file = "proto_lc_params.xls", 
    scenarios_file = "proto_nwl_scenarios_v01_ha.xls", units_scenario = "ha", 
    climate_c_file = "climate_c_scalars_nmco_null_2010_2100.csv",  ... 
sbassett commented 3 years ago

Is this because nrow(new_area_changes) = 6359 and nrow(out_scen_df_list[[2]]) = 7528? Are there identical number of records in these data frames in CALANDs? No. There are 1064 in "old" table and 848 in the "new" area change files.

sbassett commented 3 years ago

This only happens when write_caland_inputs() argument land_change_method = "Landuse_Avg_Annual". Bypassing this error by setting land_change_method = "Landcover".

sbassett commented 2 years ago

Will address in #30