|
34 | 34 | "[**1. Download and Prepare Interferograms**](#prep_ifg)\n", |
35 | 35 | "- [1.1. Get Data List](#prep_data)\n", |
36 | 36 | "- [1.2. Download DEM](#prep_dem)\n", |
37 | | - "- [1.3. Load Data into MintPy](#prep_load_data)\n", |
| 37 | + "- [1.3. Create MintPy configuration file](#create_config)\n", |
| 38 | + "- [1.4. Load Data into MintPy](#prep_load_data)\n", |
38 | 39 | "\n", |
39 | 40 | "<hr/>" |
40 | 41 | ] |
|
85 | 86 | { |
86 | 87 | "cell_type": "code", |
87 | 88 | "execution_count": null, |
88 | | - "id": "8b464e26-d7a9-4834-bc77-da3968e90f57", |
| 89 | + "id": "18978e7b-b33d-4f6d-a38d-a87044275edb", |
89 | 90 | "metadata": {}, |
90 | 91 | "outputs": [], |
91 | 92 | "source": [ |
92 | 93 | "# === Basic Configuration ===\n", |
93 | | - "site = \"NISAR_ALOS1_Hawaii_0380\" # Cal/Val location ID\n", |
| 94 | + "site = \"Erta_Ale\" # Cal/Val location ID\n", |
94 | 95 | "requirement = \"Transient\" # Options: 'Secular', 'Coseismic', 'Transient'\n", |
95 | 96 | "dataset = \"NISAR_sample\" # Dataset type: 'NISAR_sample', 'ARIA_S1', 'ARIA_S1_new'\n", |
96 | 97 | "\n", |
97 | 98 | "\n", |
98 | | - "rundate = \"20251008\" # Date of this Cal/Val run\n", |
| 99 | + "rundate = \"20260205\" # Date of this Cal/Val run\n", |
99 | 100 | "version = \"1\" # Version of this Cal/Val run\n", |
100 | 101 | "custom_sites = \"/home/jovyan/my_sites.txt\" # Path to custom site metadata\n", |
101 | 102 | "\n", |
|
326 | 327 | "\n", |
327 | 328 | "out_dem = os.path.join(dem_dir, f\"{site}_elevation.dem\")\n", |
328 | 329 | "\n", |
329 | | - "cmd = [\n", |
330 | | - " \"sardem\",\n", |
331 | | - " \"--bbox\", *bbox,\n", |
332 | | - " \"--output\", out_dem,\n", |
333 | | - " \"--output-format\", \"ENVI\"\n", |
334 | | - "]\n", |
| 330 | + "if os.path.isfile(out_dem):\n", |
| 331 | + " print(f\"{out_dem} exists, skip downloading\")\n", |
| 332 | + "else:\n", |
| 333 | + " cmd = [\n", |
| 334 | + " \"sardem\",\n", |
| 335 | + " \"--bbox\", *bbox,\n", |
| 336 | + " \"--output\", out_dem,\n", |
| 337 | + " \"--output-format\", \"ENVI\"\n", |
| 338 | + " ]\n", |
| 339 | + " \n", |
| 340 | + " print(\"Running:\", \" \".join(cmd))\n", |
| 341 | + " try:\n", |
| 342 | + " res = subprocess.run(cmd, check=True, capture_output=True, text=True)\n", |
| 343 | + " if res.stdout:\n", |
| 344 | + " print(res.stdout)\n", |
| 345 | + " print(\"DEM files:\", os.listdir(dem_dir))\n", |
| 346 | + " except subprocess.CalledProcessError as e:\n", |
| 347 | + " print(\"sardem failed:\")\n", |
| 348 | + " print(e.stdout or \"\")\n", |
| 349 | + " print(e.stderr or \"\")\n", |
| 350 | + " raise" |
| 351 | + ] |
| 352 | + }, |
| 353 | + { |
| 354 | + "cell_type": "markdown", |
| 355 | + "id": "54c045a9-65ce-47ac-9fd3-d32d560667f8", |
| 356 | + "metadata": {}, |
| 357 | + "source": [ |
| 358 | + "### 1.3. Create MintPy configuration file <a id='create_config'></a>" |
| 359 | + ] |
| 360 | + }, |
| 361 | + { |
| 362 | + "cell_type": "code", |
| 363 | + "execution_count": null, |
| 364 | + "id": "c3817649-4966-4ab9-a213-27c6dddbfd00", |
| 365 | + "metadata": {}, |
| 366 | + "outputs": [], |
| 367 | + "source": [ |
| 368 | + "os.chdir(mintpy_dir)\n", |
335 | 369 | "\n", |
336 | | - "print(\"Running:\", \" \".join(cmd))\n", |
337 | | - "try:\n", |
338 | | - " res = subprocess.run(cmd, check=True, capture_output=True, text=True)\n", |
339 | | - " if res.stdout:\n", |
340 | | - " print(res.stdout)\n", |
341 | | - " print(\"DEM files:\", os.listdir(dem_dir))\n", |
342 | | - "except subprocess.CalledProcessError as e:\n", |
343 | | - " print(\"sardem failed:\")\n", |
344 | | - " print(e.stdout or \"\")\n", |
345 | | - " print(e.stderr or \"\")\n", |
346 | | - " raise" |
| 370 | + "# Build config as a dictionary first\n", |
| 371 | + "config_file_content = {\n", |
| 372 | + " \"mintpy.load.processor\": \"nisar\",\n", |
| 373 | + " \"mintpy.compute.cluster\": \"local\",\n", |
| 374 | + " \"mintpy.compute.numWorker\": \"auto\",\n", |
| 375 | + " \"mintpy.topographicResidual.pixelwiseGeometry\": \"no\",\n", |
| 376 | + " \"mintpy.troposphericDelay.method\": \"no\",\n", |
| 377 | + " \"mintpy.topographicResidual\": \"no\",\n", |
| 378 | + " \"mintpy.network.tempBaseMax\": site_info.get('tempBaseMax'),\n", |
| 379 | + " \"mintpy.network.startDate\": site_info.get('download_start_date'),\n", |
| 380 | + " \"mintpy.network.endDate\": site_info.get('download_end_date'),\n", |
| 381 | + " \"mintpy.velocity.startDate\": site_info.get('download_start_date'),\n", |
| 382 | + " \"mintpy.velocity.endDate\": site_info.get('download_end_date'),\n", |
| 383 | + " \"mintpy.reference.lalo\": site_info.get('reference_lalo'),\n", |
| 384 | + " \"mintpy.network.excludeDate12\": site_info.get('ifgExcludePair'),\n", |
| 385 | + " \"mintpy.network.excludeDate\" : site_info.get('ifgExcludeDate'),\n", |
| 386 | + " \"mintpy.network.excludeIfgIndex\" : site_info.get('ifgExcludeIndex'),\n", |
| 387 | + "}\n", |
| 388 | + "\n", |
| 389 | + "# Write config dictionary to text file\n", |
| 390 | + "with open(config_file, \"w\") as f:\n", |
| 391 | + " f.writelines(f\"{k} = {v}\\n\" for k, v in config_file_content.items())\n", |
| 392 | + "\n", |
| 393 | + "# Confirm output\n", |
| 394 | + "print(f\"MintPy config file written to:\\n {config_file}\\n\")\n", |
| 395 | + "with open(config_file, \"r\") as f:\n", |
| 396 | + " print(f.read())\n" |
347 | 397 | ] |
348 | 398 | }, |
349 | 399 | { |
350 | 400 | "cell_type": "markdown", |
351 | 401 | "id": "0de4a38e-60f3-421b-949f-aff1145e5881", |
352 | 402 | "metadata": {}, |
353 | 403 | "source": [ |
354 | | - "### 1.3. Load Data into MintPy Cubes <a id='prep_load_data'></a>\n", |
| 404 | + "### 1.4. Load Data into MintPy Cubes <a id='prep_load_data'></a>\n", |
355 | 405 | "\n", |
356 | 406 | "The output of this step is an \"inputs\" directory in 'calval_directory/calval_location/MintPy/\" containing three HDF5 files:\n", |
357 | | - "- ifgramStack.h5: This file contains 6 dataset cubes (e.g. unwrapped phase, coherence, connected components etc.) and multiple metadata\n", |
358 | | - "- geometryGeo.h5: This file contains geometrical datasets (e.g., incidence/azimuth angle, masks, etc.)\n", |
359 | | - "- ionStack.h5 : This file contains pairwise ionosphere data present in the NISAR data " |
| 407 | + "- ifgramStack.h5: Contains 6 dataset cubes (e.g. unwrapped phase, coherence, connected components etc.) and multiple metadata.\n", |
| 408 | + "- geometryGeo.h5: Contains geometrical datasets (e.g., incidence/azimuth angle, masks, etc.).\n", |
| 409 | + "- ionStack.h5 : Contains pairwise ionosphere data present in the NISAR L2 GUNW.\n", |
| 410 | + "- tropoStack.h5 : Contains 3D interpolated total tropospheric delay calculated from NISAR radar grid tropospheric delay layers." |
360 | 411 | ] |
361 | 412 | }, |
362 | 413 | { |
|
389 | 440 | "name": "python", |
390 | 441 | "nbconvert_exporter": "python", |
391 | 442 | "pygments_lexer": "ipython3", |
392 | | - "version": "3.13.7" |
| 443 | + "version": "3.14.3" |
393 | 444 | } |
394 | 445 | }, |
395 | 446 | "nbformat": 4, |
|
0 commit comments