Write a function extractData in your shell script wparser.bash. This function will perform the core processing logic associated with each file. The main script will just iteratively call this function with different files as its argument. This function should accept a data file as its argument. This function should then produce an output of the following format that that contains only the temperature and wind information from the sensors along with a header. (see image; truncated for brevity). A clean format of data like this form can be used by various information processing systems.   The script is basically only including the year, month, day and hour information, followed by the temperature reported by each temperature sensor, and wind speed from wind sensors at that time. If a temperature sensor’s reading is NOINF or MISSED SYNC STEP in the original data file for that particular time, the script must instead output the previous readout for that temperature sensor. For simplicity, you can assume that the first readout for all the temperature sensors in a given day does not have any issues. The output should follow the same order of time as in the original data file. The script also translates the wind speed direction codes (which runs from 0 through 7) to appropriate mnemonics, i.e. (N,NE,E,SE,S,SW,W,NW) respectively.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a function extractData in your shell script wparser.bash. This function will perform the core processing logic associated with each file. The main script will just iteratively call this function with different files as its argument.

This function should accept a data file as its argument. This function should then produce an output of the following format that that contains only the temperature and wind information from the sensors along with a header. (see image; truncated for brevity). A clean format of data like this form can be used by various information processing systems.

 

The script is basically only including the year, month, day and hour information, followed by the temperature reported by each temperature sensor, and wind speed from wind sensors at that time. If a temperature sensor’s reading is NOINF or MISSED SYNC STEP in the original data file for that particular time, the script must instead output the previous readout for that temperature sensor.

For simplicity, you can assume that the first readout for all the temperature sensors in a given day does not have any issues. The output should follow the same order of time as in the original data file.
The script also translates the wind speed direction codes (which runs from 0 through 7) to appropriate mnemonics, i.e. (N,NE,E,SE,S,SW,W,NW) respectively.

Immediately following the previous output produced from a data file, the script (aka inside the function to be specific) should produce the statistics as to what was the maximum as well as the minimum temperature and wind speed that was reported for a given hour. The format is given below. For this report, it is important to ignore the temperature sensors that it was not able to read data for that hour and consider only the sensors that were functioning and produced a valid reading in that hour.

Processing Data From <path to the filename here>
=====
Year, Month,Day,Hour, TempS1,TempS2,TempS3,TempS4,TempS5,WindS1, WindS2, WindS3, WinDir
2022,01,24,00,-0.70,-1.38,-2.15,-2.67,-2.73,1,0,4,NW
..
2022,01,24,04,-3.70,-2.88,-3.65,-8.18,-5.72,8,6,7,NW
2022,01,24,05,-5.20,-2.88,-5.15,-8. 18,-5.72,13,5,10,S
2022,01,24,06,-5.20,-2.38,-4.65,-7. 18,-4.22,17,4,11, SE
2022,01,24,07,-3.70,-2.38,-4.65,-6.68,-3.72,14,6,6, SE
2022,01,24,21,1.80,5.12,2.85,-1.68,3.28,4,4,5,SE
2022,01,24,22,0.80,5.12,1.35,-1.68,3.28,3,0,6,SE
2022,01,24,23,0.80,4.62,-0.15,-1.68,3.28,5,0,7,N
Transcribed Image Text:Processing Data From <path to the filename here> ===== Year, Month,Day,Hour, TempS1,TempS2,TempS3,TempS4,TempS5,WindS1, WindS2, WindS3, WinDir 2022,01,24,00,-0.70,-1.38,-2.15,-2.67,-2.73,1,0,4,NW .. 2022,01,24,04,-3.70,-2.88,-3.65,-8.18,-5.72,8,6,7,NW 2022,01,24,05,-5.20,-2.88,-5.15,-8. 18,-5.72,13,5,10,S 2022,01,24,06,-5.20,-2.38,-4.65,-7. 18,-4.22,17,4,11, SE 2022,01,24,07,-3.70,-2.38,-4.65,-6.68,-3.72,14,6,6, SE 2022,01,24,21,1.80,5.12,2.85,-1.68,3.28,4,4,5,SE 2022,01,24,22,0.80,5.12,1.35,-1.68,3.28,3,0,6,SE 2022,01,24,23,0.80,4.62,-0.15,-1.68,3.28,5,0,7,N
Observation Summary
Year,Month,Day,Hour, MaxTemp,MinTemp,MaxWS,MinWS
2022,01,24,00,-0.70,-2.73,4,0
..
2022,01,24,06,-2.38,-7.18,17,4
2022,01,24,07,-2.38,-6.68,14,6
2022,01,24,08,-2.38,-5. 18,12,2
2022,01,24,09,-1.38,-3.68,13,0
2022,01,24,23,4.62,-0.15,7,0
Transcribed Image Text:Observation Summary Year,Month,Day,Hour, MaxTemp,MinTemp,MaxWS,MinWS 2022,01,24,00,-0.70,-2.73,4,0 .. 2022,01,24,06,-2.38,-7.18,17,4 2022,01,24,07,-2.38,-6.68,14,6 2022,01,24,08,-2.38,-5. 18,12,2 2022,01,24,09,-1.38,-3.68,13,0 2022,01,24,23,4.62,-0.15,7,0
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education