Practice Problems

Lecture 14

Rename this notebook with your last name and the lecture

ex. CychB_15

Turn-in this notebook on TritonEd by the end of class

The file - Datasets/greenlandSurfaceDEM5km.txt- contains a digital elevation model of Greenland. We downloaded the dataset from the National Snow and Ice Data Center- http://nsidc.org/data/nsidc-0092#

In [3]:
from IPython.display import Image
Image(filename='Figures/Topographic_map_of_Greenland_bedrock.jpg')
# Image from https://en.wikipedia.org/wiki/Geography_of_Greenland
Out[3]:

1. Histograms and CDFs

  • Take a look at the first few lines of the dataset
  • Import the data into a numpy array
  • Determine the shape of the original dataset
  • Flatten the dataset
  • Determine the shape of the flattened dataset
  • Plot a histogram of the data- normalize the data and include 8 bins
  • Add a label to the x-axis, add a label to the y-axis, add a title
  • Sort the dataset from smallest to largest
  • Create an array of percentages
  • Plot a cumulative distribution function of the dataset (percent vs. elevation)
  • Add a label to the the y-axis, add a label to the x-axis, add a title

2. Numpy.random

  • Using numpy.random, generate an array with a single random integer between 0 and 100
  • Generate an array of 30 random integers between 0 and 100
  • Plot a normalized histogram of the random integers