eccodes/definitions/grib2/template.4.localtime.def

82 lines
3.6 KiB
Modula-2

# (C) Copyright 2005- ECMWF.
remove is_localtime;
transient is_localtime=1;
# Method used to calculate the field value at the local time specified in section 1
codetable[1] localTimeMethod ('4.248.table',masterDir,localDir)=255 : dump;
# n - number of Forecasts used in Local Time
unsigned[1] numberOfForecastsUsedInLocalTime : dump;
localTimeForecastList list(numberOfForecastsUsedInLocalTime)
{
# Year of Forecast used in Local Time
unsigned[2] yearOfForecastUsedInLocalTime=0 : dump, edition_specific;
# Month of Forecast used in Local Time
unsigned[1] monthOfForecastUsedInLocalTime=0 : dump, edition_specific;
# Day of Forecast used in Local Time
unsigned[1] dayOfForecastUsedInLocalTime=0 : dump, edition_specific;
# Hour of Forecast used in Local Time
unsigned[1] hourOfForecastUsedInLocalTime=0 : dump, edition_specific;
# Minute of Forecast used in Local Time
unsigned[1] minuteOfForecastUsedInLocalTime=0 : dump, edition_specific;
# Second of Forecast used in Local Time
unsigned[1] secondOfForecastUsedInLocalTime=0 : dump, edition_specific;
# Indicator of unit of time for ForecastTime
codetable[1] indicatorOfUnitForForecastTime ('4.4.table',masterDir,localDir)=1 : dump;
# Length of the time range over which statistical processing is done, in units defined by the previous octet
unsigned[4] forecastTime=0 : dump;
# Number of time increments of Forecast used in Local Time
unsigned[1] numberOfTimeIncrementsOfForecastsUsedInLocalTime=1 : dump;
# Indicator of unit of time for the increment between the successive steps used
codetable[1] indicatorOfUnitForTimeIncrement ('4.4.table',masterDir,localDir)=255 : dump;
# Time increment between successive fields, in units defined by the previous octet
unsigned[4] timeIncrement=0 : dump;
}
alias ls.time=dataTime;
# See ECC-707
transient lsdate_bug = 1: hidden;
transient lstime_bug = 1: hidden;
if (numberOfForecastsUsedInLocalTime == 1) {
meta dateOfForecastUsedInLocalTime g2date(yearOfForecastUsedInLocalTime, monthOfForecastUsedInLocalTime, dayOfForecastUsedInLocalTime) : dump;
meta timeOfForecastUsedInLocalTime time(hourOfForecastUsedInLocalTime, minuteOfForecastUsedInLocalTime, secondOfForecastUsedInLocalTime) : dump;
#transient stepOfForecastUsedInLocalTime = forecastTime : dump;
# need something here to compute the diff between date time of *OfForecastUsedInLocalTime and the local time defined in section 1 (dataDate and dataTime)
# this would be the offset (step) used to index data in mars as mars.step
meta dateTimeOfForecastUsedInLocalTime julian_date(yearOfForecastUsedInLocalTime, monthOfForecastUsedInLocalTime, dayOfForecastUsedInLocalTime,
hourOfForecastUsedInLocalTime, minuteOfForecastUsedInLocalTime, secondOfForecastUsedInLocalTime) : hidden;
meta dateTimeOfLocalTime julian_date(dataDate, dataTime) : hidden;
meta jd1 julian_day(dateOfForecastUsedInLocalTime,
hourOfForecastUsedInLocalTime, minuteOfForecastUsedInLocalTime, secondOfForecastUsedInLocalTime);
meta jd2 julian_day(dataDate, hour,minute,second);
transient diffInDays = (jd2 - jd1) : hidden; # float
transient diffInHours = (diffInDays * 1440 + 0.5)/60 : hidden;
meta _endStep round(diffInHours, 10): dump, long_type;
transient endStep = _endStep; # needed to force it to be integer
#transient stepOfLocalTime = dateTimeOfLocalTime - dateTimeOfForecastUsedInLocalTime : dump;
alias mars.date = dateOfForecastUsedInLocalTime : dump;
alias mars.time = timeOfForecastUsedInLocalTime : dump;
alias mars.step = endStep;
}