{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "# Getting Started\n", "The Chalmers Hydrometor Inversion Product from the Arctic Weather Satellite (CHIP-AWS), provides global atmospheric ice mass estimates derived from passive microwave measurements.\n", "The data are available as NetCDF files, the following examples will show how to get started using them with python and `xarray`." ] }, { "cell_type": "code", "execution_count": 1, "id": "1", "metadata": { "execution": { "iopub.execute_input": "2025-12-16T16:16:03.079212Z", "iopub.status.busy": "2025-12-16T16:16:03.078955Z", "iopub.status.idle": "2025-12-16T16:16:03.484487Z", "shell.execute_reply": "2025-12-16T16:16:03.483822Z" } }, "outputs": [], "source": [ "from datetime import datetime\n", "import requests\n", "import xarray as xr\n", "\n", "def file_urls_for_timeranges(timeranges: list[slice]) -> list[str]:\n", " \"\"\"\n", " Helper function to get a list of level2 urls for the requested timeranges\n", " \"\"\"\n", " base_url = \"http://data.clouds-and-precip.group/chip-aws/chip-aws-v0.3/level2\"\n", " index = requests.get(f\"{base_url}/index.json\").json()\n", " urls = [\n", " f\"{base_url}/{item['filepath']}#mode=bytes\"\n", " for item in index['items']\n", " for timerange in timeranges\n", " if datetime.fromisoformat(item['datetime_end']) >= datetime.fromisoformat(timerange.start.replace(\"Z\", \"+00:00\"))\n", " and datetime.fromisoformat(item['datetime_start']) <= datetime.fromisoformat(timerange.stop.replace(\"Z\", \"+00:00\"))\n", " ]\n", " return sorted(set(urls))" ] }, { "cell_type": "code", "execution_count": 3, "id": "2", "metadata": { "execution": { "iopub.execute_input": "2025-12-16T16:16:03.493636Z", "iopub.status.busy": "2025-12-16T16:16:03.493217Z", "iopub.status.idle": "2025-12-16T16:16:04.086049Z", "shell.execute_reply": "2025-12-16T16:16:04.085458Z" } }, "outputs": [], "source": [ "# List some interesting scenes\n", "timeranges = [\n", " slice('2025-05-01T07:18:00', '2025-05-01T07:28:00'),\n", " slice('2025-05-01T11:19:00', '2025-05-01T11:28:00'),\n", " slice('2025-05-01T11:46:00', '2025-05-01T11:55:00'),\n", "]\n", "\n", "# Open the files as a single xarray dataset\n", "ds = xr.open_mfdataset(\n", " file_urls_for_timeranges(timeranges),\n", " combine=\"nested\",\n", " concat_dim=\"scan\",\n", " data_vars=\"minimal\",\n", ")\n", "\n", "# Each file is generated from a single source level 1 file for self-contained processing.\n", "# Consecutive source files have short overlaps. To avoid duplicate data, \n", "# we remove overlapping scans by keeping only the last occurrence of each duplicate.\n", "# Sorting ensures scans are in chronological order from these overlaps,\n", "# allowing selection by time slices.\n", "ds = ds.sortby('scan').sel(scan=~ds.get_index('scan').duplicated(keep='last'))" ] }, { "cell_type": "markdown", "id": "6a9f6679", "metadata": {}, "source": [ "# Dataset structure\n", "The main variables are given in the along-track `scan` dimension and the across-track `fov` (field-of-view) dimension.\n", "The structure of the data is shown below:" ] }, { "cell_type": "code", "execution_count": 4, "id": "ed68302d", "metadata": { "execution": { "iopub.execute_input": "2025-12-16T16:16:04.088038Z", "iopub.status.busy": "2025-12-16T16:16:04.087668Z", "iopub.status.idle": "2025-12-16T16:16:04.108017Z", "shell.execute_reply": "2025-12-16T16:16:04.107657Z" } }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 100MB\n",
"Dimensions: (scan: 6721, fov: 88, quantile: 5, surface_type: 6,\n",
" channel: 11)\n",
"Coordinates:\n",
" * surface_type (surface_type) <U7 168B 'ocean' ... 'glacier'\n",
" latitude (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" longitude (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" * quantile (quantile) float32 20B 0.02 0.16 0.5 0.84 0.98\n",
" * channel (channel) <U5 220B 'AWS21' 'AWS31' ... 'AWS44'\n",
" * scan (scan) datetime64[ns] 54kB 2025-05-01T06:05:36.77...\n",
"Dimensions without coordinates: fov\n",
"Data variables: (12/16)\n",
" fwp_mean (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" fwp_most_prob (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" fwp_quantiles (scan, fov, quantile) float32 12MB dask.array<chunksize=(3360, 88, 5), meta=np.ndarray>\n",
" fwp_dm_mean (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" fwp_dm_most_prob (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" fwp_dm_quantiles (scan, fov, quantile) float32 12MB dask.array<chunksize=(3360, 88, 5), meta=np.ndarray>\n",
" ... ...\n",
" surface_type_fractions (scan, fov, surface_type) float32 14MB dask.array<chunksize=(3360, 88, 6), meta=np.ndarray>\n",
" tb (scan, fov, channel) float32 26MB dask.array<chunksize=(3360, 88, 11), meta=np.ndarray>\n",
" l1b_index_scans (scan) uint32 27kB dask.array<chunksize=(3360,), meta=np.ndarray>\n",
" l1b_index_fovs (fov) uint32 352B dask.array<chunksize=(88,), meta=np.ndarray>\n",
" flag_bad_data (scan, fov) uint8 591kB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
" fwp_ccic (scan, fov) float32 2MB dask.array<chunksize=(3360, 88), meta=np.ndarray>\n",
"Attributes:\n",
" title: CHIP-AWS: Chalmers Hydrometeor Inversion Product from t...\n",
" institution: Chalmers University of Technology\n",
" references: https://clouds-and-precip.group/datasets/chip-aws/\n",
" history: Retrieval processing\n",
" source_file: W_NO-KSAT-Tromso,SAT,AWS1-MWR-1B-RAD_C_OHB__20250501074...\n",
" source_file_md5: d569c33690327feb2f3b925f3172a208\n",
" source: chip-aws-v0.4.4