#!/bin/bash



rm log.txt>/dev/null 2>> log.txt



mainPath=/work/mh0020/m300483/CEBA/experiments

readGPP=true

mask=maskCEBa
year=1976



expFolder=rs0CEBa3h
outFolder=outdata_20200824_hourlyCEBa_ws1
currExp=rs0CEBa3h
´


# 49 Tcan
# 50 Tgrd
# 75 tair
# 87 cosz
# 107 lai
# 139 tsurf/tcas
´

if [ $readGPP == true ] ; then
	outputFile=${outdataPath}/jsbach/${currExp}.1979-2008.grb
	echo "Read GPP..."
	#25,49,75,81,82,83,107
	cdo -s -select,code=87,124,126 ${outdataPath}/jsbach/${expFolder}_jsbach_land_{1979..2008}.grb ${outputFile}>/dev/null 2>> log.txt
	#cdo -s -t ${codeFile} -f nc copy -mul ${outputFile} maskNH.nc ${outdataPath}/jsbach/${currExp}.1976.maskNH.hourly.Apr-Oct.nc>/dev/null 2>> log.txt
	#cdo -s -t ${codeFile} -f nc copy -mul ${outputFile} cebaMaskNaN.nc ${outdataPath}/jsbach/${currExp}.GPP.1979-2008.maskCEBa.hourly.Apr-Sep.nc>/dev/null 2>> log.txt
	#cdo -s -t ${codeFile} -f nc copy -mul -ymonmean -yearmean -selmon,4,5,6,7,8,9 ${outputFile} cebaMaskNaN.nc ${outdataPath}/jsbach/${currExp}.GPP.1979-2008.maskCEBa.hourly.Apr-Sep.nc>/dev/null 2>> log.txt
	cdo -s -t ${codeFile} -f nc copy -mul -ymonmean -yearmean -selmon,4,5,6,7,8,9 ${outputFile} ${mask}.nc ${outdataPath}/jsbach/${currExp}.GPP.1979-2008.maskCEBa.hourly.Apr-Sep.nc>/dev/null 2>> log.txt

fi
´
