{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sentinel 1 SAR GRD Data with satpy" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2021-05-21T06:36:39.337354Z", "iopub.status.busy": "2021-05-21T06:36:39.336947Z", "iopub.status.idle": "2021-05-21T06:36:47.580046Z", "shell.execute_reply": "2021-05-21T06:36:47.578791Z", "shell.execute_reply.started": "2021-05-21T06:36:39.337323Z" } }, "outputs": [], "source": [ "!pip install satpy rioxarray rasterio" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reading single bands" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Getting the filenames" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2021-05-21T06:36:47.582351Z", "iopub.status.busy": "2021-05-21T06:36:47.581991Z", "iopub.status.idle": "2021-05-21T06:36:50.571415Z", "shell.execute_reply": "2021-05-21T06:36:50.570247Z", "shell.execute_reply.started": "2021-05-21T06:36:47.582316Z" } }, "outputs": [], "source": [ "from satpy import Scene, find_files_and_readers\n", "from datetime import datetime\n", "\n", "files = find_files_and_readers(\n", " base_dir=\"/home/a001673/data/satellite/Sentinel-1/\",\n", " # Bay of bothnia\n", " start_time=datetime(2020, 3, 14, 15, 49, 13),\n", " end_time=datetime(2020, 3, 16, 15, 49, 40),\n", " reader='sar-c_safe')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Read the HH-polarized measurement as a `xarray.DataArray`" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2021-05-21T06:44:52.756745Z", "iopub.status.busy": "2021-05-21T06:44:52.756249Z", "iopub.status.idle": "2021-05-21T06:44:55.811011Z", "shell.execute_reply": "2021-05-21T06:44:55.809702Z", "shell.execute_reply.started": "2021-05-21T06:44:52.756705Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray (y: 10717, x: 10474)>\n",
       "dask.array<clip, shape=(10717, 10474), dtype=float64, chunksize=(4096, 4096), chunktype=numpy.ndarray>\n",
       "Coordinates:\n",
       "  * y            (y) int64 0 1 2 3 4 5 6 ... 10711 10712 10713 10714 10715 10716\n",
       "  * x            (x) int64 0 1 2 3 4 5 6 ... 10468 10469 10470 10471 10472 10473\n",
       "    band         int64 1\n",
       "    spatial_ref  int64 0\n",
       "    crs          object +proj=longlat +type=crs\n",
       "Attributes: (12/18)\n",
       "    name:                 measurement\n",
       "    sensor:               sar-c\n",
       "    wavelength:           [5.4, 5.405, 5.41]\n",
       "    resolution:           80\n",
       "    polarization:         hh\n",
       "    calibration:          gamma\n",
       "    ...                   ...\n",
       "    platform_name:        s1b\n",
       "    start_time:           2020-03-15 05:04:28\n",
       "    end_time:             2020-03-15 05:05:32\n",
       "    area:                 Shape: (10717, 10474)\\nLons: <xarray.DataArray 'int...\n",
       "    _satpy_id:            DataID(name='measurement', polarization='hh', resol...\n",
       "    ancillary_variables:  []
" ], "text/plain": [ "\n", "dask.array\n", "Coordinates:\n", " * y (y) int64 0 1 2 3 4 5 6 ... 10711 10712 10713 10714 10715 10716\n", " * x (x) int64 0 1 2 3 4 5 6 ... 10468 10469 10470 10471 10472 10473\n", " band int64 1\n", " spatial_ref int64 0\n", " crs object +proj=longlat +type=crs\n", "Attributes: (12/18)\n", " name: measurement\n", " sensor: sar-c\n", " wavelength: [5.4, 5.405, 5.41]\n", " resolution: 80\n", " polarization: hh\n", " calibration: gamma\n", " ... ...\n", " platform_name: s1b\n", " start_time: 2020-03-15 05:04:28\n", " end_time: 2020-03-15 05:05:32\n", " area: Shape: (10717, 10474)\\nLons: