mirror of https://github.com/ecmwf/eccodes.git
Python tests: metar output
This commit is contained in:
parent
2133aa19dd
commit
dc40707359
|
@ -28,6 +28,7 @@ def print_keys(msg_id):
|
|||
'elevation', 'temperature', 'dewPointTemperature', 'qnh']
|
||||
for key in keys:
|
||||
try:
|
||||
if codes_is_defined(msg_id, key):
|
||||
print(' %s: %s' % (key, codes_get(msg_id, key)))
|
||||
except CodesInternalError as err:
|
||||
print('Error with key="%s" : %s' % (key, err.msg))
|
||||
|
|
|
@ -16,14 +16,20 @@ label="metar_get_keys_test_p"
|
|||
|
||||
#Define tmp file
|
||||
fTmp=${label}.tmp.txt
|
||||
rm -f $fTmp | true
|
||||
rm -f $fTmp
|
||||
|
||||
REDIRECT=/dev/null
|
||||
|
||||
#Write the key values into a file
|
||||
# Write the key values into a file
|
||||
$PYTHON $examples_src/metar_get_keys.py 2> $REDIRECT > $fTmp
|
||||
|
||||
#TODO: check the results
|
||||
# Check the results
|
||||
grep -q "message: 157" $fTmp
|
||||
count=`grep -c latitude $fTmp`
|
||||
[ $count -eq 126 ]
|
||||
count=`grep -c dewPointTemperature $fTmp`
|
||||
[ $count -eq 133 ]
|
||||
|
||||
#Clean up
|
||||
rm -f $fTmp | true
|
||||
|
||||
# Clean up
|
||||
rm -f $fTmp
|
||||
|
|
Loading…
Reference in New Issue