Skip to content

Commit fdc8259

Browse files
author
rzinke
committed
Checks for auto reference point. Checks for correction specification. Meters/mm error fixed.
1 parent a5b354d commit fdc8259

File tree

2 files changed

+49
-39
lines changed

2 files changed

+49
-39
lines changed

methods/coseismic/Coseismic_Requirement_Validation.ipynb

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
"aria_gunw_version = \"3_0_1\"\n",
148148
"\n",
149149
"rundate = \"20250508\" # Date of this Cal/Val run\n",
150-
"version = \"1\" # Version of this Cal/Val run\n",
150+
"version = \"1c\" # Version of this Cal/Val run\n",
151151
"custom_sites = \"/home/jovyan/my_sites.txt\" # Path to custom site metadata\n",
152152
"\n",
153153
"# === Username Detection / Creation ===\n",
@@ -356,20 +356,14 @@
356356
"metadata": {},
357357
"outputs": [],
358358
"source": [
359-
"new_lat = sitedata['sites'][site]['reference_lalo'].strip().split()[0]\n",
360-
"new_lon = sitedata['sites'][site]['reference_lalo'].strip().split()[1]\n",
361-
"update_reference_point(config_file, new_lat, new_lon) # New latitude and longitude"
362-
]
363-
},
364-
{
365-
"cell_type": "code",
366-
"execution_count": null,
367-
"metadata": {},
368-
"outputs": [],
369-
"source": [
370-
"command = 'smallbaselineApp.py ' + str(config_file) + ' --dostep reference_point'\n",
371-
"process = subprocess.run(command, shell=True)\n",
372-
"os.system('info.py inputs/ifgramStack.h5 | egrep \"REF_\"');"
359+
"if sitedata['sites'][site]['reference_lalo'].strip() != 'auto':\n",
360+
" new_lat = sitedata['sites'][site]['reference_lalo'].strip().split()[0]\n",
361+
" new_lon = sitedata['sites'][site]['reference_lalo'].strip().split()[1]\n",
362+
" update_reference_point(config_file, new_lat, new_lon) # New latitude and longitude\n",
363+
"\n",
364+
" command = 'smallbaselineApp.py ' + str(config_file) + ' --dostep reference_point'\n",
365+
" process = subprocess.run(command, shell=True)\n",
366+
" os.system('info.py inputs/ifgramStack.h5 | egrep \"REF_\"');"
373367
]
374368
},
375369
{
@@ -453,14 +447,15 @@
453447
"metadata": {},
454448
"outputs": [],
455449
"source": [
456-
"if site_info.get('do_SET') != \"False\":\n",
450+
"if 'do_SET' in site_info.keys() and site_info.get('do_SET') != \"False\":\n",
457451
" set_cor_file = f\"{mintpy_dir}/inputs/solidEarthTide_ARIA.h5\" # Input SET correction file\n",
458452
"\n",
459453
" dirpath, filename = os.path.split(timeseries_filename)\n",
460454
" name, ext = os.path.splitext(filename)\n",
461455
" output_timeseries = os.path.join(dirpath, f\"{name}_SET{ext}\")\n",
462456
" output_velocity = os.path.join(dirpath, f\"velocity.h5\")\n",
463-
"else: \n",
457+
"else:\n",
458+
" site_info['do_SET'] = \"False\"\n",
464459
" print('#'*10, 'Solid Earth Tide Correction set to False', '#'*10)"
465460
]
466461
},
@@ -486,9 +481,10 @@
486481
"outputs": [],
487482
"source": [
488483
"# Visualize the corrections\n",
489-
"if site_info.get('do_SET') != \"False\":\n",
484+
"if 'do_SET' in site_info.keys() and site_info.get('do_SET') != \"False\":\n",
490485
" view.main([set_cor_file, '-m', msk_file])\n",
491-
"else: \n",
486+
"else:\n",
487+
" site_info['do_SET'] = \"False\"\n",
492488
" print('#'*10, 'Solid Earth Tide Correction set to False', '#'*10)"
493489
]
494490
},
@@ -505,14 +501,15 @@
505501
"metadata": {},
506502
"outputs": [],
507503
"source": [
508-
"if site_info.get('do_iono') != \"False\":\n",
504+
"if 'do_iono' in site_info.keys() and site_info.get('do_iono') != \"False\":\n",
509505
" iono_stack_file = f\"{mintpy_dir}/inputs/ionStack.h5\" # Input ionosphere stack file \n",
510506
"\n",
511507
" dirpath, filename = os.path.split(timeseries_filename)\n",
512508
" name, ext = os.path.splitext(filename)\n",
513509
" output_timeseries = os.path.join(dirpath, f\"{name}_iono{ext}\")\n",
514510
" output_velocity = os.path.join(dirpath, f\"velocity.h5\")\n",
515-
"else: \n",
511+
"else:\n",
512+
" site_info['do_iono'] = \"False\"\n",
516513
" print('#'*10, 'Ionosphere Correction set to False', '#'*10)"
517514
]
518515
},
@@ -573,7 +570,7 @@
573570
},
574571
"outputs": [],
575572
"source": [
576-
"if site_info.get(\"do_tropo\") != \"False\":\n",
573+
"if 'do_tropo' in site_info.keys() and site_info.get(\"do_tropo\") != \"False\":\n",
577574
" \n",
578575
" if site_info.get(\"tropo_model\") != \"HRRR\":\n",
579576
" # Run ERA5-based correction\n",
@@ -612,6 +609,7 @@
612609
" output_vel=output_velocity\n",
613610
" )\n",
614611
"else:\n",
612+
" site_info['do_tropo'] = \"False\"\n",
615613
" print(\"#\" * 10, \"Troposphere Correction set to False\", \"#\" * 10)\n"
616614
]
617615
},
@@ -909,8 +907,7 @@
909907
"source": [
910908
"scp_args = f\"velocity.h5 step{sitedata['sites'][site]['earthquakeDate']} -v {vmin} {vmax} --colormap RdBu --unit mm --figtitle LOS_Coseismic\"\n",
911909
"view.main(scp_args.split())\n",
912-
"#scp_args = f\"velocity.h5 velocity -v {vmin/2} {vmax/2} --colormap RdBu --unit mm/yr --figtitle LOS_Velocity\"\n",
913-
"scp_args = f\"velocity.h5 velocity -v -100 100 --colormap RdBu --unit mm/yr --figtitle LOS_Velocity\"\n",
910+
"scp_args = f\"velocity.h5 velocity -v {vmin/2} {vmax/2} --colormap RdBu --unit mm/yr --figtitle LOS_Velocity\"\n",
914911
"view.main(scp_args.split())"
915912
]
916913
},
@@ -1893,6 +1890,7 @@
18931890
"\n",
18941891
"# Read the time-series file\n",
18951892
"insar_ts, ts_metadata = readfile.read(ts_file, datasetName='timeseries')\n",
1893+
"insar_ts *= 1000 # meter to mm\n",
18961894
"mask = readfile.read(os.path.join(mintpy_dir, 'maskTempCoh.h5'))[0]\n",
18971895
"print(f\"reading timeseries from file: {ts_file}\")\n",
18981896
"\n",
@@ -1951,15 +1949,22 @@
19511949
" if gnss_dis.size > 0 and np.any(~np.isnan(insar_dis)):\n",
19521950
" fig, ax = plt.subplots(figsize=(10, 3))\n",
19531951
" ax.axhline(color='grey',linestyle='dashed', linewidth=2)\n",
1954-
" ax.scatter(gnss_dates, gnss_dis*1000, s=2**2, label=\"GNSS Daily Positions\")\n",
1955-
" ax.scatter(insar_dates, insar_dis*1000, label=\"InSAR Positions\")\n",
1952+
" ax.scatter(gnss_dates, gnss_dis, s=2**2, label=\"GNSS Daily Positions\")\n",
1953+
" ax.scatter(insar_dates, insar_dis, label=\"InSAR Positions\")\n",
19561954
" # axis format\n",
19571955
" ax.set_title(f\"Station Name: {site_name}\") \n",
19581956
" ax.set_ylabel('LOS displacement [mm]')\n",
19591957
" ax.legend()\n",
19601958
"prog_bar.close()\n",
19611959
"plt.show()"
19621960
]
1961+
},
1962+
{
1963+
"cell_type": "code",
1964+
"execution_count": null,
1965+
"metadata": {},
1966+
"outputs": [],
1967+
"source": []
19631968
}
19641969
],
19651970
"metadata": {

methods/secular/Secular_Requirement_Validation.ipynb

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
"aria_gunw_version = \"3_0_1\"\n",
151151
"\n",
152152
"rundate = \"20250508\" # Date of this Cal/Val run\n",
153-
"version = \"1\" # Version of this Cal/Val run\n",
153+
"version = \"1c\" # Version of this Cal/Val run\n",
154154
"custom_sites = \"/home/jovyan/my_sites.txt\" # Path to custom site metadata\n",
155155
"\n",
156156
"# === Username Detection / Creation ===\n",
@@ -327,11 +327,12 @@
327327
},
328328
"outputs": [],
329329
"source": [
330-
"# Check the reference point in the my_sites file, to see if it has changed\n",
331-
"new_lat = sitedata['sites'][site]['reference_lalo'].strip().split()[0]\n",
332-
"new_lon = sitedata['sites'][site]['reference_lalo'].strip().split()[1]\n",
333-
"update_reference_point(config_file, new_lat, new_lon) # New latitude and longitude\n",
334-
"\n",
330+
"if sitedata['sites'][site]['reference_lalo'].strip() != 'auto':\n",
331+
" # Check the reference point in the my_sites file, to see if it has changed\n",
332+
" new_lat = sitedata['sites'][site]['reference_lalo'].strip().split()[0]\n",
333+
" new_lon = sitedata['sites'][site]['reference_lalo'].strip().split()[1]\n",
334+
" update_reference_point(config_file, new_lat, new_lon) # New latitude and longitude\n",
335+
" \n",
335336
"# Now reference interferograms to common lat/lon\n",
336337
"command = 'smallbaselineApp.py ' + str(config_file) + ' --dostep reference_point'\n",
337338
"process = subprocess.run(command, shell=True)\n",
@@ -423,7 +424,7 @@
423424
"metadata": {},
424425
"outputs": [],
425426
"source": [
426-
"if site_info.get('do_SET') != \"False\":\n",
427+
"if 'do_SET' in site_info.keys() and site_info.get('do_SET') != \"False\":\n",
427428
" set_cor_file = f\"{mintpy_dir}/inputs/solidEarthTide_ARIA.h5\" # Input SET correction file\n",
428429
"\n",
429430
" dirpath, filename = os.path.split(timeseries_filename)\n",
@@ -434,6 +435,7 @@
434435
" name, ext = os.path.splitext(filename)\n",
435436
" output_velocity = os.path.join(dirpath, f\"{name}_SET{ext}\")\n",
436437
"else: \n",
438+
" site_info['do_SET'] = \"False\"\n",
437439
" print('#'*10, 'Solid Earth Tide Correction set to False', '#'*10)"
438440
]
439441
},
@@ -489,7 +491,7 @@
489491
"metadata": {},
490492
"outputs": [],
491493
"source": [
492-
"if site_info.get('do_iono') != \"False\":\n",
494+
"if 'do_iono' in site_info.keys() and site_info.get('do_iono') != \"False\":\n",
493495
" iono_stack_file = f\"{mintpy_dir}/inputs/ionStack.h5\" # Input ionosphere stack file \n",
494496
"\n",
495497
" dirpath, filename = os.path.split(timeseries_filename)\n",
@@ -499,7 +501,8 @@
499501
" dirpath, filename = os.path.split(velocity_filename)\n",
500502
" name, ext = os.path.splitext(filename)\n",
501503
" output_velocity = os.path.join(dirpath, f\"{name}_iono{ext}\")\n",
502-
"else: \n",
504+
"else:\n",
505+
" site_info['do_iono'] = \"False\"\n",
503506
" print('#'*10, 'Ionosphere Correction set to False', '#'*10)"
504507
]
505508
},
@@ -567,7 +570,7 @@
567570
"metadata": {},
568571
"outputs": [],
569572
"source": [
570-
"if site_info.get(\"do_tropo\") != \"False\":\n",
573+
"if 'do_tropo' in site_info.keys() and site_info.get(\"do_tropo\") != \"False\":\n",
571574
" \n",
572575
" if site_info.get(\"tropo_model\") != \"HRRR\":\n",
573576
" # Run ERA5-based correction\n",
@@ -611,6 +614,7 @@
611614
" output_vel=output_velocity\n",
612615
" )\n",
613616
"else:\n",
617+
" site_info['do_tropo'] = \"False\"\n",
614618
" print(\"#\" * 10, \"Troposphere Correction set to False\", \"#\" * 10)\n"
615619
]
616620
},
@@ -1712,6 +1716,7 @@
17121716
"\n",
17131717
"# Read the time-series file\n",
17141718
"insar_ts, ts_metadata = readfile.read(ts_file, datasetName='timeseries')\n",
1719+
"insar_ts *= 1000 # meter to mm\n",
17151720
"mask = readfile.read(os.path.join(mintpy_dir, 'maskTempCoh.h5'))[0]\n",
17161721
"print(f\"reading timeseries from file: {ts_file}\")\n",
17171722
"\n",
@@ -1723,7 +1728,7 @@
17231728
"\n",
17241729
"# Spatial reference\n",
17251730
"coord = ut.coordinate(ts_metadata)\n",
1726-
"ref_site = sitedata['sites'][site]['gps_ref_site_name']\n",
1731+
"# ref_site = sitedata['sites'][site]['gps_ref_site_name']\n",
17271732
"ref_gnss_obj = gnss_stns[ref_site]\n",
17281733
"ref_lat, ref_lon = ref_gnss_obj.get_site_lat_lon()\n",
17291734
"ref_y, ref_x = coord.geo2radar(ref_lat, ref_lon)[:2]\n",
@@ -1768,8 +1773,8 @@
17681773
" if gnss_dis.size > 0 and np.any(~np.isnan(insar_dis)):\n",
17691774
" fig, ax = plt.subplots(figsize=(10, 3))\n",
17701775
" ax.axhline(color='grey',linestyle='dashed', linewidth=2)\n",
1771-
" ax.scatter(gnss_dates, gnss_dis*1000, s=2**2, label=\"GNSS Daily Positions\")\n",
1772-
" ax.scatter(insar_dates, insar_dis*1000, label=\"InSAR Positions\")\n",
1776+
" ax.scatter(gnss_dates, gnss_dis, s=2**2, label=\"GNSS Daily Positions\")\n",
1777+
" ax.scatter(insar_dates, insar_dis, label=\"InSAR Positions\")\n",
17731778
" # axis format\n",
17741779
" ax.set_title(f\"Station Name: {site_name}\") \n",
17751780
" ax.set_ylabel('LOS displacement [mm]')\n",

0 commit comments

Comments
 (0)