Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The assignment requires reading data that are in a very structured format but which can not be directly read using regular functions such as read.
The assignment requires reading data that are in a very structured format but which can not be directly read using regular functions such as read. cav (), read. table (), etc. It also requires writing a function to read each file as there are 504 files. You also need to combine the data from the 504 files into a single data.frame, first verifying that the values from the files correspond to the same dates and locations. There are 504 txt files in NASAWeather.zip with 72 files for each of seven (7) variables being measured. These variables are . cloudhigh, cloudlow, cloudmid, ozone. pressure, surftemp, temperature. For a given variable, each of the 72 files corresponds to a different date - month and year. Each file has a "header" containing meta-information, e.g.; VARIABLE : Mean high cloud amount (*) FILENAME : ISCCPMonthly_avg . nc FILEPATH : /usr/local/fer_data/data/ SUBSET : 24 by 24 points (LONGITUDE-LATITUDE) TIME : 16-JAN-1995 00:00 The values for the variable for that date are arranged in a rectangular table based on latitude (rows) and longitude (columns). The location details are provided in additional information - two rows for longitude and two columns for the latitude, as in the following example: 113.8W 111.2W 108.8W 106.2W 103.8W 101.2W 98.8W 96.2W 93.8W 91.2W 88.8W 86.2W 83.8W 27 28 29 30 31 32 33 34 35 36 37 38 39 36. 2N / 51: 26.00 23.00 23.00 17.00 19.50 17.00 16.00 16.00 16.00 19.00 18.00 19.00 19.50 For each file, create a data.frame that contains . one column for the values, a column for each of the latitude and longitude - as numbers, i.e. with the North, South, East and West converted. the date (which will be the same for each observation with the data.frame.) Having read each file, you need to verify that the latitude and longitude values correspond across files and also match the dates of the files. Your overall task is to create a single data.frame with columns for date . latitude and longitude each of the 7 variables Of course, the values for the 7 variables in each row must correspond to the same date and latitude and longitude.VARIABLE : Mean high cloud amount (%) FILENAME : ISCCPMonthly_avg . nc FILEPATH : /usr/local/fer_data/data/ SUBSET : 24 by 24 points ( LONGITUDE-LATITUDE) TIME : 16-FEB-1995 00:00 113. 8W 111. 2W 108.8W 106. 2W 103.8W 101. 2W 98.8W 96.2W 93.8W 91.2W 88.8W 86.2W 83.8W 81. 2W 78.8W 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 36. 2N / 51: 9.50 9.50 9.50 10.50 9.00 9.50 9.00 9.00 9.50 12.00 14.50 18.50 21.00 21.00 22.50 33. 8N / 50: 9.50 9.50 10.50 11.50 10.50 10.00 11.00 11.00 14.50 17.50 18.50 20.50 21.00 21.00 19.50 31. 2N / 49: 11.00 11.00 12.00 13.50 15.00 16.00 17.50 20.00 20.00 18.50 18.00 17.00 15.50 12.50 12.00 28.8N / 48: 12.00 16.00 16.00 20.00 25.00 25.00 23.50 18.50 14.50 13.50 13.50 12.00 10.00 9.00 9.50 26. 2N / 47: 15.50 19.50 24.50 24.50 31.50 30.00 24.00 14.50 8.50 7.00 5.50 6.00 6.00 5.50 5.50 23.8N / 46: 17.00 21.50 24.50 28.00 28.00 27.50 16.50 8.50 4.00 3.00 2.00 1.50 2.00 2.50 2.50 21. 2N / 45: 15.50 17.00 18.00 14.00 13.00 8.00 4.00 1.50 1.00 0.50 0.50 1.00 0.50 1.00 1.00 18.8N / 44: 12.50 12.50 10.50 6.00 3.50 4.50 4.00 2.50 1.00 1.50 1.00 0.50 0.50 0.00 0.00 16. 2N / 43: 12.00 9.00 5.00 2.50 3.50 3.00 3.00 1.00 1.00 1.00 1.00 1.00 0.50 0.00 0.00 13.8N / 42: 12.50 10.50 7.50 7.50 5.00 5.00 2.50 1.00 0.50 1.00 1.00 0.50 0.00 0.00 0.00 11. 2N / 41: 10.50 7.00 7.50 4.50 3.50 5.00 3.00 1.50 1.50 1.00 1.00 1.00 0.00 0.00 1.00 8.8N / 40: 7.50 6.00 3.50 1.00 3.50 5.00 4.00 4.00 4.00 3.00 3.00 3.50 2.50 1.00 1.00 6. 2N / 39: 9.50 9.00 6.50 5.00 4.50 5.50 7.50 7.00 8.00 8.50 6.50 6.00 3.00 1.00 3.50 3.8N / 38: 7.00 8.50 7.00 9.00 7.00 5.00 7.00 7.00 9.00 10.50 7.00 4.50 3.50 3.00 7.50 1. 2N / 37: 1.00 1.50 2.50 2.00 1.50 2.00 2.50 3.00 4.00 2.50 1.50 1.50 3.50 9.00 12.50 1.25 / 36: 0.00 0.50 1.00 1.50 1.50 1.00 1.50 1.50 1.50 1.50 2.00 2.00 2.00 10.50 20.50 3.85 / 35: 1.50 2.00 1.50 0.50 0.50 1.00 1.50 3.00 3.00 3.00 3.50 1.50 1.50 10.00 30.50 6.25 / 34: 0.50 1.50 1.50 0.50 0.00 1.50 3.00 3.50 4.00 3.00 2.00 1.00 1.00 4.50 26.50 8.85 / 33: 1.50 1.00 1.00 0. 50 2.50 5.00 5.50 3.00 3.00 1.50 1.50 0.50 0.50 2.50 11.00 11. 25 / 32: 1.00 1.50 1.00 1.50 4.00 6.00 7.50 4.00 2.00 1.50 1.00 0.50 1.00 4.00 18.00 13.85 / 31: 1.00 2.00 2.00 2.00 4.00 6.50 8.00 5.00 2.50 2.00 1.50 0.50 0.50 1.00 1.50 16. 25 / 30: 0.50 2.00 2.50 1.00 5.00 6.50 7.50 4.50 2.50 2.00 2.00 2.50 1.00 0.50 0.50 18.85 / 29: 0.50 0.50 1.50 1.50 0.50 2.50 5.00 4.50 3.00 2.00 2.00 2.00 1.50 0.50 0.00 21. 25 / 28: 1.00 0.50 1.00 0.50 0.50 1.50 2.50 2.00 2.00 1.50 1.50 1.50 1.50 1.00 0.50For each file, create a data.frame that contains one column for the values, a column for each of the latitude and longitude - as numbers, i.e. with the North, South, East and West converted. . the date (which will be the same for each observation with the data.frame.) Having read each file, you need to verify that the latitude and longitude values correspond across files and also match the dates of the files. Your overall task is to create a single data. frame with columns for . date . latitude and longitude . each of the 7 variables Of course, the values for the 7 variables in each row must correspond to the same date and latitude and longitude
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started