regi0008 / S2Scalibrationextremeheat

Project is based on climate4R R-based framework for climate data access and post-processing.
0 stars 0 forks source link

To get fcst_cal_EQM.nc file using Empirical Quantile Mapping (eqm) via downscaleR in climate4R #7

Open regi0008 opened 5 years ago

regi0008 commented 5 years ago

The "hyfo" package in R is able to load the .nc file of "2t_201902_Mar_rev.nc" for forecast, and "2t_era5_Mar_1993_2016_rev.nc" for observation.

However, when calibration is set to EQM, biasCorrection() is used instead of cal_CCR() / cal_LM() / cal_MVA() and an error occurs as shown below in bold:

##########

dir <- "C:/Users/regin/Desktop/R/S2Scalibrationextremeheat/loadeR" fcst <- loadNcdf(file.path(dir, "2t_201902_Mar_rev.nc"), "tas") [1] "member" "time" "lat" "lon"
[1] 4 3 2 1 Loading data... Processing... obs <- loadNcdf(file.path(dir, "2t_era5_Mar_1993_2016_rev.nc"), "tas") [1] "time" "lat" "lon" [1] 3 2 1 Loading data... Processing...

apply calibraton

below is for bias adjustment (BA) - empirical quantile mapping (EQM)

fcst_cal <- biasCorrection(obs, fcst, method = "eqm", cross.val = "loo", join.members = TRUE, n.quantiles = NULL) Validation 1, 23 remaining Error in interpGrid(x, getGrid(y)) : Invalid grid definition in Y

fcst_cal_fileName <- "fcst_cal_EQM.nc" writeNcdf(fcst_cal, fcst_cal_fileName) Error in writeNcdf(fcst_cal, fcst_cal_fileName) : object 'fcst_cal' not found ##########