Thursday, September 24, 2015

Reading Water Quality Data from MWRD (II)

This time I tried to summarize open data available for each month in 2014, not just January.

Data Source:  Metropolitan Water Reclamation District of Chicago http://www.mwrd.org/    > Reports   >   M&R Data and Reports   >   Water Quality Data   >   2014 Waterway Ambient Water Quality   >  Waterways_2014.xlsx

Data Transformation:  I moved data on each month in 2014 into a single table (see SQL).

Data Analysis:  I uploaded the csv table into R for summary statistics (see R)

Mean Temperature Measurement for Each Month in 2014
> January_TEMP_AVE = mean(January_TEMP, na.rm=TRUE)
February_TEMP_AVE = mean(February_TEMP, na.rm=TRUE)
March_TEMP_AVE = mean(March_TEMP, na.rm=TRUE)
April_TEMP_AVE = mean(April_TEMP, na.rm=TRUE)
May_TEMP_AVE = mean(May_TEMP, na.rm=TRUE)
June_TEMP_AVE = mean(June_TEMP, na.rm=TRUE)
July_TEMP_AVE = mean(July_TEMP, na.rm=TRUE)
August_TEMP_AVE = mean(August_TEMP, na.rm=TRUE)
September_TEMP_AVE = mean(September_TEMP, na.rm=TRUE)
October_TEMP_AVE = mean(October_TEMP, na.rm=TRUE)
November_TEMP_AVE = mean(November_TEMP, na.rm=TRUE)
December_TEMP_AVE = mean(December_TEMP, na.rm=TRUE)

> TEMP_Averages_2014 <- data.frame(January_TEMP_AVE, February_TEMP_AVE, March_TEMP_AVE, April_TEMP_AVE, May_TEMP_AVE, June_TEMP_AVE, July_TEMP_AVE, August_TEMP_AVE, September_TEMP_AVE, October_TEMP_AVE, November_TEMP_AVE, December_TEMP_AVE)


> print(TEMP_Averages_2014)

January_TEMP_AVE February_TEMP_AVE March_TEMP_AVE April_TEMP_AVE May_TEMP_AVE
1         4.391667          5.018182       5.252174       11.85313         16.6
  June_TEMP_AVE July_TEMP_AVE August_TEMP_AVE September_TEMP_AVE October_TEMP_AVE
1      22.48387      23.64375        24.40667           20.36429         15.01379
  November_TEMP_AVE December_TEMP_AVE
1          9.222222          6.038462



Data Summary:  I started summarizing the results by entering them into Java arrays (see Java).

Arrays for Average of Temperature Measurements in 2014
// Two, single column arrays
float pH2014 [] = new float [12];
pH2014[0] = (float) 6.8375;
pH2014[1] = (float) 7.15;
pH2014[2] = (float) 6.83913;
pH2014[3] = (float) 7.600937;
pH2014[4] = (float) 7.626563;
pH2014[5] = (float) 7.39871;
pH2014[6] = (float) 7.509688;
pH2014[7] = (float) 7.450667;
pH2014[8] = (float) 7.451786;
pH2014[9] = (float) 7.448621;
pH2014[10] = (float) 7.602593;
pH2014[11] = (float) 7.561923;
String[] months2014 = new String [12];
months2014[0] = "January";
months2014[1] = "February";
months2014[2] = "March";
months2014[3] = "April";
months2014[4] = "May";
months2014[5] = "June";
months2014[6] = "July";
months2014[7] = "August";
months2014[8] = "September";
months2014[9] = "October";
months2014[10] = "November";
months2014[11] = "December";

//Printing each data row
System.out.println("2014 Month | Average Measured pH");
System.out.println(months2014[0] + "    |    " + pH2014[0]);
System.out.println(months2014[1] + "    |    " + pH2014[1]);
System.out.println(months2014[2] + "    |    " + pH2014[2]);
System.out.println(months2014[3] + "    |    " + pH2014[3]);
System.out.println(months2014[4] + "    |    " + pH2014[4]);
System.out.println(months2014[5] + "    |    " + pH2014[5]);
System.out.println(months2014[6] + "    |    " + pH2014[6]);
System.out.println(months2014[7] + "    |    " + pH2014[7]);
System.out.println(months2014[8] + "    |    " + pH2014[8]);
System.out.println(months2014[9] + "    |    " + pH2014[9]);
System.out.println(months2014[10] + "    |    " + pH2014[10]);
System.out.println(months2014[11] + "    |    " + pH2014[11]);
System.out.println(months2014[12] + "    |    " + pH2014[12]);

No comments:

Post a Comment