# 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 grib_codes
return (

	model		: ( indx	:	3),

	param		:
		(							# Parameter Indicator
				indx	: 	6,
				ff10	:	207,	# 10m windspeed
				tp		:	228,	# Total precipitation
				

                					# probabilities
				"10sp"	:	165,	# 10 metre speed probability
				ttp		:	228,	# Total precipitation probability
				tap		:	130,	# Temperature anomaly probability
				"2tp"	:	167,	# 2 metre temperature probability
				swhp	:	229,	# Significant wave height probability
				mwpp	:	232		# Mean wave period probability
			),

	step1		:(	indx	:	16),
	step2		:(	indx	:	17),
	timerange	:(	indx	:	18),
	table2		:						# Version number of table 2
		(
			indx		:1,
			default		:128,
			gradients	:129,# Gradients
			astex		:130,# ASTEX
			proba		:131,# Probability forecast
			wave		:140,# Wave
			oceanp		:150,# Ocean - preliminary
			oceano		:151,# Ocean - operational
			era_stats	:160,# ECMWF Re-analysis Stats
            seasonal	:170,# Seasonal Forecasting
            ecsn		:180,# ECSN - HIRETYCS
            demeter		:190 # DEMETER
		),

	local		:						 # ECMWF local GRIB usage
		(
			indx		:	37,
		 	ensemble	:1, # MARS labelling or ensemble forecast data 
			clusterm	:2, # Cluster means and standard deviations
			satellite	:3, # Satellite image data
			ocean		:4, # Ocean model data
			proba		:5, # Forecast probability data
			sst			:6, # Surface temperature data
			sensitivity	:7, # Sensitivity data
			era			:8, # ECMWF re-analysis data
			sing_vector	:9, # Singular vectors and ensemble perturbations
			tubes		:10,# EPS tubes 
			suppl		:11,# Supplementary data used by the analysis
			wave2d		:13,# Wave 2D spectra direction and frequency
			brightness	:14,# Brightness temperature
			seasonal	:15,# Seasonal forecast data
			seasonalm	:16,# Seasonal forecast monthly mean data
			sstice		:17,# Surface temperature or sea-ice data
			multi_an_ef	:18 # Multi-analysis ensemble forecast
		),

	mars_class	:
		(
			indx		:	38,
			od			:1,	# Operations
			rd			:2,	# Research
			era15		:3,	# ECMWF 15-year re-analysis (ERA 15)
			eu_clim		:4,	# European climate support network
			era40		:5,	# ECMWF 40-year re-analysis (ERA 40)
			demeter		:6,	# DEMETER
			provost		:7	# PROVOST
		),

	mars_type	:
		(
			indx		:39,
			# (using MARS abbreviations when defined)
			fg			:1, # First Guess
			an			:2, # Analysis
			ia			:3, # Initialised analysis
			oi			:4, # OI analysis
			"3v"		:5, # 3 D variational analysis
			"4v"		:6, # 4 D variational analysis
			"3g"		:7, # 3 D variational gradients
			"4g"		:8, # 4 D variational gradients
			fc			:9, # Forecast
			cf			:10,# Control forecast
			pf			:11,# Perturbed forecast
			ef			:12,# Errors in first guess, or
							# Estimate of forecast accuracy (ef)
			ea			:13,# Errors in analysis, or
							# Estimate of analysis accuracy (ea)
			cm			:14,# Cluster means
			cs			:15,# Cluster standard deviations
			fp			:16,# Forecast probabilities
			em			:17,# Ensemble means
			es			:18,# Ensemble standard deviations
			fa			:19,# Forecast accumulations
			cl			:20,# Climatology
			si			:21,# Climate simulation
			s3			:22,# Climate simulation, 360-day year
			ed			:23,# Empirical distribution
			tu			:24,# Tubes
			forcing		:25,# Forcing forecast
			ocean		:26,# Ocean forecast
			ob			:30,# Observations
			qc			:31,# Quality control
			diff_stat	:32,# Difference statistics
			im			:40,# Image data
			gm			:50,# Sensitivity gradients
			tf			:51,# Trajectory forecast
			sf			:52,# Sensitivity forecast
			pa			:60 # Perturbed analysis
		),

	mars_stream	:
		(
			indx		:40,
			oper		:1025,	# Daily archive
			enfo		:1035 	# Ensemble forecasts
		),

    #-------------------------------------------------------------------------------
	#  Local definitions
    #-------------------------------------------------------------------------------
	proba		:					# Forecast probability data 
		(
			rank		:	42,		# Forecast probability number.
			number		:	43,		# Total number of forecast probabilities
			power		:	44,		# Threshold units decimal scale factor.
									# + or - power of 10 (or zero)
			threshold	:	45,		# Threshold indicator:
									# 1 = Only lower threshold is present.
									# 2 = Only upper threshold is present.  
									# 3 = Both upper and lower thresholds are present
			lower		:	46,		# Lower threshold value
			upper		:	47 		# Upper threshold value
		)
)

end grib_codes


