ATMS 391: Geophysical data analysis
Homework 2: Lists and if statements
Problem 1: using if statements to classify clouds
You have been hired by NASA to implement a cloud classification scheme based on their observed satellite characteristics. The International Cloud Climatology Project (Schiffer and Rossow 1983) classifies clouds using geostationary infrared data using the cloud top pressure and the cloud optical thickness, according to the following graphic:
Consider the following database of cloud observations:
Cloud pixel number | Cloud top pressure (hPa) | Cloud optical thickness (unitless) |
---|---|---|
1 | 917.3 | 47.1 |
2 | 282.9 | 0.6 |
3 | 316.5 | 72.7 |
4 | 242.6 | 8.4 |
5 | 362.9 | 32.5 |
6 | 264.0 | 52.1 |
7 | 276.3 | 178.2 |
8 | 75.4 | 203.0 |
9 | 858.4 | 161.2 |
10 | 566.3 | 2.4 |
Assume that the lines in the chart are the lower bound of each category, and do not include the values below that exact value.
(a) Classify each of the 10 cloud pixels into the 9 cloud types in the ISCCP classification. The classification must be done with a function (containing if-then-else statements). Print the observed data for each cloud and the classification in a table.
(b) Write a function to count each cloud type. Print a table of the names of each cloud type and number of clouds in that class.
(c) For each cloud type, print a table of the mean and standard deviation of each of the observed cloud top pressure and cloud optical thickness. Recreate the table you created in (b), and add column values to the table for this data. If no data exists, print 'none' in that entry.
Problem 2: using dictionaries
(a) Create a dictionary variable that holds an array of the data in the table above. Structure the dictionary such that there is a dictionary entry for each column in the table above. Print the dictionary.
(b) Add a new key to the dictionary adding the cloud type name from Problem 1. Print the new dictionary.
(c) Write a program similar to exercise 3 (under "Looping through all keys in a dictionary", where the user can enter a cloud type at a prompt and all of the values for that cloud are printed to the screen.