SantanderMetGroup / climate4R

An R Framework for Climate Data Access and Post-processing
127 stars 43 forks source link

Error doing bias correction for CMIP6 tasmax #48

Open Vik-1 opened 2 years ago

Vik-1 commented 2 years ago

****

load observed "tasmax" data

obs.tx <- loadGridData(dataset = "tasmax_1995.2014_K.nc",

  • var = 'tasmax', lonLim = c(20.25,94.75), latLim = c(10.25,39.75),
  • season = 1:12, years = 1995:2014) [2022-07-12 08:28:03] Defining geo-location parameters [2022-07-12 08:28:03] Defining time selection parameters [2022-07-12 08:28:03] Retrieving data subset ... [2022-07-12 08:28:07] Done

h.tx <- loadGridData(dataset = "tasmax_day_ACCESS-ESM1-5_historical.r1i1p1f1.gn.1995-2014.nc",

  • var = 'tasmax', lonLim = c(20.25,94.75), latLim = c(10.25,39.75),
  • season = 1:12, years = 1995:2014) [2022-07-12 08:28:07] Defining geo-location parameters [2022-07-12 08:28:07] Defining time selection parameters [2022-07-12 08:28:07] Retrieving data subset ... [2022-07-12 08:28:10] Done

BCC.temp.eqm <- biasCorrection(y = obs.tx, x = h.tx,

  • newdata = h.tx,
  • method = "eqm",
  • extrapolation = "constant",
  • wet.threshold = 0.1) [2022-07-12 08:28:10] Trying to determine the time zone... [2022-07-12 08:28:10] Time zone identified and set to GMT See 'setGridDates.asPOSIXlt' to change the time zone [2022-07-12 08:28:13] Already complete date record. Nothing was done [2022-07-12 08:28:14] Trying to determine the time zone... [2022-07-12 08:28:14] Time zone identified and set to GMT See 'setGridDates.asPOSIXlt' to change the time zone [2022-07-12 08:28:16] Already complete date record. Nothing was done [2022-07-12 08:28:17] Trying to determine the time zone... [2022-07-12 08:28:17] Time zone identified and set to GMT See 'setGridDates.asPOSIXlt' to change the time zone [2022-07-12 08:28:19] Already complete date record. Nothing was done [2022-07-12 08:28:27] Argument precipitation is set as FALSE, please ensure that this matches your data. [2022-07-12 08:28:33] Number of windows considered: 1... [2022-07-12 08:28:34] Bias-correcting 1 members separately... Error in if (class(mat) == "numeric") mat <- as.matrix(mat) : the condition has length > 1

How can I solve this problem? the unit for the tasmax datasets is K

durutti commented 1 year ago

a workaround is to reshape the 3-D arrays to 2-D (time,lat*lon) and then perform bias correction.