library(Ipaper) library(lubridate) library(RHtests) library(tidymet) library(tidyfst) devtools::load_all() devtools::load_all("../RHtests.R")
f_input <- "data-raw/INPUT/INPUT_met2474_Tmax&RHmax_for_HImax_1951-2022_V2.fst" # export_fst(df2, f_input) df = import_fst(f_input) sites <- df[, .N, .(site)]$site
# profvis::profvis({ # system.time({ # px <- proffer::pprof({ # out <- homogenize_daily(df, lst_TP, varname, nsite = 10) # }) varname = "RH_avg" sitename = sites_ex[1] # sitename = 50247 #"sites[50247] l = get_Input(df, sitename, varname) prefix <- "./OUTPUT/example01" r_month <- RHtests_process(l$month, NULL, l$metadata, prefix, is_plot = FALSE, maxgap = 366) r_year <- RHtests_process(l$year, NULL, l$metadata, prefix, is_plot = FALSE, maxgap = 366) st_moveInfo[site == sitename] info = TP_mergeYM(list(month = r_month, year = r_year)) # info <- TP_mergeYM_sites(res2) info2 <- info %>% TP_high_conf() info2 # sites_adj <- info2[, .N, .(site)][, site] plot_output(r_month$data, "month.pdf", show=TRUE) plot_output(r_year$data, "year.pdf", show = TRUE)
load("Z:/GitHub/rpkgs/RHtestsHelper/OUTPUT/ChinaHI/RHtests_v20230328_RH_avg_st_refer.rda")
site_target = sitename site_refer = d_refs[target == sitename, site] d_target = df[site == site_target, .(date, value = RH_avg)] d_refer = df[site == site_refer, .(date, value = RH_avg)] d <- merge(d_target, d_refer %>% set_names(c("date", "ref")), all.x = TRUE) metadata <- get_metadata(d, site_target) r <- homogenize.wRef(d, metadata) plot_output(r$year$data, "year_withRef.pdf", show = TRUE)
l = RHtests_input(d) %>% map(data.table) d2 = l$year %>% mutate(diff = value - ref) p1 <- ggplot(d2, aes(year)) + geom_line(aes(y = value), color = "black") + geom_line(aes(y = ref), color = "red") # geom_line(aes(y = value), color = "black") + p2 = ggplot(d2, aes(year)) + geom_line(aes(y = diff), color = "black") p = p1 / p2 write_fig(p, 'd:/Rplot.pdf', 10, 6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.