Skip to content

Error in calc_hap_impacts(): left_join_no_match NA values when running with GCAM 6.0 database #3

@gcs1024

Description

@gcs1024

Hello,
I can run the example successfully. Now I am trying to run the calc_hap_impacts() function by assigning the db_path and db_name with a GCAM 6.0 database, but I encounter an error during execution.

Code

library(rhap)
#Set java path
Sys.setenv(PATH = paste("D:/Java/jdk-20.0.2/bin", Sys.getenv("PATH"), sep = ";"))
#Set project and scenario names
my_db_path <- "E:/GCAM/gcam-v6.0-Windows-Release-Package/output"
my_db_name <- "database_basexdb"
my_prj_name <- "gcs1"
my_scen_name <- "Reference"
hap_damages <- calc_hap_impacts(
db_path = my_db_path,
db_name = my_db_name,
prj_name = my_prj_name,
scen_name = my_scen_name,
final_db_year = 2100,
saveOutput = TRUE,
map = TRUE,
anim = TRUE,
HIA_var = "deaths",
normalized = TRUE,
by_gr = FALSE
)
head(hap_damages)

Error message

Creating project ...
Database scenarios: Reference
Running rhap ...
Error in gcamdata::left_join_error_no_match(., pop_share, by = c("ssp", :
left_join_no_match: NA values in new data columns
In addition: Warning messages:
1: Expected 2 pieces. Missing pieces filled with NA in 15210 rows [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
2: Expected 2 pieces. Missing pieces filled with NA in 687 rows [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].

Session info

Image

The error appears to occur during a left_join involving pop_share. It seems some join keys may not match, which results in NA values and triggers left_join_error_no_match() from the gcamdata package.
I suspect this may be related to differences between GCAM 6 query outputs and the expected structure in RHAP, but I am not sure. Is RHAP currently compatible with GCAM 6.0 outputs?
Any suggestions would be greatly appreciated.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions