Skip to content

Commit

Permalink
update the template variable names
Browse files Browse the repository at this point in the history
+ mintpy.multilook.
suggested from insarlab#797 (comment)

+ bugfix of size in creating ionosphere dataset in stackDict.py
  • Loading branch information
yuankailiu authored and yunjunz committed Jun 21, 2022
1 parent a1ad104 commit 43da04b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
6 changes: 3 additions & 3 deletions mintpy/defaults/smallbaselineApp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ mintpy.load.waterMaskFile = auto #[path of water mask file], optional but re
mintpy.load.bperpFile = auto #[path pattern of 2D perpendicular baseline file], optional
##---------multilook (optional):
## multilook while loading data with nearest interpolation, to reduce dataset size
mintpy.load.ystep = auto #[int >= 1], auto for 1 - no multilooking
mintpy.load.xstep = auto #[int >= 1], auto for 1 - no multilooking
mintpy.load.stepMethod = auto #[nearest, mean, median], auto for nearest - lines/rows skipping approach
mintpy.multilook.ystep = auto #[int >= 1], auto for 1 - no multilooking
mintpy.multilook.xstep = auto #[int >= 1], auto for 1 - no multilooking
mintpy.multilook.method = auto #[nearest, mean, median], auto for nearest - lines/rows skipping approach
##---------subset (optional):
## if both yx and lalo are specified, use lalo option unless a) no lookup file AND b) dataset is in radar coord
mintpy.subset.yx = auto #[y0:y1,x0:x1 / no], auto for no
Expand Down
6 changes: 3 additions & 3 deletions mintpy/defaults/smallbaselineApp_auto.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ mintpy.load.autoPath = no
mintpy.load.updateMode = yes
mintpy.load.compression = no
##---------multilook (optional):
mintpy.load.ystep = 1
mintpy.load.xstep = 1
mintpy.load.stepMethod = nearest
mintpy.multilook.ystep = 1
mintpy.multilook.xstep = 1
mintpy.multilook.method = nearest
##-------subset (optional)
mintpy.subset.yx = no
mintpy.subset.lalo = no
Expand Down
21 changes: 13 additions & 8 deletions mintpy/load_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,25 @@ def read_inps2dict(inps):
key_list = [i.split(prefix)[1] for i in template.keys() if i.startswith(prefix)]
for key in key_list:
value = template[prefix+key]
if key in ['processor', 'autoPath', 'updateMode', 'compression', 'stepMethod']:
if key in ['processor', 'autoPath', 'updateMode', 'compression']:
iDict[key] = template[prefix+key]
elif key in ['xstep', 'ystep']:
iDict[key] = int(template[prefix+key])
elif value:
iDict[prefix+key] = template[prefix+key]
print('processor : {}'.format(iDict['processor']))

if iDict['compression'] == False:
iDict['compression'] = None

iDict['xstep'] = iDict.get('xstep', 1)
iDict['ystep'] = iDict.get('ystep', 1)
iDict['stepMethod'] = iDict.get('stepMethod', 'nearest')
prefix = 'mintpy.multilook.'
key_list = [i.split(prefix)[1] for i in template.keys() if i.startswith(prefix)]
for key in key_list:
value = template[prefix+key]
if key in ['xstep', 'ystep', 'method']:
iDict[key] = template[prefix+key]

iDict['xstep'] = int(iDict.get('xstep', 1))
iDict['ystep'] = int(iDict.get('ystep', 1))
iDict['method'] = str(iDict.get('method', 'nearest'))

# PROJECT_NAME --> PLATFORM
if not iDict['PROJECT_NAME']:
Expand Down Expand Up @@ -896,7 +901,7 @@ def main(iargs=None):
print('-'*50)
print('updateMode : {}'.format(iDict['updateMode']))
print('compression: {}'.format(iDict['compression']))
print('x/ystep: {}/{}; multilook method: {}'.format(iDict['xstep'], iDict['ystep'], iDict['stepMethod']))
print('x/ystep: {}/{}; multilook method: {}'.format(iDict['xstep'], iDict['ystep'], iDict['method']))
kwargs = dict(updateMode=iDict['updateMode'], xstep=iDict['xstep'], ystep=iDict['ystep'])

# read subset info [need the metadata from above]
Expand Down Expand Up @@ -958,7 +963,7 @@ def main(iargs=None):
box=iDict['box'],
xstep=iDict['xstep'],
ystep=iDict['ystep'],
ystep=iDict['stepMethod'],
method=iDict['method'],
compression=iDict['compression'],
extra_metadata=extraDict,
geom_obj=geom_obj)
Expand Down
8 changes: 4 additions & 4 deletions mintpy/objects/stackDict.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def write2hdf5(self, outputFile='ifgramStack.h5', access_mode='w', box=None, xst
msg += f' --> resize from {in_size} to {geom_size} via skimage.transform.resize ...'
print(msg)
resize2shape = geom_size
length, width = geom_size
length, width = geom_size[0]/ystep, geom_size[1]/xstep,

self.outputFile = outputFile
with h5py.File(self.outputFile, access_mode) as f:
Expand All @@ -151,9 +151,9 @@ def write2hdf5(self, outputFile='ifgramStack.h5', access_mode='w', box=None, xst
if dsName in ['connectComponent']:
dsDataType = np.int16
dsCompression = 'lzf'
stepMethod = 'nearest'
mlk_method = 'nearest'
else:
stepMethod = str(method)
mlk_method = str(method)

print(('create dataset /{d:<{w}} of {t:<25} in size of {s}'
' with compression = {c}').format(d=dsName,
Expand Down Expand Up @@ -183,7 +183,7 @@ def write2hdf5(self, outputFile='ifgramStack.h5', access_mode='w', box=None, xst
box=box,
xstep=xstep,
ystep=ystep,
method=stepMethod,
method=mlk_method,
resize2shape=resize2shape)[0]

# special handling for offset covariance file
Expand Down

0 comments on commit 43da04b

Please sign in to comment.