# anomaly_1979_2012.scr

# This csh scripting code (using CDO operators) was used on CEDA JASMIN to produce
# NETCDF files that contain the seasonal anomaly of various JULES parameters (i.e., soil moisture or NPP)
# over the whole globe from 1979-2012
# using (as input) monthly-averaged JULES land-only 1D data.
# The code was written in November 2017 by Patrick McGuire
# at the University of Reading (email: p.mcguire@reading.ac.uk )
#! /bin/csh
set path1=’/work/scratch/pmcguire/config/outputs/’
set prefix2=’Euro44_bvv_nancil_CTL-BCJ-GL_jules-vn4.9p_u-as052globeE_monmean_’
#N.B.: seasavg and seasmean treat missing values differently
echo ‘Computing monthly average’
cdo ymonavg ${prefix2}1979_2012.nc ${prefix2}1979_2012_ymonavg.nc
echo ‘Computing monthly standard deviation’
cdo ymonstd1 ${prefix2}1979_2012.nc ${prefix2}1979_2012_ymonstd1.nc
#echo ‘Computing monthly anomalies’
#cdo ymonsub ${prefix2}1979_2012.nc ${prefix2}1979_2012_ymonavg.nc ${prefix2}1979_2012_ymonanom.nc
#echo ‘Computing standardized seasonal anomalies’
#cdo ymondiv ${prefix2}1979_2012_ymonanom.nc ${prefix2}1979_2012_ymonstd1.nc ${prefix2}1979_2012_ymonstd1anom.nc
foreach yr (1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012)
echo monmean ${yr}
echo ‘Computing monthly anomalies’
cdo ymonsub ${prefix2}${yr}.nc ${prefix2}1979_2012_ymonavg.nc ${prefix2}${yr}__1979_2012_ymonanom.nc
echo ‘Computing standardized monthly anomalies’
cdo ymondiv ${prefix2}${yr}__1979_2012_ymonanom.nc ${prefix2}1979_2012_ymonstd1.nc ${prefix2}${yr}__1979_2012_ymonstd1anom.nc
end
exit