Assignment 3#
Due: Wednesday Oct 1st at 11:59 pm ET
Goal#
Use Xarray to analyze multi‑dimensional weather/climate data. You will work with a dataset, inspect its metadata, subset in space and time, compute monthly means and climatologies, derive anomalies and rolling indices, create composite maps, and compare coarsen vs. interpolation.
Instructions#
You should submit this assignment to your existing geog213-assignments
or geog313-assignments
GitHub repository under a new directory named assignment-3/
.
Your repository should follow all the principles of open and reproducible science you learned in Assignment 1 (including a README file with all the instructions to reproduce the results of your work). This will account for 10 pts.
Dataset#
NOAA ERSST v5 — Extended Reconstructed Sea Surface Temperature (monthly, global; ~2° grid).
OPeNDAP URL :
http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/noaa.ersst.v5/sst.mnmean.nc
(See Lecture 06 for usage context and examples.)
Access hint (not a skeleton):
import xarray as xr
ersst_url = "http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/noaa.ersst.v5/sst.mnmean.nc"
ds = xr.open_dataset(
ersst_url,
drop_variables=["time_bnds"]
)
Tasks#
1) Open & Inspect (10 pts)#
Open the ERSST dataset from OPeNDAP (above).
Print a concise summary of the Dataset and the
sst
variable: dimensions, coordinates, and key attributes.In 3–5 sentences, explain how
dims
,coords
, andattrs
reflect the Xarray data model.
2) Space–Time Subsetting & Units (10 pts)#
Subset the dataset to
1982‑01
through2024‑12
.Subset the Niño‑3.4‑like region: 5°S–5°N, 170°W–120°W.
Confirm the SST units and note any relevant CF attributes (e.g.,
standard_name
,long_name
,missing_value
).
3) Climatology, Monthly Means & Anomalies (20 pts)#
Compute a monthly climatology over 1982–2011 using
groupby()
.Compute SST anomalies by subtracting the appropriate monthly climatology from each monthly field.
Create two area‑weighted time series (averaged over the Niño‑3.4‑like region) by using cosine of the latitude as weights for each pixel and document your approach, and plot the time series in two separate plots:
monthly mean SST
monthly SST anomalies
4) Rolling Index & Event Detection (15 pts)#
Compute a 3‑month centered rolling mean of the area‑averaged anomalies (an ENSO‑style index).
Identify contiguous warm events where the index is
+0.5 °C
above the mean for ≥ 3 consecutive months, and cold events where the index is0.5 °C
below the mean for ≥ 3 consecutive months.Export your area‑averaged monthly anomaly series and 3‑month index to
results/region_index.csv
(columns:time
,anomaly
,rolling_anomaly
).Report the top three warm (El Niño) and three cold (La Niña) events by peak magnitude, with start/end dates.
5) Spatial Composites (15 pts)#
Build composite anomaly maps: the mean of all anomaly months belonging to warm events and, separately, cold events.
Plot both composites using the same color scale, with clear titles and colorbars.
Save your warm and cold composite anomaly maps to NetCDF files:
results/composite_warm.nc
results/composite_cold.nc
In 3–4 sentences, interpret the large‑scale patterns you see.
6) Grid Comparison: Coarsen vs. Interpolate (20 pts)#
ERSST is ~2° resolution. Compare two approaches to a coarser global 4° grid:
Coarsening: use
coarsen(lat=2, lon=2).mean()
on your monthly anomaly fields to produce 4° anomalies.Interpolation: construct a regular 4° target grid and produce a bilinearly interpolated anomaly field via
.interp()
.For a representative month (pick one), plot both maps side‑by‑side.
Discuss pros/cons of the two methods, and how they differ.
Optional (+10 pts): Trend Mapping#
Using polyfit(dim='time', deg=1)
, estimate a linear trend (°C per decade) of monthly SST anomalies over 1982–2024. Plot the slope map and briefly comment on patterns and caveats.
Deliverables#
Your assignment-3/
directory should include the following in addition to license file:
notebooks/<your_notebook>.ipynb
— executed with figures rendered on GitHubresults/composite_warm.nc
,results/composite_cold.nc
,results/region_index.csv
README.md
— Instructions to reproduce the code