Your Perfect Assignment is Just a Click Away

We Write Custom Academic Papers

100% Original, Plagiarism Free, Customized to your instructions!

glass
pen
clip
papers
heaphones

METARBASH script, computer science homework help

METARBASH script, computer science homework help

this is a BASHMETAR script and there is a mistake in the cloud section, i want the mistake fixed.

the full assignment:

create a series of regular expressions that identify different parts composing a METAR.

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.

You can find METAR reports at the following address:

http://weather.noaa.gov/weather/metar.shtml.

In order to find the weather information you need to get a METAR report from any airport you wish utilizing the appropriate code and then apply the different regular expressions to identify each token and eventually extract it from the report.

submission should be a script that reads a single line METAR from a file named: metar.txt

Your script output (to the shell screen) should include:

1. the report type: either METAR or SPECI for “Special Report”

2. the station identifies (four characters starting with a K)

3. Day of the month and time the report was filed

4. If the token ‘AUTO’ is present, you should output “This is a fully automated report”

5. If the token ‘COR’ is present, you should output “This is a corrected observation”

6. Wind direction and speed, wind gusting, and variable wind directions

7. Visibility in statute miles

8. Light, medium, or heavy rain (-RA|RA|+RA)

9. Cloud Conditions: [0 or more occurrences of each of the following]

a. Sky Clear

b. Few Clouds <altitude>

c. Scattered Clouds <altitude>

d. Broken Clouds <altitude>

e. Overcast Clouds <altitude>

10. Temperature

11. Dew Point

12. Barometric Pressure

13. If the token ‘TH’ is present, you should output “Thunderstorms reported in the area”um temperature for past 6 hours reported to nearest tenth of degree Celsius; reported on 00, 06, 12, 18 UTC reports; sn = 1 if temperature below 0oC and 0 if temperature 0oC or higher.

the script that needs to be fixed:

#!/bin/bash

token1=”AUTO”

token2=”COR”

METARFILE=”metar.txt”

VSM=$(egrep -o ‘s[[:digit:]]*SM’ $METARFILE | tr -d SM)

RAIN=$(egrep -o ‘?WRA’ $METARFILE | tr -d [:blank:])

CLOUD_SKC=$((`egrep –o ‘SKC[[:digit:]]*?’ $METARFILE | cut -c4-6`*100))

CLOUD_FEW=$((`egrep –o ‘FEW[[:digit:]]*?’ $METARFILE | cut -c4-6`*100))

CLOUD_SCT=$((`egrep –o ‘SCT[[:digit:]]*?’ $METARFILE | cut -c4-6`*100))

CLOUD_BKN=$((`egrep –o ‘BKN[[:digit:]]*?’ $METARFILE | cut -c4-6`*100))

CLOUD_OVC=$((`egrep –o ‘OVC[[:digit:]]*?’ $METARFILE | cut -c4-6`*100))

TD_TEMP=$(egrep -o ‘[[:digit:]]{2}//?M[[:digit:]]{2}’ $METARFILE | cut -c1-2)

TD_DEW=$(egrep -o ‘[[:digit:]]{2}//?M[[:digit:]]{2}’ $METARFILE | tr -d M | cut -c4 5)

TH=$(egrep -o ‘sTHs’ $METARFILE | tr -d [:blank:] )

printf “Report type:tt”

egrep -o ‘METAR|SPECI’ $METARFILE

printf “Location:tt”

egrep -o ‘sK[A-Z]{3}s’ $METARFILE

DTGROUP=$(egrep -o ‘[[:digit:]]*Z’ $METARFILE)

day_of_month=$(echo $DTGROUP | cut -c1-2)

report_time_hour=$(echo $DTGROUP | cut -c3-4)

report_time_min=$(echo $DTGROUP | cut -c5-6)

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

printf “Time:ttt%d:%dn” $report_time_hour $report_time_min

wind=$(egrep -o ‘[[:digit:]]*?G[[:digit:]]*KT’ $METARFILE)

wind_dir=$(echo $wind | cut -c1-3)

wind_spd=$(echo $wind | cut -c4-5)

wind_var=$(egrep -o ‘s[[:digit:]]V[[:digit:]]s’ $METARFILE)

wind_var1=$(echo $wind_var | cut -c1-3)

wind_var2=$(echo $wind_var | cut -c5-7)

printf “Wind direction:tt%d, Speed: %dn” $wind_dir $wind_spd

if [ “x$wind_var” != “x” ] ; then

printf “Wind direction is variable between %d and %dn” $wind_var1

$wind_var2

fi

printf “Visibility:tt%d Status Milesn” $VSM

if [ “$RAIN” == “+RA” ] ; then

printf “Heavy Rainn”

elif [ “$RAIN” == “RA” ] ; then

printf “Medium Rainn”

elif [ “$RAIN” == “-RA” ] ; then

printf “Light Rainn”

else

printf “n”

fi

printf “Cloud Conditions:ttn”

[ $CLOUD_SKC ] && printf “Clouds: ttSky clear, at %d feet above sea leveln”

$CLOUD_SKC

[ $CLOUD_FEW ] && printf $CLOUD_FEW

[ $CLOUD_SCT ] && printf

$CLOUD_SCT

[ $CLOUD_BKN ] && printf

leveln” $CLOUD_BKN

[ $CLOUD_OVC ] && printf

leveln” $CLOUD_BKN

“Clouds: ttA few, at %d feet above sea leveln”

“Clouds: ttScattered, at %d feet above sea leveln”

“Clouds: ttBroken clouds, at %d feet above sea

“Clouds: ttOvercast clouds, at %d feet above sea

printf “Temperature:tt%s degrees Celsiusn” $TD_TEMP

printf “Dew point:tt%s degrees Celsiusn” $TD_DEW

if [ “$TH” ] ; then

printf “Thunderstorms reported in the arean”

fi

if [ $(egrep -o “$token1>” $METARFILE) ] ; then

printf “This is a fully automated reportn”

fi

if [ $(egrep -o “$token2>” $METARFILE) ] ; then

printf “This is a corrected observationn”

fi

Order Solution Now

Our Service Charter

1. Professional & Expert Writers: Writers Hero only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Writers Hero are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Writers Hero is known for timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Writers Hero, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.