Error while processing CFSR raw data with croco-tools

Hi Croco community,

I am trying to setup a new region with interannual forcing by following the same technique as in Benguela case.

I have downloaded the CFSR raw netcdf files and I am running the Process_CFSR_files_for_CROCO.sh script for the variables:

varnameCFSR=(
DSWRF_L1_Avg_1
DLWRF_L1_Avg_1
ULWRF_L1_Avg_1
USWRF_L1_Avg_1
U_GRD_L103
V_GRD_L103
PRATE_L1_Avg_1
TMP_L103
SPF_H_L103
TMP_L1
)

varnameCROCO=(
Downward_Short-Wave_Rad_Flux_surface
Downward_Long-Wave_Rad_Flux
Upward_Long-Wave_Rad_Flux_surface
Upward_Short-Wave_Rad_Flux_surface
U-component_of_wind
V-component_of_wind
Precipitation_rate
Temperature_height_above_ground
Specific_humidity
Temperature_surface
)

The script works fine and generates the monthly nc files for some variables (e.g. Downward_Short-Wave_Rad_Flux_surface, Downward_Long-Wave_Rad_Flux, Upward_Long-Wave_Rad_Flux_surface, Upward_Short-Wave_Rad_Flux_surface, Precipitation_rate) but it fails for other variables (e.g. U-component_of_wind, V-component_of_wind, Temperature_surface)

I have checked the raw CFSR files for correct variable names and for temporal range and both the names and the times are correct.

But I am getting the following error:
… in file U_GRD_L103_flxf06.gdas.20051221-20051225.grb2.nc
double free or corruption (out)
./Process_CFSR_files_for_CROCO.sh: line 193: 47992 Aborted ncwa -O -a record ${var}${ffile} ${var}${ffile}

Any ideas where the error is coming from?

P.S. I am using the latest version of CROCO 1.2.1 and croco tools.
Regards
Konstantinos

I noticed in the script the option:
ncwa -O -a record ${var}${ffile} ${var}${ffile} # <<<< the problematic line

other way to define the dimension as unlimited dimension

#ncks -O --mk_rec_dmn $time_dim ${var}${ffile} ${var}${ffile} # <<<<<< alternative way

So I commented out the problematic line and uncommented the alternative line and it seems to overcome the error. But I still have to check and run the CROCO monthly netcdf generated files to make sure they are working properly.