TNC-NMFO / NWLAND

carbon accounting model
0 stars 0 forks source link

asRan | CALAND | numbers of columns of arguments do not match #120

Open sbassett opened 2 years ago

sbassett commented 2 years ago
4.
stop("numbers of columns of arguments do not match") 
3.
rbind(deparse.level, ...) 
2.
rbind(conv_df_pre, own_conv_df_list_pre[[z]]) at CALAND.r#4424
1.
CALAND(scen_file_arg = "CONM_BAU_v01_testA_rcp85_climNA.xls", 
    c_file_arg = "2022_01_13_input_conm_testB_rcp85_noOcean.xls", 
    indir = "2022_01_13_input_conm_testB_rcp85_noOcean", outdir = "2022_01_13_output_conm_testB_noOcean", 
    start_year = 2021, end_year = 2051, value_col_dens = 7, ADD_dens = TRUE,  ... 
sbassett commented 2 years ago
> length(own_conv_df_list_pre)
[1] 8
> ncol(own_conv_df_list_pre[[1]])
[1] 91
> ncol(own_conv_df_list_pre[[2]])
[1] 91
> head(conv_df_pre)
  Land_Cat_ID Region Land_Type Ownership tot_area base_area_change area_change  new_area Management man_area man_area_sum
1      200001 C08003     Water       BLM   364.05       -0.2586076  -0.2586076  363.7914       <NA>        0            0
2      203001 C08003    Sparse       BLM   282.87       -0.2267089  -0.2267089  282.6433       <NA>        0            0
3      204001 C08003    Desert       BLM  2642.13       -2.3172152  -2.3172152 2639.8128       <NA>        0            0
4      205001 C08003 Shrubland       BLM  7342.65       -4.9784810  -4.9397531 7337.7102       <NA>        0            0
5      206001 C08003 Grassland       BLM  1004.67       -0.4682278  -0.4682278 1004.2018       <NA>        0            0
6      208001 C08003  Woodland       BLM     5.76        0.0000000   0.0000000    5.7600       <NA>        0            0
  initial_man_area non_regen_area base_change_adjust Above_harvested_conv_frac StandDead_harvested_conv_frac Harvested2Wood_conv_frac
1                0              0         0.00000000                         1                             1                        0
2                0              0         0.00000000                         1                             1                        0
3                0              0         0.00000000                         1                             1                        0
4                0              0         0.03872785                         1                             1                        0
5                0              0         0.00000000                         1                             1                        0
6                0              0         0.00000000                         1                             1                        0
  Harvested2Energy_conv_frac Harvested2SawmillDecay_conv_frac Harvested2Slash_conv_frac Under2Slash_conv_frac DownDead2Slash_conv_frac
1                          0                                0                         1                     1                        1
2                          0                                0                         1                     1                        1
3                          0                                0                         1                     1                        1
4                          0                                0                         1                     1                        1
5                          0                                0                         1                     1                        1
6                          0                                0                         1                     1                        1
  Litter2Slash_conv_frac Slash2Energy_conv_frac Slash2Wood_conv_frac Slash2Burn_conv_frac Slash2Decay_conv_frac
1                      1                      0                    0                    0                     1
2                      1                      0                    0                    0                     1
3                      1                      0                    0                    0                     1
4                      1                      0                    0                    0                     1
5                      1                      0                    0                    0                     1
6                      1                      0                    0                    0                     1
  Under2DownDead_conv_frac Soil2Atmos_conv_frac Below2Atmos_conv_frac Below2Soil_conv_frac high_sev_frac med_sev_frac low_sev_frac
1                        0                 0.31                     1                    0             0            0            0
2                        0                 0.31                     1                    0             0            0            0
3                        0                 0.31                     1                    0             0            0            0
4                        0                 0.31                     1                    0             0            0            0
5                        0                 0.31                     1                    0             0            0            0
6                        0                 0.31                     1                    0             0            0            0
  rfrst_need frst_need cm_need fm_need mdw_need wd_need  nonreg_add gen_area_change own_gain_sum Water Sparse Shrubland Grassland
1          0         0       0       0        0       0  0.00000000      -0.2586076     9.105949     0      0         0         0
2          0         0       0       0        0       0  0.00000000      -0.2267089     9.105949     0      0         0         0
3          0         0       0       0        0       0  0.00000000      -2.3172152     9.105949     0      0         0         0
4          0         0       0       0        0       0 -0.03872785      -4.9784810     9.105949     0      0         0         0
5          0         0       0       0        0       0  0.00000000      -0.4682278     9.105949     0      0         0         0
6          0         0       0       0        0       0  0.00000000       0.0000000     9.105949     0      0         0         0
       Forest Meadow Cultivated Developed_all Ice Barren Desert Woodland Above_main_C_den Above_harvested_conv_c StandDead_C_den
1  0.00000000      0          0             0   0      0      0        0        13.217951                      0       0.5414830
2  0.00000000      0          0             0   0      0      0        0        14.179766                      0       0.2609563
3  0.00000000      0          0             0   0      0      0        0         9.953318                      0       0.2426654
4 -0.03872785      0          0             0   0      0      0        0        17.964203                      0       0.2583253
5  0.00000000      0          0             0   0      0      0        0        22.959469                      0       1.6309697
6  0.00000000      0          0             0   0      0      0        0        56.675667                      0       6.0253720
  StandDead_harvested_conv_c Harvested2Wood_conv_c Harvested2Energy_conv_c Harvested2SawmillDecay_conv_c Harvested2Slash_conv_c
1                          0                     0                       0                             0                      0
2                          0                     0                       0                             0                      0
3                          0                     0                       0                             0                      0
4                          0                     0                       0                             0                      0
5                          0                     0                       0                             0                      0
6                          0                     0                       0                             0                      0
  Understory_C_den Under2Slash_conv_c DownDead_C_den DownDead2Slash_conv_c Litter_C_den Litter2Slash_conv_c Slash2Energy_conv_c
1        1.0496879                  0       2.274254                     0     2.379075                   0                   0
2        0.3181454                  0       2.511560                     0     4.096590                   0                   0
3        2.3064257                  0       6.497454                     0     3.488190                   0                   0
4        1.4040262                  0       1.695662                     0     3.114730                   0                   0
5        1.4156525                  0       3.753379                     0     3.277891                   0                   0
6        1.2091185                  0      16.104617                     0    10.702994                   0                   0
  Slash2Wood_conv_c Slash2Burn_conv_c Slash2Decay_conv_c Under2DownDead_conv_c Soil_orgC_den Soil2Atmos_conv_c Below_main_C_den
1                 0                 0                  0                     0      24.65441                 0         3.436667
2                 0                 0                  0                     0      35.53483                 0         3.686739
3                 0                 0                  0                     0      41.90312                 0         2.587862
4                 0                 0                  0                     0      37.65227                 0         4.672405
5                 0                 0                  0                     0     124.78335                 0         5.971650
6                 0                 0                  0                     0     124.74203                 0        14.741075
  Below2Atmos_conv_c Below2Soil_conv_c Above_main_C_den_change Below_main_C_den_change Understory_C_den_change StandDead_C_den_change
1                  0                 0            0.000000e+00            0.000000e+00            0.000000e+00           0.000000e+00
2                  0                 0            0.000000e+00            0.000000e+00            0.000000e+00           0.000000e+00
3                  0                 0            0.000000e+00            0.000000e+00            0.000000e+00           0.000000e+00
4                  0                 0            9.474985e-05            5.134061e-05            5.711331e-06           1.362503e-06
5                  0                 0            0.000000e+00            0.000000e+00            0.000000e+00           0.000000e+00
6                  0                 0            0.000000e+00            0.000000e+00            0.000000e+00           0.000000e+00
  DownDead_C_den_change Litter_C_den_change Soil_orgC_den_change Above_main_C_den2Atmos Understory_C_den2Atmos StandDead_C_den2Atmos
1          0.000000e+00        0.000000e+00          -0.01208437                      0                      0                     0
2          0.000000e+00        0.000000e+00          -0.01965101                      0                      0                     0
3          0.000000e+00        0.000000e+00          -0.02535757                      0                      0                     0
4          8.943547e-06        1.642824e-05          -0.01704926                      0                      0                     0
5          0.000000e+00        0.000000e+00          -0.04012726                      0                      0                     0
6          0.000000e+00        0.000000e+00           0.00000000                      0                      0                     0
  DownDead_C_den2Atmos Litter_C_den2Atmos
1                    0                  0
2                    0                  0
3                    0                  0
4                    0                  0
5                    0                  0
6                    0                  0

> head(own_conv_df_list_pre[[z]])
  Land_Cat_ID Region Land_Type Ownership tot_area base_area_change   area_change     new_area Management man_area man_area_sum
1      200006 C08003     Water   Private   739.35     -1.430886075  -1.430886075   737.919114       <NA>        0            0
2      201006 C08003       Ice   Private     4.95     -0.006835443  -0.006835443     4.943165       <NA>        0            0
3      202006 C08003    Barren   Private     6.30      0.000000000   0.000000000     6.300000       <NA>        0            0
4      203006 C08003    Sparse   Private   796.23     -0.820253165  -0.820253165   795.409747       <NA>        0            0
5      204006 C08003    Desert   Private 12969.99    -12.918987500 -12.918987500 12957.071013       <NA>        0            0
6      205006 C08003 Shrubland   Private 41539.50    -70.433544500 -70.211482773 41469.288517       <NA>        0            0
  initial_man_area non_regen_area base_change_adjust Above_harvested_conv_frac StandDead_harvested_conv_frac Harvested2Wood_conv_frac
1                0              0          0.0000000                         1                             1                        0
2                0              0          0.0000000                         1                             1                        0
3                0              0          0.0000000                         1                             1                        0
4                0              0          0.0000000                         1                             1                        0
5                0              0          0.0000000                         1                             1                        0
6                0              0          0.2220617                         1                             1                        0
  Harvested2Energy_conv_frac Harvested2SawmillDecay_conv_frac Harvested2Slash_conv_frac Under2Slash_conv_frac DownDead2Slash_conv_frac
1                          0                                0                         1                     1                        1
2                          0                                0                         1                     1                        1
3                          0                                0                         1                     1                        1
4                          0                                0                         1                     1                        1
5                          0                                0                         1                     1                        1
6                          0                                0                         1                     1                        1
  Litter2Slash_conv_frac Slash2Energy_conv_frac Slash2Wood_conv_frac Slash2Burn_conv_frac Slash2Decay_conv_frac
1                      1                      0                    0                    0                     1
2                      1                      0                    0                    0                     1
3                      1                      0                    0                    0                     1
4                      1                      0                    0                    0                     1
5                      1                      0                    0                    0                     1
6                      1                      0                    0                    0                     1
  Under2DownDead_conv_frac Soil2Atmos_conv_frac Below2Atmos_conv_frac Below2Soil_conv_frac high_sev_frac med_sev_frac low_sev_frac
1                        0                 0.31                     1                    0             0            0            0
2                        0                 0.31                     1                    0             0            0            0
3                        0                 0.31                     1                    0             0            0            0
4                        0                 0.31                     1                    0             0            0            0
5                        0                 0.31                     1                    0             0            0            0
6                        0                 0.31                     1                    0             0            0            0
  rfrst_need frst_need cm_need fm_need mdw_need wd_need nonreg_add gen_area_change own_gain_sum Water Ice Barren Sparse Desert
1          0         0       0       0        0       0  0.0000000    -1.430886075     228.9805     0   0      0      0      0
2          0         0       0       0        0       0  0.0000000    -0.006835443     228.9805     0   0      0      0      0
3          0         0       0       0        0       0  0.0000000     0.000000000     228.9805     0   0      0      0      0
4          0         0       0       0        0       0  0.0000000    -0.820253165     228.9805     0   0      0      0      0
5          0         0       0       0        0       0  0.0000000   -12.918987500     228.9805     0   0      0      0      0
6          0         0       0       0        0       0 -0.2220617   -70.433544500     228.9805     0   0      0      0      0
  Shrubland Grassland Woodland     Forest Meadow Cultivated Developed_all   row_sums row_sums_diff col_sums_diff Above_main_C_den
1         0         0        0  0.0000000      0          0             0  0.0000000   1.430886075  2.220446e-16       22.9621132
2         0         0        0  0.0000000      0          0             0  0.0000000   0.006835443  0.000000e+00       41.3526033
3         0         0        0  0.0000000      0          0             0  0.0000000   0.000000000  0.000000e+00        0.8226885
4         0         0        0  0.0000000      0          0             0  0.0000000   0.820253165  0.000000e+00       21.5151401
5         0         0        0  0.0000000      0          0             0  0.0000000  12.918987500  0.000000e+00       18.4300919
6         0         0        0 -0.2220617      0          0             0 -0.2220617  70.433544500  0.000000e+00       22.4924166
  Above_harvested_conv_c StandDead_C_den StandDead_harvested_conv_c Harvested2Wood_conv_c Harvested2Energy_conv_c
1                      0       1.4964281                          0                     0                       0
2                      0       6.6667149                          0                     0                       0
3                      0       0.2622651                          0                     0                       0
4                      0       0.8524991                          0                     0                       0
5                      0       0.2558593                          0                     0                       0
6                      0       0.4745050                          0                     0                       0
  Harvested2SawmillDecay_conv_c Harvested2Slash_conv_c Understory_C_den Under2Slash_conv_c DownDead_C_den DownDead2Slash_conv_c
1                             0                      0        1.4303917                  0      10.193841                     0
2                             0                      0        0.8692101                  0      12.695270                     0
3                             0                      0        0.5718440                  0      11.102680                     0
4                             0                      0        0.5965672                  0       4.160282                     0
5                             0                      0        1.5927633                  0       3.183184                     0
6                             0                      0        1.1804606                  0       1.647160                     0
  Litter_C_den Litter2Slash_conv_c Slash2Energy_conv_c Slash2Wood_conv_c Slash2Burn_conv_c Slash2Decay_conv_c Under2DownDead_conv_c
1     5.122162                   0                   0                 0                 0                  0                     0
2     6.028154                   0                   0                 0                 0                  0                     0
3     3.847243                   0                   0                 0                 0                  0                     0
4     4.874998                   0                   0                 0                 0                  0                     0
5     3.273700                   0                   0                 0                 0                  0                     0
6     3.731273                   0                   0                 0                 0                  0                     0
  Soil_orgC_den Soil2Atmos_conv_c Below_main_C_den Below2Atmos_conv_c Below2Soil_conv_c Above_main_C_den2Atmos Above_main_C_den_change
1      76.00223                 0         5.970149                  0                 0                      0            0.0000000000
2      47.09545                 0        10.751677                  0                 0                      0            0.0000000000
3      31.93640                 0         0.213899                  0                 0                      0            0.0000000000
4      51.99409                 0         5.593936                  0                 0                      0            0.0000000000
5      40.34820                 0         4.791824                  0                 0                      0            0.0000000000
6      40.38946                 0         5.851338                  0                 0                      0            0.0001202399
  Below_main_C_den_change Understory_C_den2Atmos Understory_C_den_change StandDead_C_den2Atmos StandDead_C_den_change
1            0.000000e+00                      0            0.000000e+00                     0           0.000000e+00
2            0.000000e+00                      0            0.000000e+00                     0           0.000000e+00
3            0.000000e+00                      0            0.000000e+00                     0           0.000000e+00
4            0.000000e+00                      0            0.000000e+00                     0           0.000000e+00
5            0.000000e+00                      0            0.000000e+00                     0           0.000000e+00
6            4.047053e-05                      0            6.310503e-06                     0           2.536607e-06
  DownDead_C_den2Atmos DownDead_C_den_change Litter_C_den2Atmos Litter_C_den_change Soil_orgC_den_change
1                    0          0.000000e+00                  0        0.000000e+00          -0.10149167
2                    0          0.000000e+00                  0        0.000000e+00          -0.04487345
3                    0          0.000000e+00                  0        0.000000e+00           0.00000000
4                    0          0.000000e+00                  0        0.000000e+00          -0.03695834
5                    0          0.000000e+00                  0        0.000000e+00          -0.02773078
6                    0          8.805383e-06                  0        1.994663e-05          -0.04682194
sbassett commented 2 years ago
> colnames(conv_df_pre)
 [1] "Land_Cat_ID"                      "Region"                           "Land_Type"                       
 [4] "Ownership"                        "tot_area"                         "base_area_change"                
 [7] "area_change"                      "new_area"                         "Management"                      
[10] "man_area"                         "man_area_sum"                     "initial_man_area"                
[13] "non_regen_area"                   "base_change_adjust"               "Above_harvested_conv_frac"       
[16] "StandDead_harvested_conv_frac"    "Harvested2Wood_conv_frac"         "Harvested2Energy_conv_frac"      
[19] "Harvested2SawmillDecay_conv_frac" "Harvested2Slash_conv_frac"        "Under2Slash_conv_frac"           
[22] "DownDead2Slash_conv_frac"         "Litter2Slash_conv_frac"           "Slash2Energy_conv_frac"          
[25] "Slash2Wood_conv_frac"             "Slash2Burn_conv_frac"             "Slash2Decay_conv_frac"           
[28] "Under2DownDead_conv_frac"         "Soil2Atmos_conv_frac"             "Below2Atmos_conv_frac"           
[31] "Below2Soil_conv_frac"             "high_sev_frac"                    "med_sev_frac"                    
[34] "low_sev_frac"                     "rfrst_need"                       "frst_need"                       
[37] "cm_need"                          "fm_need"                          "mdw_need"                        
[40] "wd_need"                          "nonreg_add"                       "gen_area_change"                 
[43] "own_gain_sum"                     "Water"                            "Sparse"                          
[46] "Shrubland"                        "Grassland"                        "Forest"                          
[49] "Meadow"                           "Cultivated"                       "Developed_all"                   
[52] "Ice"                              "Barren"                           "Desert"                          
[55] "Woodland"                         "Above_main_C_den"                 "Above_harvested_conv_c"          
[58] "StandDead_C_den"                  "StandDead_harvested_conv_c"       "Harvested2Wood_conv_c"           
[61] "Harvested2Energy_conv_c"          "Harvested2SawmillDecay_conv_c"    "Harvested2Slash_conv_c"          
[64] "Understory_C_den"                 "Under2Slash_conv_c"               "DownDead_C_den"                  
[67] "DownDead2Slash_conv_c"            "Litter_C_den"                     "Litter2Slash_conv_c"             
[70] "Slash2Energy_conv_c"              "Slash2Wood_conv_c"                "Slash2Burn_conv_c"               
[73] "Slash2Decay_conv_c"               "Under2DownDead_conv_c"            "Soil_orgC_den"                   
[76] "Soil2Atmos_conv_c"                "Below_main_C_den"                 "Below2Atmos_conv_c"              
[79] "Below2Soil_conv_c"                "Above_main_C_den_change"          "Below_main_C_den_change"         
[82] "Understory_C_den_change"          "StandDead_C_den_change"           "DownDead_C_den_change"           
[85] "Litter_C_den_change"              "Soil_orgC_den_change"             "Above_main_C_den2Atmos"          
[88] "Understory_C_den2Atmos"           "StandDead_C_den2Atmos"            "DownDead_C_den2Atmos"            
[91] "Litter_C_den2Atmos"              
> colnames(own_conv_df_list_pre[[z]])
 [1] "Land_Cat_ID"                      "Region"                           "Land_Type"                       
 [4] "Ownership"                        "tot_area"                         "base_area_change"                
 [7] "area_change"                      "new_area"                         "Management"                      
[10] "man_area"                         "man_area_sum"                     "initial_man_area"                
[13] "non_regen_area"                   "base_change_adjust"               "Above_harvested_conv_frac"       
[16] "StandDead_harvested_conv_frac"    "Harvested2Wood_conv_frac"         "Harvested2Energy_conv_frac"      
[19] "Harvested2SawmillDecay_conv_frac" "Harvested2Slash_conv_frac"        "Under2Slash_conv_frac"           
[22] "DownDead2Slash_conv_frac"         "Litter2Slash_conv_frac"           "Slash2Energy_conv_frac"          
[25] "Slash2Wood_conv_frac"             "Slash2Burn_conv_frac"             "Slash2Decay_conv_frac"           
[28] "Under2DownDead_conv_frac"         "Soil2Atmos_conv_frac"             "Below2Atmos_conv_frac"           
[31] "Below2Soil_conv_frac"             "high_sev_frac"                    "med_sev_frac"                    
[34] "low_sev_frac"                     "rfrst_need"                       "frst_need"                       
[37] "cm_need"                          "fm_need"                          "mdw_need"                        
[40] "wd_need"                          "nonreg_add"                       "gen_area_change"                 
[43] "own_gain_sum"                     "Water"                            "Ice"                             
[46] "Barren"                           "Sparse"                           "Desert"                          
[49] "Shrubland"                        "Grassland"                        "Woodland"                        
[52] "Forest"                           "Meadow"                           "Cultivated"                      
[55] "Developed_all"                    "row_sums"                         "row_sums_diff"                   
[58] "col_sums_diff"                    "Above_main_C_den"                 "Above_harvested_conv_c"          
[61] "StandDead_C_den"                  "StandDead_harvested_conv_c"       "Harvested2Wood_conv_c"           
[64] "Harvested2Energy_conv_c"          "Harvested2SawmillDecay_conv_c"    "Harvested2Slash_conv_c"          
[67] "Understory_C_den"                 "Under2Slash_conv_c"               "DownDead_C_den"                  
[70] "DownDead2Slash_conv_c"            "Litter_C_den"                     "Litter2Slash_conv_c"             
[73] "Slash2Energy_conv_c"              "Slash2Wood_conv_c"                "Slash2Burn_conv_c"               
[76] "Slash2Decay_conv_c"               "Under2DownDead_conv_c"            "Soil_orgC_den"                   
[79] "Soil2Atmos_conv_c"                "Below_main_C_den"                 "Below2Atmos_conv_c"              
[82] "Below2Soil_conv_c"                "Above_main_C_den2Atmos"           "Above_main_C_den_change"         
[85] "Below_main_C_den_change"          "Understory_C_den2Atmos"           "Understory_C_den_change"         
[88] "StandDead_C_den2Atmos"            "StandDead_C_den_change"           "DownDead_C_den2Atmos"            
[91] "DownDead_C_den_change"            "Litter_C_den2Atmos"               "Litter_C_den_change"             
[94] "Soil_orgC_den_change"       
sbassett commented 2 years ago

own_conv_df_list_pre[[z]] has three extra attributes row_sums row_sums_diff col_sums_diff

conv_df_pre doesn't have them

am using dplyr's "bind_rows()" to mitigate this, could also add or drop the extra rows using base R if needed