Skip to content

Commit 73ec455

Browse files
authored
Merge pull request #3 from ShashankBice/compatibility_changes
Compatibility changes
2 parents 50fd143 + 4d520dd commit 73ec455

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

vmap/disp2v.py

+10-7
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,13 @@ def main():
158158
offset_str = ''
159159
if remove_offsets:
160160
if mask_fn is None:
161-
from demcoreg.dem_mask import get_lulc_mask
161+
from demcoreg.dem_mask import get_mask
162162
print("\nUsing demcoreg to prepare mask of stable control surfaces\n")
163-
mask = get_lulc_mask(src_ds, mask_glaciers=True, filter='rock+ice+water')
163+
#TODO: Accept mask_list as in demcoreg
164+
#mask_list = args.mask_list
165+
# for now keep it simple, limit to non-glacier surfaces
166+
mask_list = ['glaciers',]
167+
mask = get_mask(src_ds, mask_list=mask_list, dem_fn=src_fn)
164168
else:
165169
print("\nWarping input raster mask")
166170
#This can be from previous dem_mask.py run (e.g. *rockmask.tif)
@@ -177,11 +181,10 @@ def main():
177181

178182
print("\nRemoving median x and y offset over static control surfaces")
179183
h_myr_count = h_myr.count()
180-
h_myr_static_count = h_myr[mask].count()
181-
h_myr_med = malib.fast_median(h_myr[mask])
182-
v_myr_med = malib.fast_median(v_myr[mask])
183-
h_myr_mad = malib.mad(h_myr[mask])
184-
v_myr_mad = malib.mad(v_myr[mask])
184+
h_myr_static_count = np.ma.array(h_myr,mask=mask).count()
185+
h_myr_mad,h_myr_med = malib.mad(np.ma.array(h_myr,mask=mask),return_med=True)
186+
v_myr_mad,v_myr_med = malib.mad(np.ma.array(v_myr,mask=mask),return_med=True)
187+
185188
print("Static pixel count: %i (%0.1f%%)" % (h_myr_static_count, 100*float(h_myr_static_count)/h_myr_count))
186189
print("median (+/-NMAD)")
187190
print("x velocity offset: %0.2f (+/-%0.2f) m/%s" % (h_myr_med, h_myr_mad, t_unit))

vmap/vmap.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ def get_stereo_opt(threads=28, kernel=(35,35), nlevels=5, spr=1, timeout=360, er
6565
#If using Semi-global matching (spr 0):
6666
if spr > 3:
6767
#Use SGM
68-
stereo_opt.extend(['--stereo-algorithm', '1'])
68+
stereo_opt.extend(['--stereo-algorithm', 'asp_sgm'])
6969
#Use MGM
70-
#stereo_opt.extend(['--stereo-algorithm', '2'])
70+
#stereo_opt.extend(['--stereo-algorithm', 'asp_mgm'])
7171
#bro nodes had 128 GB of RAM, 28 threads, ~4.7 GB/thread
7272
stereo_opt.extend(['--corr-tile-size', '3600'])
7373
stereo_opt.extend(['--xcorr-threshold', '-1'])
@@ -77,6 +77,7 @@ def get_stereo_opt(threads=28, kernel=(35,35), nlevels=5, spr=1, timeout=360, er
7777
#Sub-pixel kernel size (ASP default is 35)
7878
#Set to same as integer correlator kernel
7979
stereo_opt.extend(['--subpixel-kernel', str(kernel[0]), str(kernel[1])])
80+
stereo_opt.extend(['--stereo-algorithm','asp_bm'])
8081
#Note: stereo_fltr throws out a lot of good data when noisy
8182
#Want to play with the following options
8283
#--rm-half-kernel 5 5
@@ -340,9 +341,9 @@ def main():
340341
#Check for existence
341342

342343
#HMA seeding
343-
vdir = '/nobackup/deshean/rpcdem/hma/velocity_jpl_amaury_2013-2015'
344-
vx_fn = os.path.join(vdir, 'PKH_WRS2_B8_2013_2015_snr5_n1_r170_res12.x_vel.TIF')
345-
vy_fn = os.path.join(vdir, 'PKH_WRS2_B8_2013_2015_snr5_n1_r170_res12.y_vel.TIF')
344+
#vdir = '/nobackup/deshean/rpcdem/hma/velocity_jpl_amaury_2013-2015'
345+
#vx_fn = os.path.join(vdir, 'PKH_WRS2_B8_2013_2015_snr5_n1_r170_res12.x_vel.TIF')
346+
#vy_fn = os.path.join(vdir, 'PKH_WRS2_B8_2013_2015_snr5_n1_r170_res12.y_vel.TIF')
346347

347348
if os.path.exists(vx_fn) and os.path.exists(vy_fn):
348349
ds1_clip = iolib.fn_getds(ds1_clip_fn)

0 commit comments

Comments
 (0)