Error in gcm.f.months[[mn]] : subscript out of bounds in ClimDown BCCAQv2

24 Views Asked by At

I am trying to use the bccaq.netcdf.wrapper function in ClimDown, but the model fails every time bias correcting the aggregated observations. I have checked the input variables for errors but have been unable to get past this error. The downscale script, console output, and variable files have been attached.

Downscale code:

##Loading required libraries
library(ClimDown)
library(ncdf4)
library(tidyr)
library(tidync)
library(udunits2)

setwd('*****/*****/ClimDown')

time_start <- Sys.time()
test_tmp.nc <- tempfile(fileext='.nc')
options(
  calibration.start=as.POSIXct('2000-01-01', tz='GMT'),
  calibration.end=as.POSIXct('2002-12-31', tz='GMT')
)
ClimDown::bccaq.netcdf.wrapper('pr_day_CNRM-ESM2-1_historical_r1i1p1f2_gr_2000_2_v1.nc', 'tmp_1.nc', test_tmp.nc, 'pr')
unlink(test_tmp.nc)

time_stop <- Sys.time()
time_spent <- time_stop - time_start

Console output:

[1] "Calculating daily anomalies on the GCM"
[1] "Creating cache file for the interpolated GCM"
[1] "Interpolating the GCM daily anomalies to observation grid"
[1] "Interpolating timesteps 1 - 787 / 1096 to file /tmp/RtmpwEDDDT/file229f2db056101.nc"
[1] "Interpolating timesteps 788 - 1096 / 1096 to file /tmp/RtmpwEDDDT/file229f2db056101.nc"
[1] "Calculating the monthly factor across the observation time series"
[1] "Calculating the monthly climatologies for the observations"
[1] "Reading timesteps 1 : 365 / 365 from file: tmp_1.nc"
[1] "Computing the temporal mean"
[1] "Calculating the monthly factor across the GCM time series"
[1] "Adding the monthly climatologies to the interpolated GCM"
[1] "Applying climatologies to file /tmp/RtmpwEDDDT/file229f2db056101.nc steps 1 : 787 / 1096"
[1] "Applying climatologies to file /tmp/RtmpwEDDDT/file229f2db056101.nc steps 788 : 1096 / 1096"
[1] "Opening the input files and reading metadata"
[1] "Calculating the time factors outside in order to subdivide the problem space"
Creating output file /tmp/RtmpwEDDDT/file229f2d2fd9bf91.nc 
[1] "Bias correcting pr longitudes 1 - 196 / 364"
[1] "Reading longitudes 1 - 196 / 364 from file: tmp_1.nc"
[1] "... and reading latitudes 1 - 468 / 468"
[1] "Reading longitudes 1 - 196 / 364 from file: /tmp/RtmpwEDDDT/file229f2db056101.nc"
[1] "... and reading latitudes 1 - 468 / 468"
[1] "Computing QDM on 91728 cells"
[1] "Writing chunk 1 - 196 / 364 to file: /tmp/RtmpwEDDDT/file229f2d2fd9bf91.nc"
[1] "Bias correcting pr longitudes 197 - 364 / 364"
[1] "Reading longitudes 197 - 364 / 364 from file: tmp_1.nc"
[1] "... and reading latitudes 1 - 468 / 468"
[1] "Reading longitudes 197 - 364 / 364 from file: /tmp/RtmpwEDDDT/file229f2db056101.nc"
[1] "... and reading latitudes 1 - 468 / 468"
[1] "Computing QDM on 78624 cells"
[1] "Writing chunk 197 - 364 / 364 to file: /tmp/RtmpwEDDDT/file229f2d2fd9bf91.nc"
[1] "Closing up the input and output files"
[1] "Elapsed Time"
    user   system  elapsed 
2095.106   55.041 2157.772 
[1] "Aggregating observations to GCM scale"
[1] "Aggregating timesteps 1 - 365 / 365"
[1] "Reading time values from the aggregated observations"
[1] "Bias correcting the aggregated observations"
Error in gcm.f.months[[mn]] : subscript out of bounds

Attached data

0

There are 0 best solutions below