Homework 10, More Data Processing (16 points)


This is a variation on your last homework

The program pttest.f is designed to read in arrays of temperature and pressure data, and output the average, minimum and maximum values for temperature and for pressure. It needs a little work before it will function. Add the following programming:

  1. In the subroutine input add a prompt for the name of the file containing data: "File containing Temperature and Pressure data:". Arrange this prompt so that the user's answer is on the same line. Next check that a file with that name exists. If it does exist print "filename being processed", where filename is the actual filename provided by the user. Include only one space between the filename and the word "being". If the file does not exist, print: "filename not found" and stop the program. Again filename is the actual filename provided by the user. Your output should have only one space between the filename and the word "not".
  2. In subroutine "input", add a line or two to allocate the space for the temperature and pressure arrays
  3. Add the necessary subroutine named "stats" to obtain average, minimum and maximum values. This time use the intrinsic functions SUM, COUNT, MINVAL, and MAXVAL to do most of this work, and include the optional "MASK=" arguments to exclude from your calculation any data values less than or equal to zero.
Test this program with the old data file props.data and check against your last set of results. Next test against the file pt.data. If your MASK arguments are working properly, the answers will be the same.

This homework will be graded as follows:

Bonus: If you had problems with Homework 4, or didn't turn it in you can ask your TA to grade your use of SUM, MINVAL, and MAXVAL on a 0-4 point scale to replace the old Homework 4 grade.

Leave your modified version of pttest.f (don't change the file name) in your "homework" subdirectory. We will pick it up after the due date and test it.

Homework List / Home


Maintained by John Mahaffy : jhm@psu.edu