# Metview Macro

# **************************** 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 ************************************

function check_mars_order
	mars_order = marsorder()

	my_order = [
					"DATE",
					"TIME",

					"REFERENCE",
					"STEP",
					"VERIFY",
					"FCMONTH",
					"FCPERIOD",

					"EXPVER",
					"ORIGIN",
					"DOMAIN",

					"DIAGNOSTIC",
					"ITERATION",

					"NUMBER",

					"LEVELIST",
					"LATITUDE",
					"LONGITUDE",
					"RANGE",

					"PARAM",

					 #/* For 2-d wave-spectra products */
					"FREQUENCY",
					"DIRECTION",

					#/* For EA, EF */
					"CHANNEL"
				]

	for i = 1 to count(my_order) do
		if (my_order[i] <> mars_order[i]) then
			fail("The order of the fields within the MARS module has changed")
		end if
	end for
	
end check_mars_order
