(5/5)

# In this project, you will demonstrate your understanding of structures and arrays of structures and will develop a computational solution for a non-trivial problem.

INSTRUCTIONS TO CANDIDATES

Learning Outcomes

In this project, you will demonstrate your understanding of structures and arrays of structures and will develop a computational solution for a non-trivial problem. You are expected to make extensive use of functions, and to demonstrate that you have adopted a clear and elegant programming style. You will find it difficult to create a working solution unless you plan your program carefully in advance, and develop it incrementally.

The Mission

You will again be working with numeric data, this time in connection with rainfall records. All of the data files used in this project have been sourced directly from the Bureau of Meteorology web site at http://www.bom.gov.au/climate/data/, and remain in the format in which they were downloaded. The program that you write will identify historical trends that may exist in the input data, and allow visualization of the data.

Stage 1 – Reading the Data (Marks up to 9/20)

In this stage you should read all of the data into internal structures suitable for use in the later stages, and create an output representation that provides an overview of the data that was read. Input will come from a comma-separated-values file, with each input line (after the first header line) looking like:

IDCJAC0001,086039,2000,01,28.2,Y IDCJAC0001,086039,2000,02,34.5,Y IDCJAC0001,086039,2000,03,22.5,Y IDCJAC0001,086039,2000,05,96.3,Y IDCJAC0001,086039,2000,06,42.4,Y IDCJAC0001,086039,2000,07,45.1,Y

recording, for example, that the rainfall measured at site 086039 (Flemington Racecourse, in Melbourne) in January 2000 was 28.2 millimeters. The last value in each line is Y or N to indicate whether the data has been “validated”. To read one line, you should use the format control string

"IDCJAC0001, d, d, d, lf, c"

with suitable receiving variables, and then skip any remaining characters on that line until a newline character has been consumed. Note that IDCJAC0001 is a fixed string that identifies the type of data, and will appear in all data files that your program will process.

You may assume that the lines in the input are always in ascending-year then ascending-month order, but also need to be aware that there may be missing data lines. For example, there is no data for April 2000 in the test file shown above. Missing values are completely typical of sensor-based data, and occur because of equipment malfunction, network errors, and so on.

A sample of the required output of this stage is:

mac: ass2-soln < rainfall-086039-2000-2009.csv S1, site number 086039, 115 datalines in input

S1, 2000:  Jan      Feb    Mar    ...    May   Jun     Jul     Aug    Sep    Oct     Nov    Dec S1, 2001:  Jan                        Feb    Mar    ...    May   Jun     Jul     Aug    Sep*  Oct     Nov* Dec

S1,  2009:  Jan      Feb* Mar    Apr    May   Jun*  Jul     Aug    Sep    Oct     Nov    Dec

where rainfall-086039-2000-2009.csv is one of the test files linked from the FAQ page; where * indicates a value that has not been validated; and where ... indicates a completely missing value. Full output examples are linked from the FAQ page. Note that the input might start part way through one year and end part way through another, so be sure that you handle the first and last year correctly. There might also be whole missing years, in which case your program should report every month for that year as a ... entry.

You should be able to get started on the required program for this stage quite quickly, based on your solution to the first project (or the sample solution to the first project). And an explicit permission – you may include this declaration as a global array if you wish to (and if you can see how it would be useful):

char *months[] = {"", "Jan", "Feb", "Mar", "Apr", "May", "Jun",

"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};

Stage 2 – The Annual Rainfall Cycle (Marks up to 12/20)

Add further functionality to your program so that for each month of the year the average rainfall is computed and reported. All months for which at least one data item is available should be listed, and unverified items should also be counted and included in the average. A sample of output lines for the same test file is:

S2, Jan, 10 values, 2000-2009, mean of 23.5mm S2, Feb, 10 values, 2000-2009, mean of 45.5mm S2, Mar,   9 values, 2000-2009, mean of   33.8mm

S2, Dec, 10  values, 2000-2009, mean  of  48.6mm

Full examples are linked from the FAQ page, including showing what should be written if there are no rainfall records in one or more of the months. Note that the monthly averages are required again in Stage 4, so they should be computed in this stage and then retained, rather than being computed again later.

Stage 3 – Climate Change? (Marks up to 16/20) now for some trend analysis. Suppose that a sequence of n values r0 . . . rn1 is given (in this case, ri is the rainfall amount for some specific month across a sequence of years), and we wish to know if there is an overall upward or downward trend over the n values. One simple correlation coefficient that can be used is Kendall’s τ (pronounced “tau”), which for data already ordered on one aspect (in our case, ordered by time) is computed as:

where δ(ri, rj) is +1 if ri < rj; is 1 if ri > rj; and is 0 if ri = rj. A τ value of +1.0 indicates perfect monotonic increase across the sequence of values; a τ value of 1.0 indicates perfect monotonic decrease across the sequence of values; and a τ value of 0.0 indicates neither consistent growth nor consistent decrease.

(5/5)

## Related Questions

##### . Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

##### . The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

##### . Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

##### . SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

##### . Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Hire Me

Hire Me