METARs are reports assembled with a particular format that is easy to decode with computer systems using regular expressions

METARs are reports assembled with a particular format that is easy to decode with computer systems using regular expressions.

These reports typically come in two forms: North American METARs and International METARs.  Create a series of regular expressions that decode each token of information using the North American METAR form.

Please see files and 

Example.

#!/bin/bash

printf “Report type:  “

egrep -o ‘METAR|SPECI’ metar.txt

printf “Station:  “

egrep -o ‘sK[A-Z]{3}s’ metar.txt

day_of_month=$(( $(cat metar.txt | cut -c12-13) ))

metar_time=$(( $(cat metar.txt | cut -c14-17) ))

printf “Day of the month:  %dn” $day_of_month

printf “Time:  %d Zulun” $metar_time

wind_dir=$(( $(egrep -o ‘s[0-9]{5}G?[0-9]?[0-9]?KTs’ metar.txt | cut -c2-4) ))

wind_spd=$(( $(egrep -o ‘s[0-9]{5}G?[0-9]?[0-9]?KTs’ metar.txt | cut -c5-6) ))

printf “Winds are from %d degrees at %d knotsn” $wind_dir $wind_spd

METAR|SPECI  K[ALPHA]{3}  [DIGIT]{6}Z  AUTO|COR 

_____ FIXED ___________________________  Optional

# wind conditions

[DIGIT]{5}G[DIGIT]{2}KT [DIGIT]{3}V[DIGIT]{3} | VRB[DIGIT]

– req — — opt — rq ——— opt ——-

### processing ###

1) read string, but if using math expansion, cut only digits

2) egrep (extended grep) with -o option returns only matched string (watch spaces with cut)

3) Add if/else logic to print correct message or no message if missing, or with optional branches

4) Add “Cloud cover” all categories

5) Add check and report for Thunder Storms and or rain (light/moderate/heavy)

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.