diff --git a/book/intro.md b/book/intro.md index 907d109..9601099 100644 --- a/book/intro.md +++ b/book/intro.md @@ -2,6 +2,8 @@ ## Neural network models for Chloraphyll-a gap-filling for remote-sensing products +### Authors: See individual notebooks + 2024 GeoSMART Hackweek: [Pitch slide](https://docs.google.com/presentation/d/1YfBLkspba2hRz5pTHG9OF3o9WHv-yNemZDq2QKFCme0/edit?usp=sharing) diff --git a/book/notebooks/CHL_prediction_CNN.ipynb b/book/notebooks/CHL_prediction_CNN.ipynb new file mode 100644 index 0000000..cd8537e --- /dev/null +++ b/book/notebooks/CHL_prediction_CNN.ipynb @@ -0,0 +1,3041 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import xarray as xr\n", + "import numpy as np\n", + "\n", + "import dask.array as da\n", + "\n", + "import matplotlib.pyplot as plt\n", + "\n", + "import tensorflow as tf\n", + "from tensorflow.keras.callbacks import EarlyStopping\n", + "from tensorflow.keras.models import Sequential\n", + "from tensorflow.keras.layers import ConvLSTM2D, BatchNormalization, Conv2D, Dropout" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "All Physical Devices: [PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU'), PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]\n", + "Available GPUs: [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]\n", + "GPU Details: {'device_name': 'NVIDIA GeForce RTX 4070 Laptop GPU', 'compute_capability': (8, 9)}\n" + ] + } + ], + "source": [ + "# list all the physical devices\n", + "physical_devices = tf.config.list_physical_devices()\n", + "print(\"All Physical Devices:\", physical_devices)\n", + "\n", + "# list all the available GPUs\n", + "gpus = tf.config.list_physical_devices('GPU')\n", + "print(\"Available GPUs:\", gpus)\n", + "\n", + "# Print infomation for available GPU if there exists any\n", + "if gpus:\n", + " for gpu in gpus:\n", + " details = tf.config.experimental.get_device_details(gpu)\n", + " print(\"GPU Details:\", details)\n", + "else:\n", + " print(\"No GPU available\")" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
<xarray.Dataset> Size: 711MB\n", + "Dimensions: (time: 366, lat: 149, lon: 181)\n", + "Coordinates:\n", + " * lat (lat) float32 596B 32.0 31.75 31.5 ... -4.5 -4.75 -5.0\n", + " * lon (lon) float32 724B 45.0 45.25 45.5 ... 89.5 89.75 90.0\n", + " * time (time) datetime64[ns] 3kB 2020-01-01 ... 2020-12-31\n", + "Data variables: (12/19)\n", + " CHL (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " CHL_uncertainty (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " adt (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " air_temp (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " curr_dir (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " curr_speed (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " ... ...\n", + " ug_curr (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " v_curr (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " v_wind (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " vg_curr (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " wind_dir (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + " wind_speed (time, lat, lon) float32 39MB dask.array<chunksize=(25, 149, 181), meta=np.ndarray>\n", + "Attributes: (12/17)\n", + " creator_email: minhphan@uw.edu\n", + " creator_name: Minh Phan\n", + " creator_type: person\n", + " date_created: 2023-07-19\n", + " geospatial_lat_max: 32.0\n", + " geospatial_lat_min: -12.0\n", + " ... ...\n", + " geospatial_lon_units: degrees_east\n", + " source: Earth & Space Research (ESR), Copernicus Clim...\n", + " summary: Daily mean of 0.25 x 0.25 degrees gridded dat...\n", + " time_coverage_end: 2022-12-31T23:59:59\n", + " time_coverage_start: 1979-01-01T00:00:00\n", + " title: Climate Data for Coastal Upwelling Machine Le...