Revision 8ce033d8
Added by Benoit Parmentier about 8 years ago
climate/research/oregon/interpolation/global_product_assessment_part1_functions.R | ||
---|---|---|
19 | 19 |
# |
20 | 20 |
#setfacl -Rmd user:aguzman4:rwx /nobackupp8/bparmen1/output_run10_1500x4500_global_analyses_pred_1992_10052015 |
21 | 21 |
|
22 |
##COMMIT: adding windowing and more options to plotting function time series
|
|
22 |
##COMMIT: time profiles run on multiple selected stations and fixing bugs
|
|
23 | 23 |
|
24 | 24 |
################################################################################################# |
25 | 25 |
|
... | ... | |
807 | 807 |
########## Start script ######### |
808 | 808 |
|
809 | 809 |
## Screen of NaN and make sure we have NA |
810 |
df_pix_ts[is.na(df_pix_ts)] <- NA
|
|
810 |
df_pix_time_series[is.na(df_pix_time_series)] <- NA
|
|
811 | 811 |
|
812 | 812 |
#Scale if necessary, this should be a list |
813 | 813 |
if(!is.null(scaling_factors)){ |
814 | 814 |
|
815 |
df_pix_ts[[var_name2]] <- df_pix_ts[[var_name2]]*scaling_factors[2]
|
|
815 |
df_pix_time_series[[var_name2]] <- df_pix_time_series[[var_name2]]*scaling_factors[2]
|
|
816 | 816 |
} |
817 | 817 |
|
818 | 818 |
if(is.null(time_series_id)){ |
819 |
time_series_id <- unique(na.omit(df_pix_ts$id)) |
|
819 |
time_series_id <- unique(na.omit(df_pix_time_series$id))
|
|
820 | 820 |
} |
821 | 821 |
|
822 | 822 |
#### var_name 1 |
823 |
d_z_obs <- zoo(as.numeric(df_pix_ts[[var_name1]]),as.Date(df_pix_ts$date))
|
|
823 |
d_z_obs <- zoo(as.numeric(df_pix_time_series[[var_name1]]),as.Date(df_pix_time_series$date))
|
|
824 | 824 |
#plot(d_z_obs) |
825 | 825 |
|
826 | 826 |
#### var_name 2 |
827 |
d_z_var <- zoo(as.numeric(df_pix_ts[[var_name2]]),as.Date(df_pix_ts$date)) #make sure date is a date object !!!
|
|
827 |
d_z_var <- zoo(as.numeric(df_pix_time_series[[var_name2]]),as.Date(df_pix_time_series$date)) #make sure date is a date object !!!
|
|
828 | 828 |
#names(d_z_var) <- var_pred_mosaic |
829 | 829 |
#plot(d_z_var) |
830 | 830 |
|
831 | 831 |
d_z_diff <- d_z_var - d_z_obs #this is residuals if var is predicted |
832 | 832 |
#d_z_res <- d_z_var - d_z_obs |
833 | 833 |
|
834 |
#d_z_res <- zoo(as.numeric(df_pix_ts[[paste0("res_",var_pred_mosaic)]]),as.Date(df_pix_ts$date))
|
|
834 |
#d_z_res <- zoo(as.numeric(df_pix_time_series[[paste0("res_",var_pred_mosaic)]]),as.Date(df_pix_time_series$date))
|
|
835 | 835 |
#plot(d_z_diff) |
836 | 836 |
|
837 | 837 |
d_z_all <- merge(d_z_obs,d_z_var,d_z_diff) |
... | ... | |
866 | 866 |
#day_end <- "2014-12-31" #PARAM 13 arg 13 |
867 | 867 |
start_date <- as.Date(day_start) |
868 | 868 |
end_date <- as.Date(day_end) |
869 |
#range_year <- range(df_pix_ts$year) |
|
869 |
#range_year <- range(df_pix_time_series$year)
|
|
870 | 870 |
#start_year <- range_year[1] |
871 | 871 |
#end_year <- range_year[2] |
872 | 872 |
#var="tmax" |
Also available in: Unified diff
time profiles run on multiple selected stations and fixing bugs