climate4R icon indicating copy to clipboard operation
climate4R copied to clipboard

How to save biascorrected grids?

Open Fisico2k opened this issue 2 years ago • 1 comments

After biasCorrection command, I need to save the resulting grid in netCDF format. I use grid2nc command and the file is correctly created. But when I try to reopen ti with loadGridData there is this error:

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, : java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3

Actually, I note that files correctly opened by loadGridData (i.e. ESGF model outputs) have this output:

dataInventory("path_to_file") $pr = $Description 'Precipitation' ...... etc........ $Dimensions $time ...etc.... $lat ...etc... $lon ...etc...

On the contrary files from bias-corrected grids have this type of output:

dataInventory("path_to_file") $pr = $Description 'Precipitation' ...... etc........ $Dimensions $lat ...etc... $lon ...etc...

It seems theere is no time dimension and the error seems to depend on it (Am I right???). But time data are actually presente in the grid! Only the format is different indeed. It is so:

$Dates $start '2021-01-01 UTC'.....................

Otherwise in "ordinary" grids it is so:

$Dates $start '2021-01-01 12:00:00 GMT'.....................

Anybody can help me to try to solve?

Fisico2k avatar Oct 04 '22 11:10 Fisico2k

your bias adjusted grid variable data shoud be a 3D array with dims time lat lon. What are dimensions of the grids going into biasCorrection?

durutti avatar Oct 27 '22 13:10 durutti