1. Make a directory called ~/h597/3. Set protection so only you can read and write in this directory.
2. For this assignment, we will further process the daily hydrogen peroxide (H2O2) concentrations we used in Assignment #2. We will calculate hourly averages for all measurements using the Shell and AWK programming languages. Name your script: "hour_avg".
Go to: http://www.hwr.arizona.edu/~Polar/UA/2000/h2o2_air/ua_h2o2_concen_00 and save this file to your ~/h597/3 directory.
3. Your script should first check that you have the correct number of command-line arguments, in this case: one. The only argument should be the data file name, in this case "ua_h2o2_concen_00". Your script should complain and exit if the user does not specify a filename at the command line.
4. Your script should then check that this file does indeed exist and should complain and exit if is does not.
5. Your script should then prompt the user for an output filename and read that in.
6. Your script should then invoke AWK to calculate the hourly average for the input file. You should output a header line describing the columns. Here is a sample of the output needed:
Day_of_year H2O2 [ppbv] Number of data points 159.500000 0.580000 1 159.541667 0.580000 1 159.583333 0.715000 2 159.625000 0.700000 1Notice how the output is formatted, the columns line up nicely. This is done with the AWK printf() command.
Again, there is a sample program you can run: "try_hour_avg" First, make sure the directory which contains your datafile has permissions 775, e.g. chmod 775 ~/h597/hw3. Also make sure that ~h597/bin is in your PATH. Notice that the first column of the output is the decimal day, that is: 159.5 means day 159 at 12:00 noon. The fractional day should increase in increments of 0.04167 (which is 1/24). Only average values that occur within each hour. If there are no values for a particular hour, then report nothing. It may be helpful to store the decimal day and H2O2 values into separate arrays and then processe those arrays in the END statement. 7. Your script should be well-commented and robust. Make sure you test it out with bad data. I will test it when I grade it.
8. turnin hw3 hour_avg