plesager / ece3-postproc

Suite of processing tools for EC-Earth3 output
5 stars 8 forks source link

cdfmean in hiresclim2 doesn't work properly with 3-d fields from CMIP6 NEMO output #44

Open klauswyser opened 5 years ago

klauswyser commented 5 years ago

The name of the depth dimension in the grid_T_3D file has changed from "depth" to "olevel" which confuses cdfmean when computing the global mean of votemper and vosaline. Interestingly enough, execution doesn't stop but the average is computed only for the top layer.

klauswyser commented 5 years ago

My solution is to replace

    (( $cdftools4 )) && $cdftoolsbin/cdfmean -f ${froot}_${NEMO_T3D_FILES}.nc -v $v -p T \
            || $cdftoolsbin/cdfmean ${froot}_${NEMO_T3D_FILES}.nc $v T 

by

    if (( $cdftools4 ))
    then
        $cdo -f nc selvar,$v ${froot}_${NEMO_T3D_FILES}.nc tmp_$v.nc
        ncrename -d .olevel,depth tmp_$v.nc
        $cdftoolsbin/cdfmean -f tmp_$v.nc -v $v -p T
    else
        $cdftoolsbin/cdfmean ${froot}_${NEMO_T3D_FILES}.nc $v T
    fi

in hiresclim2/script/nemo_post.sh.

plesager commented 5 years ago

Isn't the renaming of the level dimension also needed for other version of CDFtools?

klauswyser commented 5 years ago

I don't know if the renaming is also necessary for older versions, haven't tried because I only have the newset CDFTOOLS (which by the way could make all this name mangling superfluous if compiled with the CMIP6 switch, but this would then break backward compatibility of our monitoring).

Another potential issue are other analysis of 3-d fields, I ma thinming mainly of AMOC and the heat content. Are we aure that these variables are computed properly, taking the entire depth of the ocean into account and not only the top level? I haven't checked.

plesager commented 5 years ago

Committed in 5a2197a