# (C) Copyright 2005- ECMWF.

codetable[1] typeOfWavelengthInterval ('4.91.table',masterDir,localDir) : dump;
alias typeOfIntervalForFirstAndSecondWavelength=typeOfWavelengthInterval;

# Wavelengths in metres
signed[1] scaleFactorOfFirstWavelength : dump;
signed[4] scaledValueOfFirstWavelength : dump;
signed[1] scaleFactorOfSecondWavelength = missing(): can_be_missing,dump;
signed[4] scaledValueOfSecondWavelength = missing(): can_be_missing,dump;

meta firstWavelength  from_scale_factor_scaled_value(scaleFactorOfFirstWavelength, scaledValueOfFirstWavelength);
meta secondWavelength from_scale_factor_scaled_value(scaleFactorOfSecondWavelength, scaledValueOfSecondWavelength);
alias firstWavelengthInMetres = firstWavelength;
alias secondWavelengthInMetres = secondWavelength;

# See ECC-2230
if (scaleFactorOfFirstWavelength == 9) {
    alias firstWavelengthInNanometres = scaledValueOfFirstWavelength;
    alias secondWavelengthInNanometres = scaledValueOfSecondWavelength;
} else {
    constant billion = 1000000000 : hidden;
    meta firstWavelengthInNanometres  multdouble(firstWavelength, billion) : read_only;
    meta secondWavelengthInNanometres multdouble(secondWavelength, billion) : read_only;
}

# MARS include
# mars.wavelength is aliased for MTG2Switch > 0
# this was done originally here, but the MTG2SwitchConcept uses the generatingProcessIdentifier
# to implement an exception for 50r1
# as template.4.optical.def is evaluated before template.4.generating_process.def
# the aliasing has to happen later, this is why in the optical templates the following is included:
#
# include "mars/mars.wavelength.def"
