# **************************** LICENSE START ***********************************
#
# Copyright 2012 ECMWF. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************

# ===============================================================
# fc_an_diff
# A function to compute a difference field
# ===============================================================

function fc_an_diff (fname, par, vf_date, n_of_days)

	infile = read (fname)

	fc = read(
		type		: "fc",
		param		: par,
		date		: vf_date - n_of_days,
		step		: n_of_days * 24,
		data		: infile
		)


	an = read(
		type		: "an",
		param		: par,
		date		: vf_date,
		step		: 0,
		data		: infile
		)


	return fc - an

end fc_an_diff

