# (C) Copyright 2005- ECMWF.

section_length[3] section1Length ;

unsigned[1] gribTablesVersionNo ;
codetable[1] centre 'common/c-1.table' : string_type;

alias ls.centre=centre;
alias identificationOfOriginatingGeneratingCentre=centre;

unsigned[1] generatingProcessIdentifier ;

unsigned[1] gridDefinition ;

flags[1] flag 'grib1/1.table';

codetable[1] indicatorOfParameter 'grib1/2.[centre:l].[gribTablesVersionNo:l].table';

codetable[1] indicatorOfTypeOfLevel 'grib1/3.table';
codetable[2] heightPressureEtcOfLevels 'grib1/3.table';
alias ls.levelType=indicatorOfTypeOfLevel;

unsigned[1] yearOfCentury ;
unsigned[1] month ;
unsigned[1] day;
unsigned[1] hour ;
unsigned[1] minute ;

transient second  = 0;
meta      dataDate    budgdate(yearOfCentury,month,day);
alias ls.date=dataDate;
meta      dataTime    time(hour,minute,second);
alias ls.time=dataTime;
meta julianDay julian_day(dataDate,hour,minute,second) : edition_specific;

# Indicator of unit of time range
codetable[1] indicatorOfUnitOfTimeRange 'grib1/4.table';

# P1 - Period of time (number of time units)
unsigned[1] periodOfTime ;
alias P1 =  periodOfTime ;

# P2 - Period of time
unsigned[1] periodOfTimeIntervals ;
alias P2 =  periodOfTimeIntervals ;

codetable[1] timeRangeIndicator 'grib1/5.table';

codetable[1] stepUnits 'grib2/tables/1/4.4.table' = 1 : transient,dump,no_copy;

concept stepType {
  "instant" = {timeRangeIndicator=1;}
  "instant" = {timeRangeIndicator=10;}
  "instant" = {timeRangeIndicator=0;}
  "avg"     = {timeRangeIndicator=3;}
  "accum"   = {timeRangeIndicator=4;}
  "max"     = {timeRangeIndicator=2;}
  "min"     = {timeRangeIndicator=2;}
  "diff"    = {timeRangeIndicator=5;}
  "rms"     = {timeRangeIndicator=2;}
  "sd"      = {timeRangeIndicator=2;}
  "cov"     = {timeRangeIndicator=2;}
  "ratio"   = {timeRangeIndicator=2;}
}

meta ls.stepRange g1step_range(P1,P2,timeRangeIndicator,indicatorOfUnitOfTimeRange,stepUnits,stepType) : dump;
meta startStep long_vector(stepRange,0) : dump;
meta endStep   long_vector(stepRange,1) : dump;

# Set stepUnits to 1 to get step range in hours
meta stepRangeInHours g1step_range(P1,P2,timeRangeIndicator,indicatorOfUnitOfTimeRange,one,stepType);
meta startStepInHours long_vector(stepRangeInHours,0) : dump;
meta endStepInHours   long_vector(stepRangeInHours,1) : dump;

constant paramId = 0;
alias parameter = paramId;
alias ls.parameter=parameter;

section_padding section1Padding : read_only;
