Skip to content

Commit

Permalink
ECC-1767: GRIB2: Add keys to properly compute wavelengths in section …
Browse files Browse the repository at this point in the history
…4 optical templates
  • Loading branch information
shahramn committed Feb 15, 2024
1 parent 6eef31e commit d7111f0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions definitions/grib2/template.4.optical.def
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ 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;

constant oneBillionth = 1.0 / 1000000000 : hidden;
meta firstWavelengthInNanometres divdouble(firstWavelength, oneBillionth);
meta secondWavelengthInNanometres divdouble(secondWavelength, oneBillionth);
6 changes: 6 additions & 0 deletions tests/grib2_wave_spectra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ grib_check_key_equals $temp scaleFactorOfLowerWavePeriodLimit,scaledValueOfLower
${tools_dir}/grib_set -s tablesVersion=$latest,productDefinitionTemplateNumber=104 $sample2 $temp
grib_check_key_equals $temp scaleFactorOfLowerWavePeriodLimit,scaledValueOfLowerWavePeriodLimit,perturbationNumber 'MISSING MISSING 0'

${tools_dir}/grib_set -s \
tablesVersion=$latest,productDefinitionTemplateNumber=108,scaleFactorOfFirstWavelength=9,scaledValueOfFirstWavelength=12 \
$sample2 $temp
grib_check_key_equals $temp firstWavelengthInNanometres '12'
grib_check_key_equals $temp firstWavelengthInMetres '1.2e-08'


# Clean up
rm -f $tempSample $temp

0 comments on commit d7111f0

Please sign in to comment.