{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework Problem \\#2 - Arctic Ice" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Hand-in format:** IPython Notebook or python program. Submit via email.\n", "\n", "As a reminder: please make sure your code is clean, documentated, and understandable. Make sure it runs without errors." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Background\n", "\n", "The purpose of this problem is to become familiar with loading, manipulating, and analyzing image-like data, plotting it. We will use a dataset collected by the AMSR-E instrument [Aqua](http://en.wikipedia.org/wiki/Aqua_%28satellite%29) satellite.\n", "\n", "The data consists of maps of the concentration of ice in the Arctic collected between 2006 and 2011. The data obtained from the [amsr database](http://www.iup.uni-bremen.de/seaice/amsr/) and converted into a single HDF5 file format." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 1 - Examining a single map" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Begin by examining the HDF5 file - you can use `h5ls` at the command line, or `h5py` inside the notebook.\n", "\n", "> If you don't remember how to open HDF5 files, and read datasets from HDF5 files, look at our Day 2 lecture.\n", ">\n", "> There are many datasets, each with a name of the format `YYYYMMDD`, giving the data. Each dataset is a single map (i.e. 2D array), where the values give the ice concentration (fraction, from 0.0 to 100.0) in that pixel of the map. Careful of NaN values!\n", "\n", "Read one of the maps, and plot it with Matplotlib.\n", "\n", "Note: to get the correct orientation, you need the `origin='lower'` argument for `imshow()`. Include a colorbar. Remove the tick labels (`0`, `100`, and so on, indicating pixel number) since they are not useful." ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [], "source": [ "# your solution here\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 2 - Ice concentration versus time" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We want to make a plot of the ice concentration over time.\n", "\n", "First, write a loop to read all the datasets of the HDF5 file (e.g. into a dict).\n", "\n", "Then, write an analysis function `frac_pixels_above(dict,value)` which, for each array in the input dict, computes the fraction of pixels above the input `value`. Use this to make a plot of the number of pixels with concentration above 50%, versus time.\n", "\n", "> Note: to include \"time\" on the x-axis of a plot, you may want to write a helper function to convert the dict keys from their `YYYYMMDD` string format into a 3-tuple of (year, month, day) integer values.\n", ">\n", "> This can then be converted into fractional years (e.g. 1 July 2012 is `2012.5`). For simplicity you can assume each month has 30 days.\n", ">\n", "> Try experimenting with matplotlib `set_major_formatter` to get a good [representation of dates in the tick labels](https://matplotlib.org/3.5.1/gallery/text_labels_and_annotations/date.html).\n", "\n", "Describe what you see in the plot." ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [], "source": [ "# your solution here\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 3 - Physical units\n", "\n", "To be more quantitative we will compute the actual surface area of Earth in $\\rm{km}^2$ over which the ice concentration is above a given threshold.\n", "\n", "However, these maps are projections of a spherical surface, so [pixels have different area](https://en.wikipedia.org/wiki/Tissot%27s_indicatrix).\n", "\n", "> Every map uses the same projection, so the pixel areas in each are the same.\n", "\n", "The areas (in $\\rm{km}^2$) are available in the file named `data/p2_icedata_area.hdf5`. Inspect, then load, this datafile. Plot it (with colorbar and units)." ] }, { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [], "source": [ "# your solution here\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 4 - Surface area covered by ice versus time\n", "\n", "Use the same data as before, now compute and plot the total area (in physical units) where the ice concentration is 99\\% or above, versus time.\n", "\n", "Describe what you see - how does the minimum change over time?" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [], "source": [ "# your solution here\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 5 - Visualizing changes over time" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First, find the date (dataset) when the area with ice concentration is above 99% is the smallest. What is the value of the minimum area?\n", "\n", "Next, make a side-by-side plot of the map data for this time, as well as for the same month of an earlier year.\n", "\n", "Finally, compute the difference between the two maps, and visualize it.\n", "\n", "> A loss in ice between these two times should correspond to a negative value (\"delta\"), and a gain should correspond to a positive value.\n", ">\n", "> Use a diverging color map centered at `0.0` to emphasize regions of positive versus negative change. Include a colorbar.\n" ] }, { "cell_type": "code", "execution_count": 63, "metadata": {}, "outputs": [], "source": [ "# your solution here\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Part 6 - Yearly averages (data reduction)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Compute average ice concentration maps for 2006 and 2011, and plot them side by side. What is your interpretation? Keep in mind that the time period of this data is only a few years, so we cannot assess trends on longer timescales." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# your solution here\n" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 4 }