{ "cells": [ { "cell_type": "markdown", "id": "0e7306b5-bf7c-4d45-882e-dc432c5a8f87", "metadata": {}, "source": [ "## Workflow\n", "\n", "(for v0.3.0)\n", "https://github.com/ASFHyP3/hyp3-isce2/releases/tag/v0.3.0\n", "\n", "https://github.com/ASFHyP3/hyp3-isce2/tree/v0.3.0\n", "\n", "\n", "1. Find a burst to process\n", "2. Search ASF for scenes\n", "3. Select dates to process\n", "4. Create processing subfolders to execute burst processing in" ] }, { "cell_type": "code", "execution_count": 1, "id": "ca8e5b53-a8b3-43f5-8f51-c842a7046d16", "metadata": {}, "outputs": [], "source": [ "import geopandas as gpd\n", "import asf_search as asf\n", "import requests\n", "import os\n", "# not sure why DEBUG statements is happening in other libraries if imported after hyp3_isce2...\n", "import logging\n", "import hyp3_isce2.burst as hb # https://github.com/ASFHyP3/hyp3-isce2/issues/53 ?\n", "rootlogs = logging.getLogger()\n", "rootlogs.setLevel('WARNING')\n", "import numpy as np\n", "import xmlschema\n", "import lxml\n", "import re" ] }, { "cell_type": "code", "execution_count": 2, "id": "f23cb40a-ade2-4d07-9297-ea7b4369883b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'0.3.0'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import hyp3_isce2\n", "hyp3_isce2.__version__ # syntax changing rapidly, so stick with 0.3.0" ] }, { "cell_type": "code", "execution_count": 3, "id": "2545af69-c475-4d85-82ca-b9fbf2739557", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# https://geojson.io/#new&map=15.23/47.654452/-122.303174\n", "gfa = gpd.GeoDataFrame.from_features( {\n", " \"type\": \"FeatureCollection\",\n", " \"features\": [\n", " {\n", " \"type\": \"Feature\",\n", " \"properties\": {},\n", " \"geometry\": {\n", " \"coordinates\": [\n", " -122.29994319751066,\n", " 47.657472535245574\n", " ],\n", " \"type\": \"Point\"\n", " }\n", " }\n", " ]\n", "},\n", " crs=4326 \n", ")\n", "gfa.explore()" ] }, { "cell_type": "markdown", "id": "622ccaa5-5fe7-4000-95af-0ed4a3ce02ce", "metadata": {}, "source": [ "## Find a single burst\n", "\n", "1. You need to download the burst database\n", "\n", "https://sar-mpc.eu/test-data-sets/\n", "\n", "Sentinel-1 Burst ID Map, version 20220530, generated by the SAR-MPC service, available on Sentinel-1 MPC Test data sets" ] }, { "cell_type": "code", "execution_count": 4, "id": "c0042ab6-b500-4a47-8d4a-0f36ea8021bb", "metadata": {}, "outputs": [], "source": [ "# For now consider selecting a burst covering a point\n", "gf = gpd.read_file('S1_burstid_20220530/IW/sqlite/burst_map_IW_000001_375887.sqlite3',\n", " mask=gfa)" ] }, { "cell_type": "code", "execution_count": 5, "id": "a148e1b1-389d-4806-a8fc-5cee18294596", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
burst_idsubswath_namerelative_orbit_numbertime_from_anx_secorbit_passgeometry
026566IW2132181.796971DESCENDINGMULTIPOLYGON Z (((-122.23228 47.70264 0.00000,...
1135602IW164778.871202ASCENDINGMULTIPOLYGON Z (((-122.33284 47.59533 0.00000,...
2245655IW31152183.851464DESCENDINGMULTIPOLYGON Z (((-121.35897 47.72621 0.00000,...
3245656IW31152186.609737DESCENDINGMULTIPOLYGON Z (((-121.40024 47.56094 0.00000,...
4292399IW2137774.912738ASCENDINGMULTIPOLYGON Z (((-123.23149 47.51699 0.00000,...
\n", "
" ], "text/plain": [ " burst_id subswath_name relative_orbit_number time_from_anx_sec \n", "0 26566 IW2 13 2181.796971 \\\n", "1 135602 IW1 64 778.871202 \n", "2 245655 IW3 115 2183.851464 \n", "3 245656 IW3 115 2186.609737 \n", "4 292399 IW2 137 774.912738 \n", "\n", " orbit_pass geometry \n", "0 DESCENDING MULTIPOLYGON Z (((-122.23228 47.70264 0.00000,... \n", "1 ASCENDING MULTIPOLYGON Z (((-122.33284 47.59533 0.00000,... \n", "2 DESCENDING MULTIPOLYGON Z (((-121.35897 47.72621 0.00000,... \n", "3 DESCENDING MULTIPOLYGON Z (((-121.40024 47.56094 0.00000,... \n", "4 ASCENDING MULTIPOLYGON Z (((-123.23149 47.51699 0.00000,... " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "gf.head()" ] }, { "cell_type": "code", "execution_count": 6, "id": "422131cd-a932-49a7-b8e0-e074ac8fa62e", "metadata": {}, "outputs": [], "source": [ "#gf.explore()" ] }, { "cell_type": "code", "execution_count": 7, "id": "70426c89-b873-47fd-a35e-0dd214927a07", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
burst_idsubswath_namerelative_orbit_numbertime_from_anx_secorbit_passgeometry
4292399IW2137774.912738ASCENDINGMULTIPOLYGON Z (((-123.23149 47.51699 0.00000,...
\n", "
" ], "text/plain": [ " burst_id subswath_name relative_orbit_number time_from_anx_sec \n", "4 292399 IW2 137 774.912738 \\\n", "\n", " orbit_pass geometry \n", "4 ASCENDING MULTIPOLYGON Z (((-123.23149 47.51699 0.00000,... " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Ascending test\n", "burstId = '137_IW2_292399'\n", "\n", "relorb = int(burstId.split('_')[0])\n", "subswath = burstId.split('_')[1]\n", "idnum = int(burstId.split('_')[2])\n", "\n", "ind = (gf.relative_orbit_number == relorb) & (gf.subswath_name == subswath) & (gf.burst_id == idnum)\n", "\n", "myburst = gf[ind]\n", "myburst" ] }, { "cell_type": "markdown", "id": "0059fc3b-1885-4924-ab96-52c69ddd4998", "metadata": {}, "source": [ "## Search ASF Archive" ] }, { "cell_type": "code", "execution_count": 8, "id": "6a3fcef5-7736-403e-9a5f-ebfc7b91eb31", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "312" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "results = asf.geo_search(platform=[asf.PLATFORM.SENTINEL1],\n", " processingLevel=asf.SLC,\n", " beamMode=asf.BEAMMODE.IW,\n", " relativeOrbit=relorb,\n", " intersectsWith=str(myburst.geometry.values[0]),\n", " )\n", "gf = gpd.GeoDataFrame.from_features(results.geojson(), crs=4326)\n", "len(gf)" ] }, { "cell_type": "code", "execution_count": 9, "id": "b74ac77a-3f48-405d-b7f7-c6a8000f573b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometrybeamModeTypebrowsebytescenterLatcenterLonfaradayRotationfileIDflightDirectiongroupID...processingDateprocessingLevelsceneNamesensorstartTimestopTimeurlpgeVersionfileNameframeNumber
startTime
2023-05-25 02:02:36+00:00POLYGON ((-124.70564 48.54142, -124.22576 46.9...IWNone461585744947.9470-122.7622NoneS1A_IW_SLC__1SDV_20230525T020236_20230525T0203...ASCENDINGS1A_IWDV_0152_0159_048684_137...2023-05-25T02:02:36.000ZSLCS1A_IW_SLC__1SDV_20230525T020236_20230525T0203...C-SAR2023-05-25T02:02:36.000Z2023-05-25T02:03:02.000Zhttps://datapool.asf.alaska.edu/SLC/SA/S1A_IW_...003.61S1A_IW_SLC__1SDV_20230525T020236_20230525T0203...153
2023-05-13 02:02:35+00:00POLYGON ((-124.70805 48.54140, -124.22818 46.9...IWNone461367082247.9471-122.7646NoneS1A_IW_SLC__1SDV_20230513T020235_20230513T0203...ASCENDINGS1A_IWDV_0153_0158_048509_137...2023-05-13T02:02:35.000ZSLCS1A_IW_SLC__1SDV_20230513T020235_20230513T0203...C-SAR2023-05-13T02:02:35.000Z2023-05-13T02:03:02.000Zhttps://datapool.asf.alaska.edu/SLC/SA/S1A_IW_...003.61S1A_IW_SLC__1SDV_20230513T020235_20230513T0203...153
\n", "

2 rows × 29 columns

\n", "
" ], "text/plain": [ " geometry \n", "startTime \n", "2023-05-25 02:02:36+00:00 POLYGON ((-124.70564 48.54142, -124.22576 46.9... \\\n", "2023-05-13 02:02:35+00:00 POLYGON ((-124.70805 48.54140, -124.22818 46.9... \n", "\n", " beamModeType browse bytes centerLat \n", "startTime \n", "2023-05-25 02:02:36+00:00 IW None 4615857449 47.9470 \\\n", "2023-05-13 02:02:35+00:00 IW None 4613670822 47.9471 \n", "\n", " centerLon faradayRotation \n", "startTime \n", "2023-05-25 02:02:36+00:00 -122.7622 None \\\n", "2023-05-13 02:02:35+00:00 -122.7646 None \n", "\n", " fileID \n", "startTime \n", "2023-05-25 02:02:36+00:00 S1A_IW_SLC__1SDV_20230525T020236_20230525T0203... \\\n", "2023-05-13 02:02:35+00:00 S1A_IW_SLC__1SDV_20230513T020235_20230513T0203... \n", "\n", " flightDirection groupID ... \n", "startTime ... \n", "2023-05-25 02:02:36+00:00 ASCENDING S1A_IWDV_0152_0159_048684_137 ... \\\n", "2023-05-13 02:02:35+00:00 ASCENDING S1A_IWDV_0153_0158_048509_137 ... \n", "\n", " processingDate processingLevel \n", "startTime \n", "2023-05-25 02:02:36+00:00 2023-05-25T02:02:36.000Z SLC \\\n", "2023-05-13 02:02:35+00:00 2023-05-13T02:02:35.000Z SLC \n", "\n", " sceneName \n", "startTime \n", "2023-05-25 02:02:36+00:00 S1A_IW_SLC__1SDV_20230525T020236_20230525T0203... \\\n", "2023-05-13 02:02:35+00:00 S1A_IW_SLC__1SDV_20230513T020235_20230513T0203... \n", "\n", " sensor startTime \n", "startTime \n", "2023-05-25 02:02:36+00:00 C-SAR 2023-05-25T02:02:36.000Z \\\n", "2023-05-13 02:02:35+00:00 C-SAR 2023-05-13T02:02:35.000Z \n", "\n", " stopTime \n", "startTime \n", "2023-05-25 02:02:36+00:00 2023-05-25T02:03:02.000Z \\\n", "2023-05-13 02:02:35+00:00 2023-05-13T02:03:02.000Z \n", "\n", " url \n", "startTime \n", "2023-05-25 02:02:36+00:00 https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_... \\\n", "2023-05-13 02:02:35+00:00 https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_... \n", "\n", " pgeVersion \n", "startTime \n", "2023-05-25 02:02:36+00:00 003.61 \\\n", "2023-05-13 02:02:35+00:00 003.61 \n", "\n", " fileName \n", "startTime \n", "2023-05-25 02:02:36+00:00 S1A_IW_SLC__1SDV_20230525T020236_20230525T0203... \\\n", "2023-05-13 02:02:35+00:00 S1A_IW_SLC__1SDV_20230513T020235_20230513T0203... \n", "\n", " frameNumber \n", "startTime \n", "2023-05-25 02:02:36+00:00 153 \n", "2023-05-13 02:02:35+00:00 153 \n", "\n", "[2 rows x 29 columns]" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Get a summer scene from each year \n", "gf = gf.set_index(gpd.pd.to_datetime(gf.startTime))\n", "gf.head(2)" ] }, { "cell_type": "code", "execution_count": 10, "id": "f9826a50-82b1-4242-b0d9-0b7d4ed4e6a5", "metadata": {}, "outputs": [], "source": [ "# 1st acquisition of every month\n", "#gf.groupby([gf.index.year, gf.index.month]).first()\n", "\n", "# 1st acquisition of given month every year\n", "subset = gf[gf.index.month == 5] \n", "subset = subset.groupby(subset.index.year).first()" ] }, { "cell_type": "code", "execution_count": 11, "id": "8d312d73-d9ff-43f1-b0df-9ab2015ea0a0", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
geometrybeamModeTypebrowsebytescenterLatcenterLonfaradayRotationfileIDflightDirectiongroupID...processingDateprocessingLevelsceneNamesensorstartTimestopTimeurlpgeVersionfileNameframeNumber
startTime
2015POLYGON ((-124.56292 48.10650, -124.08672 46.4...IWNone250578154347.5056-122.6591NoneS1A_IW_SLC__1SSV_20150531T020141_20150531T0202...ASCENDINGS1A_IWSV_0152_0157_006159_137...2015-05-31T02:01:41.000ZSLCS1A_IW_SLC__1SSV_20150531T020141_20150531T0202...C-SAR2015-05-31T02:01:41.000Z2015-05-31T02:02:08.000Zhttps://datapool.asf.alaska.edu/SLC/SA/S1A_IW_...002.72S1A_IW_SLC__1SSV_20150531T020141_20150531T0202...151
2016POLYGON ((-124.82479 48.86943, -124.34055 47.2...IWNone244305455948.2749-122.8768NoneS1A_IW_SLC__1SSV_20160525T020200_20160525T0202...ASCENDINGS1A_IWSV_0155_0160_011409_137...2016-05-25T02:02:00.000ZSLCS1A_IW_SLC__1SSV_20160525T020200_20160525T0202...C-SAR2016-05-25T02:02:00.000Z2016-05-25T02:02:27.000Zhttps://datapool.asf.alaska.edu/SLC/SA/S1A_IW_...002.71S1A_IW_SLC__1SSV_20160525T020200_20160525T0202...154
2017POLYGON ((-124.70644 48.54178, -124.22670 46.9...IWNone465382359147.9476-122.7629NoneS1B_IW_SLC__1SDV_20170526T020118_20170526T0201...ASCENDINGS1B_IWDV_0153_0158_005763_137...2017-05-26T02:01:18.000ZSLCS1B_IW_SLC__1SDV_20170526T020118_20170526T0201...C-SAR2017-05-26T02:01:18.000Z2017-05-26T02:01:44.000Zhttps://datapool.asf.alaska.edu/SLC/SB/S1B_IW_...002.82S1B_IW_SLC__1SDV_20170526T020118_20170526T0201...153
2018POLYGON ((-124.87379 49.03462, -124.38744 47.4...IWNone458615337948.4414-122.9070NoneS1B_IW_SLC__1SDV_20180521T020132_20180521T0201...ASCENDINGS1B_IWDV_0154_0160_011013_137...2018-05-21T02:01:32.000ZSLCS1B_IW_SLC__1SDV_20180521T020132_20180521T0201...C-SAR2018-05-21T02:01:32.000Z2018-05-21T02:01:59.000Zhttps://datapool.asf.alaska.edu/SLC/SB/S1B_IW_...002.90S1B_IW_SLC__1SDV_20180521T020132_20180521T0201...154
2019POLYGON ((-124.87373 49.03450, -124.38760 47.4...IWNone461104465248.4394-122.9256NoneS1B_IW_SLC__1SDV_20190528T020139_20190528T0202...ASCENDINGS1B_IWDV_0154_0160_016438_137...2019-05-28T02:01:39.000ZSLCS1B_IW_SLC__1SDV_20190528T020139_20190528T0202...C-SAR2019-05-28T02:01:39.000Z2019-05-28T02:02:06.000Zhttps://datapool.asf.alaska.edu/SLC/SB/S1B_IW_...002.91S1B_IW_SLC__1SDV_20190528T020139_20190528T0202...154
2020POLYGON ((-124.85921 49.03609, -124.37350 47.4...IWNone459953578048.4404-122.9141NoneS1B_IW_SLC__1SDV_20200522T020145_20200522T0202...ASCENDINGS1B_IWDV_0155_0160_021688_137...2020-05-22T02:01:45.000ZSLCS1B_IW_SLC__1SDV_20200522T020145_20200522T0202...C-SAR2020-05-22T02:01:45.000Z2020-05-22T02:02:12.000Zhttps://datapool.asf.alaska.edu/SLC/SB/S1B_IW_...003.20S1B_IW_SLC__1SDV_20200522T020145_20200522T0202...154
2021POLYGON ((-124.85926 49.03585, -124.37357 47.4...IWNone438944162348.4402-122.9141NoneS1B_IW_SLC__1SDV_20210529T020151_20210529T0202...ASCENDINGS1B_IWDV_0154_0160_027113_137...2021-05-29T02:01:51.000ZSLCS1B_IW_SLC__1SDV_20210529T020151_20210529T0202...C-SAR2021-05-29T02:01:51.000Z2021-05-29T02:02:18.000Zhttps://datapool.asf.alaska.edu/SLC/SB/S1B_IW_...003.31S1B_IW_SLC__1SDV_20210529T020151_20210529T0202...154
2022POLYGON ((-124.70712 48.54180, -124.22723 46.9...IWNone464890619247.9474-122.7636NoneS1A_IW_SLC__1SDV_20220530T020231_20220530T0202...ASCENDINGS1A_IWDV_0152_0159_043434_137...2022-05-30T02:02:31.000ZSLCS1A_IW_SLC__1SDV_20220530T020231_20220530T0202...C-SAR2022-05-30T02:02:31.000Z2022-05-30T02:02:58.000Zhttps://datapool.asf.alaska.edu/SLC/SA/S1A_IW_...003.52S1A_IW_SLC__1SDV_20220530T020231_20220530T0202...153
2023POLYGON ((-124.70564 48.54142, -124.22576 46.9...IWNone461585744947.9470-122.7622NoneS1A_IW_SLC__1SDV_20230525T020236_20230525T0203...ASCENDINGS1A_IWDV_0152_0159_048684_137...2023-05-25T02:02:36.000ZSLCS1A_IW_SLC__1SDV_20230525T020236_20230525T0203...C-SAR2023-05-25T02:02:36.000Z2023-05-25T02:03:02.000Zhttps://datapool.asf.alaska.edu/SLC/SA/S1A_IW_...003.61S1A_IW_SLC__1SDV_20230525T020236_20230525T0203...153
\n", "

9 rows × 29 columns

\n", "
" ], "text/plain": [ " geometry beamModeType \n", "startTime \n", "2015 POLYGON ((-124.56292 48.10650, -124.08672 46.4... IW \\\n", "2016 POLYGON ((-124.82479 48.86943, -124.34055 47.2... IW \n", "2017 POLYGON ((-124.70644 48.54178, -124.22670 46.9... IW \n", "2018 POLYGON ((-124.87379 49.03462, -124.38744 47.4... IW \n", "2019 POLYGON ((-124.87373 49.03450, -124.38760 47.4... IW \n", "2020 POLYGON ((-124.85921 49.03609, -124.37350 47.4... IW \n", "2021 POLYGON ((-124.85926 49.03585, -124.37357 47.4... IW \n", "2022 POLYGON ((-124.70712 48.54180, -124.22723 46.9... IW \n", "2023 POLYGON ((-124.70564 48.54142, -124.22576 46.9... IW \n", "\n", " browse bytes centerLat centerLon faradayRotation \n", "startTime \n", "2015 None 2505781543 47.5056 -122.6591 None \\\n", "2016 None 2443054559 48.2749 -122.8768 None \n", "2017 None 4653823591 47.9476 -122.7629 None \n", "2018 None 4586153379 48.4414 -122.9070 None \n", "2019 None 4611044652 48.4394 -122.9256 None \n", "2020 None 4599535780 48.4404 -122.9141 None \n", "2021 None 4389441623 48.4402 -122.9141 None \n", "2022 None 4648906192 47.9474 -122.7636 None \n", "2023 None 4615857449 47.9470 -122.7622 None \n", "\n", " fileID flightDirection \n", "startTime \n", "2015 S1A_IW_SLC__1SSV_20150531T020141_20150531T0202... ASCENDING \\\n", "2016 S1A_IW_SLC__1SSV_20160525T020200_20160525T0202... ASCENDING \n", "2017 S1B_IW_SLC__1SDV_20170526T020118_20170526T0201... ASCENDING \n", "2018 S1B_IW_SLC__1SDV_20180521T020132_20180521T0201... ASCENDING \n", "2019 S1B_IW_SLC__1SDV_20190528T020139_20190528T0202... ASCENDING \n", "2020 S1B_IW_SLC__1SDV_20200522T020145_20200522T0202... ASCENDING \n", "2021 S1B_IW_SLC__1SDV_20210529T020151_20210529T0202... ASCENDING \n", "2022 S1A_IW_SLC__1SDV_20220530T020231_20220530T0202... ASCENDING \n", "2023 S1A_IW_SLC__1SDV_20230525T020236_20230525T0203... ASCENDING \n", "\n", " groupID ... processingDate \n", "startTime ... \n", "2015 S1A_IWSV_0152_0157_006159_137 ... 2015-05-31T02:01:41.000Z \\\n", "2016 S1A_IWSV_0155_0160_011409_137 ... 2016-05-25T02:02:00.000Z \n", "2017 S1B_IWDV_0153_0158_005763_137 ... 2017-05-26T02:01:18.000Z \n", "2018 S1B_IWDV_0154_0160_011013_137 ... 2018-05-21T02:01:32.000Z \n", "2019 S1B_IWDV_0154_0160_016438_137 ... 2019-05-28T02:01:39.000Z \n", "2020 S1B_IWDV_0155_0160_021688_137 ... 2020-05-22T02:01:45.000Z \n", "2021 S1B_IWDV_0154_0160_027113_137 ... 2021-05-29T02:01:51.000Z \n", "2022 S1A_IWDV_0152_0159_043434_137 ... 2022-05-30T02:02:31.000Z \n", "2023 S1A_IWDV_0152_0159_048684_137 ... 2023-05-25T02:02:36.000Z \n", "\n", " processingLevel sceneName \n", "startTime \n", "2015 SLC S1A_IW_SLC__1SSV_20150531T020141_20150531T0202... \\\n", "2016 SLC S1A_IW_SLC__1SSV_20160525T020200_20160525T0202... \n", "2017 SLC S1B_IW_SLC__1SDV_20170526T020118_20170526T0201... \n", "2018 SLC S1B_IW_SLC__1SDV_20180521T020132_20180521T0201... \n", "2019 SLC S1B_IW_SLC__1SDV_20190528T020139_20190528T0202... \n", "2020 SLC S1B_IW_SLC__1SDV_20200522T020145_20200522T0202... \n", "2021 SLC S1B_IW_SLC__1SDV_20210529T020151_20210529T0202... \n", "2022 SLC S1A_IW_SLC__1SDV_20220530T020231_20220530T0202... \n", "2023 SLC S1A_IW_SLC__1SDV_20230525T020236_20230525T0203... \n", "\n", " sensor startTime stopTime \n", "startTime \n", "2015 C-SAR 2015-05-31T02:01:41.000Z 2015-05-31T02:02:08.000Z \\\n", "2016 C-SAR 2016-05-25T02:02:00.000Z 2016-05-25T02:02:27.000Z \n", "2017 C-SAR 2017-05-26T02:01:18.000Z 2017-05-26T02:01:44.000Z \n", "2018 C-SAR 2018-05-21T02:01:32.000Z 2018-05-21T02:01:59.000Z \n", "2019 C-SAR 2019-05-28T02:01:39.000Z 2019-05-28T02:02:06.000Z \n", "2020 C-SAR 2020-05-22T02:01:45.000Z 2020-05-22T02:02:12.000Z \n", "2021 C-SAR 2021-05-29T02:01:51.000Z 2021-05-29T02:02:18.000Z \n", "2022 C-SAR 2022-05-30T02:02:31.000Z 2022-05-30T02:02:58.000Z \n", "2023 C-SAR 2023-05-25T02:02:36.000Z 2023-05-25T02:03:02.000Z \n", "\n", " url pgeVersion \n", "startTime \n", "2015 https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_... 002.72 \\\n", "2016 https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_... 002.71 \n", "2017 https://datapool.asf.alaska.edu/SLC/SB/S1B_IW_... 002.82 \n", "2018 https://datapool.asf.alaska.edu/SLC/SB/S1B_IW_... 002.90 \n", "2019 https://datapool.asf.alaska.edu/SLC/SB/S1B_IW_... 002.91 \n", "2020 https://datapool.asf.alaska.edu/SLC/SB/S1B_IW_... 003.20 \n", "2021 https://datapool.asf.alaska.edu/SLC/SB/S1B_IW_... 003.31 \n", "2022 https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_... 003.52 \n", "2023 https://datapool.asf.alaska.edu/SLC/SA/S1A_IW_... 003.61 \n", "\n", " fileName frameNumber \n", "startTime \n", "2015 S1A_IW_SLC__1SSV_20150531T020141_20150531T0202... 151 \n", "2016 S1A_IW_SLC__1SSV_20160525T020200_20160525T0202... 154 \n", "2017 S1B_IW_SLC__1SDV_20170526T020118_20170526T0201... 153 \n", "2018 S1B_IW_SLC__1SDV_20180521T020132_20180521T0201... 154 \n", "2019 S1B_IW_SLC__1SDV_20190528T020139_20190528T0202... 154 \n", "2020 S1B_IW_SLC__1SDV_20200522T020145_20200522T0202... 154 \n", "2021 S1B_IW_SLC__1SDV_20210529T020151_20210529T0202... 154 \n", "2022 S1A_IW_SLC__1SDV_20220530T020231_20220530T0202... 153 \n", "2023 S1A_IW_SLC__1SDV_20230525T020236_20230525T0203... 153 \n", "\n", "[9 rows x 29 columns]" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "subset" ] }, { "cell_type": "code", "execution_count": 12, "id": "6a232523-972c-469b-9ec9-a590d4412642", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ "" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "subset.reset_index(drop=True).set_crs(4326).explore(column='startTime', style_kwds=dict(fillOpacity=.3))" ] }, { "cell_type": "code", "execution_count": 13, "id": "2a0b3721-4c9b-43c9-b49c-feb4a2114a11", "metadata": {}, "outputs": [], "source": [ "# Get IPF version for each of these\n", "def get_ipf(sceneName):\n", " sat = sceneName[0]+sceneName[2]\n", " url = f'https://datapool.asf.alaska.edu/METADATA_SLC/{sat}/{sceneName}.iso.xml'\n", " #print(url)\n", " r = requests.get(url)\n", " \n", " IPF = re.search(r'\\(version(.*?)\\)',r.text).group(1).strip()\n", " \n", " return IPF" ] }, { "cell_type": "code", "execution_count": 14, "id": "048b03e7-57a3-435e-9bb2-c4893b155a4f", "metadata": {}, "outputs": [], "source": [ "subset['IPF'] = subset.sceneName.apply(get_ipf)" ] }, { "cell_type": "code", "execution_count": 15, "id": "67d39b4d-6c32-4693-bf2e-158d0a26e2a9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "startTime\n", "2015 002.72\n", "2016 002.71\n", "2017 002.82\n", "2018 002.90\n", "2019 002.91\n", "2020 003.20\n", "2021 003.31\n", "2022 003.52\n", "2023 003.61\n", "Name: IPF, dtype: object" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "subset.IPF" ] }, { "cell_type": "code", "execution_count": 16, "id": "5c2988d6-3b24-4d7c-aaac-5090f2639725", "metadata": {}, "outputs": [], "source": [ "# Only IPF>=3.4 has burstnumbers in the metadata, others require reverse-lookup based on TANX\n", "def get_metadata_xml(session, params, outfile=None):\n", " root = hb.download_metadata(session, params, outfile) \n", " \n", " return root\n", "\n", "def get_ipf(root):\n", " ''' for consolidated XML metadata get version '''\n", " ipfnode = root.find('.//safe:software', {'safe':'http://www.esa.int/safe/sentinel-1.0'})\n", " \n", " return ipfnode.attrib['version']\n", "\n", "\n", "def get_burstnumber(session, row, myburst, product_schema='./support/s1-level-1-product.xsd'):\n", " ''' given an ASF frame, determine relative burst number corresponding to standard esa burstid\n", " \n", " session = asf session from hyp3-isce2 \n", " row = geodataframe row of asf_search results\n", " myburst = geoseries for burst of interest\n", " \n", " Note: requires support/s1-level-1-product.xsd XML schema from SLC SAFE for parsing metadata\n", " '''\n", " params = hb.BurstParams(row.sceneName, myburst.subswath_name, row.polarization[:2], 1)\n", " \n", " # Get All XML metadata for SLC\n", " root = get_metadata_xml(session, params)\n", " IPF = get_ipf(root)\n", "\n", " # Extract correct section of xml\n", " for product in root.findall('.//product'):\n", " prod_pol = product.find('polarisation').text\n", " prod_swath = product.find('swath').text\n", " \n", " if (prod_pol == params.polarization) and (prod_swath == params.swath):\n", " node = product.find('content')\n", " node.tag = 'product'\n", " string = lxml.etree.tostring(node, encoding='unicode')\n", " \n", " # Convert to python dictionary\n", " xs = xmlschema.XMLSchema(product_schema)\n", " parsed = xs.to_dict(string, validation='lax')[0]\n", " \n", " if IPF >= '003.4':\n", " burstid = [t.get('burstId').get('$') for t in parsed['swathTiming']['burstList']['burst']]\n", " burstnum = burstid.index(myburst.burst_id)\n", " else:\n", " tanx = np.array([t['azimuthAnxTime'] for t in parsed['swathTiming']['burstList']['burst']])\n", " burstnum = np.argmin(np.abs(tanx - myburst.time_from_anx_sec))\n", " \n", " return burstnum" ] }, { "cell_type": "code", "execution_count": 17, "id": "b1f92345-7939-43f1-8515-3ae08e706b29", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
burst_idsubswath_namerelative_orbit_numbertime_from_anx_secorbit_passgeometry
4292399IW2137774.912738ASCENDINGMULTIPOLYGON Z (((-123.23149 47.51699 0.00000,...
\n", "
" ], "text/plain": [ " burst_id subswath_name relative_orbit_number time_from_anx_sec \n", "4 292399 IW2 137 774.912738 \\\n", "\n", " orbit_pass geometry \n", "4 ASCENDING MULTIPOLYGON Z (((-123.23149 47.51699 0.00000,... " ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "myburst # '137_IW2_292399'" ] }, { "cell_type": "code", "execution_count": 18, "id": "1e91c851-2df4-47b1-93cc-c827d436d15d", "metadata": {}, "outputs": [], "source": [ "asf_session = hb.get_asf_session()" ] }, { "cell_type": "code", "execution_count": 19, "id": "77bfc54d-1299-4dc1-bb26-75d55836b2b0", "metadata": {}, "outputs": [], "source": [ "# For small number of granules just iterate over pandas dataframe (slow but works)\n", "Bursts = []\n", "for i,row in subset.iterrows():\n", " num = get_burstnumber(asf_session, row, myburst.iloc[0])\n", " Bursts.append(num)" ] }, { "cell_type": "code", "execution_count": 20, "id": "be9e7f2c-483a-4b9e-bacb-bf635b2b3f07", "metadata": {}, "outputs": [], "source": [ "subset['burst'] = Bursts" ] }, { "cell_type": "code", "execution_count": 21, "id": "b56370b9-660d-49b0-a2a7-9730c48e80ab", "metadata": {}, "outputs": [], "source": [ "subset['date'] = gpd.pd.to_datetime(subset.startTime).dt.strftime('%Y%m%d')" ] }, { "cell_type": "code", "execution_count": 22, "id": "27359551-ff2f-48c3-9ec6-87e0c166a6bc", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
datesceneNameIPFburst
startTime
201520150531S1A_IW_SLC__1SSV_20150531T020141_20150531T020208_006159_008023_7F5E002.725
201620160525S1A_IW_SLC__1SSV_20160525T020200_20160525T020227_011409_01159A_9CE4002.710
201720170526S1B_IW_SLC__1SDV_20170526T020118_20170526T020144_005763_00A197_3444002.822
201820180521S1B_IW_SLC__1SDV_20180521T020132_20180521T020159_011013_0142CF_7C0D002.900
201920190528S1B_IW_SLC__1SDV_20190528T020139_20190528T020206_016438_01EF17_B76F002.910
202020200522S1B_IW_SLC__1SDV_20200522T020145_20200522T020212_021688_0292AF_50CF003.200
202120210529S1B_IW_SLC__1SDV_20210529T020151_20210529T020218_027113_033D24_B0C0003.310
202220220530S1A_IW_SLC__1SDV_20220530T020231_20220530T020258_043434_052FB9_BD0A003.522
202320230525S1A_IW_SLC__1SDV_20230525T020236_20230525T020302_048684_05DAF3_C204003.612
\n", "
" ], "text/plain": [ " date \n", "startTime \n", "2015 20150531 \\\n", "2016 20160525 \n", "2017 20170526 \n", "2018 20180521 \n", "2019 20190528 \n", "2020 20200522 \n", "2021 20210529 \n", "2022 20220530 \n", "2023 20230525 \n", "\n", " sceneName \n", "startTime \n", "2015 S1A_IW_SLC__1SSV_20150531T020141_20150531T020208_006159_008023_7F5E \\\n", "2016 S1A_IW_SLC__1SSV_20160525T020200_20160525T020227_011409_01159A_9CE4 \n", "2017 S1B_IW_SLC__1SDV_20170526T020118_20170526T020144_005763_00A197_3444 \n", "2018 S1B_IW_SLC__1SDV_20180521T020132_20180521T020159_011013_0142CF_7C0D \n", "2019 S1B_IW_SLC__1SDV_20190528T020139_20190528T020206_016438_01EF17_B76F \n", "2020 S1B_IW_SLC__1SDV_20200522T020145_20200522T020212_021688_0292AF_50CF \n", "2021 S1B_IW_SLC__1SDV_20210529T020151_20210529T020218_027113_033D24_B0C0 \n", "2022 S1A_IW_SLC__1SDV_20220530T020231_20220530T020258_043434_052FB9_BD0A \n", "2023 S1A_IW_SLC__1SDV_20230525T020236_20230525T020302_048684_05DAF3_C204 \n", "\n", " IPF burst \n", "startTime \n", "2015 002.72 5 \n", "2016 002.71 0 \n", "2017 002.82 2 \n", "2018 002.90 0 \n", "2019 002.91 0 \n", "2020 003.20 0 \n", "2021 003.31 0 \n", "2022 003.52 2 \n", "2023 003.61 2 " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "with gpd.pd.option_context('display.max_colwidth', None):\n", " display(subset.loc[:,['date','sceneName','IPF','burst']])" ] }, { "cell_type": "code", "execution_count": null, "id": "e26e0232-6087-4404-bbaf-04221a1332b4", "metadata": {}, "outputs": [], "source": [ "os.mkdir('ascending')\n", "\n", "for i in range(len(subset)-1):\n", " ref = subset.iloc[i]\n", " sec = subset.iloc[i+1]\n", " os.mkdir(f'ascending/{ref.date}_{sec.date}')\n", " \n", " cmd = f'''python -m hyp3_isce2 ++process insar_tops_burst --reference-scene {ref.sceneName} --secondary-scene {sec.sceneName} \\\n", " --swath-number 2 --polarization VV --reference-burst-number {ref.burst} --secondary-burst-number {sec.burst} --azimuth-looks 4 --range-looks 20\\n'''\n", " \n", " with open(f'ascending/{ref.date}_{sec.date}/cmd.txt', 'w') as f:\n", " f.write(cmd)" ] }, { "cell_type": "code", "execution_count": null, "id": "bc97be3f-b88f-440a-80e9-8570050ef6f9", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python [conda env:.local-hyp3-isce2]", "language": "python", "name": "conda-env-.local-hyp3-isce2-py" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.3" } }, "nbformat": 4, "nbformat_minor": 5 }