diff --git a/notebooks/climate_maps_june2020.png b/notebooks/climate_maps_june2020.png new file mode 100644 index 0000000..6760849 Binary files /dev/null and b/notebooks/climate_maps_june2020.png differ diff --git a/notebooks/merge_climate_datasets_exercise.ipynb b/notebooks/merge_climate_datasets_exercise.ipynb index 9be1adf..a1e6c93 100644 --- a/notebooks/merge_climate_datasets_exercise.ipynb +++ b/notebooks/merge_climate_datasets_exercise.ipynb @@ -28,7 +28,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "0a656265", "metadata": { "tags": [ @@ -69,7 +69,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "3270985f", "metadata": { "tags": [ @@ -80,7 +80,8 @@ "source": [ "# TODO: load the air temperature and precipitation datasets.\n", "# Example: air = xr.open_dataset(..., chunks={\"time\": 8})\n", - "raise NotImplementedError(\"Assign datasets to `air` and `precip`.\")\n" + "air = xr.open_dataarray(TEMP_URL, chunks={\"time\": 8})\n", + "precip = xr.open_dataarray(PRECIP_URL, chunks={\"time\": 8})" ] }, { @@ -96,7 +97,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "264d9641", "metadata": { "tags": [ @@ -106,7 +107,8 @@ "outputs": [], "source": [ "# TODO: subset both datasets using `sel`, handling coordinate ordering as needed.\n", - "raise NotImplementedError(\"Create `air_us` and `precip_us`.\")\n" + "air_us = air.sel(time=TIME_RANGE, lat=slice(*LAT_RANGE), lon=slice(*LON_RANGE_360))\n", + "precip_us = precip.sel(time=TIME_RANGE, lat=slice(*LAT_RANGE), lon=slice(*LON_RANGE_360))" ] }, { @@ -121,7 +123,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "96529bc0", "metadata": { "tags": [ @@ -131,7 +133,7 @@ "outputs": [], "source": [ "# TODO: use xr.resample to create daily means.\n", - "raise NotImplementedError(\"Create `air_daily`.\")\n" + "air_daily = air_us.resample(time=\"1D\").mean()\n" ] }, { @@ -146,17 +148,693 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "52eb7321", "metadata": { "tags": [ "exercise" ] }, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
<xarray.DataArray 'air' (time: 30, lat: 60, lon: 140)> Size: 1MB\n", + "dask.array<transpose, shape=(30, 60, 140), dtype=float32, chunksize=(1, 60, 140), chunktype=numpy.ndarray>\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 240B 2020-06-01 2020-06-02 ... 2020-06-30\n", + " * lat (lat) float32 240B 49.75 49.25 48.75 48.25 ... 21.25 20.75 20.25\n", + " * lon (lon) float32 560B 230.2 230.8 231.2 231.8 ... 298.8 299.2 299.8\n", + "Attributes: (12/13)\n", + " long_name: 4xDaily Air temperature at sigma level 995\n", + " units: degK\n", + " precision: 2\n", + " GRIB_id: 11\n", + " GRIB_name: TMP\n", + " var_desc: Air temperature\n", + " ... ...\n", + " parent_stat: Other\n", + " valid_range: [185.16 331.16]\n", + " dataset: NCEP Reanalysis\n", + " actual_range: [188.6 324.1]\n", + " level_desc: 0.995 sigma\n", + " _ChunkSizes: [ 1 73 144]