# Copyright 2005-2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# 
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#

# LOCAL 98 16
# Seasonal forecast monthly mean data

constant GRIBEXSection1Problem = 80 - section1Length ;

# used in local definition 13
transient localFlag=1 : hidden;

template mars_labeling "grib1/mars_labeling.def";

unsigned[2] perturbationNumber : dump ;

unsigned[2] systemNumber : dump ;

unsigned[2] methodNumber : dump ;

unsigned[4] verifyingMonth : dump ;

meta endOfInterval g1end_of_interval_monthly(verifyingMonth);

meta yearOfEndOfOverallTimeInterval   vector(endOfInterval,0);
meta monthOfEndOfOverallTimeInterval   vector(endOfInterval,1);
meta dayOfEndOfOverallTimeInterval   vector(endOfInterval,2);
meta hourOfEndOfOverallTimeInterval   vector(endOfInterval,3);
meta minuteOfEndOfOverallTimeInterval   vector(endOfInterval,4);
meta secondOfEndOfOverallTimeInterval   vector(endOfInterval,5);

transient hourOfEndOfOverallTimeInterval=23;
transient minuteOfEndOfOverallTimeInterval=59;
transient secondOfEndOfOverallTimeInterval=59;

transient indicatorOfUnitForTimeRange=3;
transient lengthOfTimeRange=1;
unsigned[1] averagingPeriod : dump ;

transient typeOfStatisticalProcessing=0;
transient indicatorOfUnitForTimeIncrement = 1;
transient timeIncrement=averagingPeriod;

unsigned[2] forecastMonth : dump ;
remove forecastTime;
transient forecastTime=forecastMonth - 1;
#remove typeOfTimeIncrement;
transient typeOfTimeIncrement = 3;

# Old GRIBS do not have forecast forecastMonth set. It is computed from verifyingMonth
meta marsForecastMonth g1forecastmonth(verifyingMonth,dataDate,day,hour,forecastMonth) : read_only;

alias origin = centre;
alias number = perturbationNumber;
alias system = systemNumber;
alias method = methodNumber;

# ECC-679
unsigned[2] numberOfForecastsInEnsemble : dump ;
alias totalNumber=numberOfForecastsInEnsemble;

# spareSetToZero
pad padding_loc16_1(16);
