I am calculating C factor by using the following equation:
C factor =1, coverfraction= 0
C factor =-0.083 xlg(coverfraction) + 0.417, 0 < coverfraction < 78.3%,
C factor= 0, coverfraction > 78.3%,
To calculate the total C factor, I apply part of the equation C factor = 0.417 − 0.083 × lg(coverfraction). But I dont know how to apply the conditions of cover fraction in the script using the cdo. In this case the log of all values is calculated including 0 and the values more than 78.3%.
The code is:
echo "Log: " $gc_ofile
cdo -O -L -log inputfile.nc ofilelog.nc
cdo -O -L "-mulc,-0.083" outputlogfile.nc ofilemulti.nc
cdo -O -L "-addc,0.417" ofilemulti.nc cfactor.nc