Skip to content

Commit

Permalink
wrap up for version 1.4.0 (#824)
Browse files Browse the repository at this point in the history
+ version: add release tag for v1.4.0

+ bulk_plate_motion: add ITRF2014_PMM global var for convenience and future options with PMM model name and plate name, instead of typing detailed values manually.

+ geocode.py: add checking for the imcompatible options between "--geo2radar" and "--bbox / --software scipy"

+ subset: replace try/except with if/else for more robustness

+ arg_group: add --title / --fig-title for --figtitle option as alternatives
  • Loading branch information
yunjunz authored Aug 4, 2022
1 parent 537c4ef commit 68cdbbe
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 11 deletions.
22 changes: 22 additions & 0 deletions mintpy/bulk_plate_motion.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import os
import sys
import collections
import numpy as np
from skimage.transform import resize

Expand All @@ -42,6 +43,27 @@
raise ImportError(msg)


# ITRF2014-PMM defined in Altamimi et al. (2017)
# units:
# omega_x/y/z in mas/yr (milli-second of arc per year)
# omega in deg/Ma (degree per megayear or one-million-year)
# wrms_e/n in mm/yr (milli-meter per year), WRMS: weighted root mean scatter
Tag = collections.namedtuple('Tag', 'name num_site omega_x omega_y omega_z omega wrms_e wrms_n')
ITRF2014_PMM = {
'ANTA' : Tag('Antartica' , 7, -0.248, -0.324, 0.675, 0.219, 0.20, 0.16),
'ARAB' : Tag('Arabia' , 5, 1.154, -0.136, 1.444, 0.515, 0.36, 0.43),
'AUST' : Tag('Australia' , 36, 1.510, 1.182, 1.215, 0.631, 0.24, 0.20),
'EURA' : Tag('Eurasia' , 97, -0.085, -0.531, 0.770, 0.261, 0.23, 0.19),
'INDI' : Tag('India' , 3, 1.154, -0.005, 1.454, 0.516, 0.21, 0.21),
'NAZC' : Tag('Nazca' , 2, -0.333, -1.544, 1.623, 0.629, 0.13, 0.19),
'NOAM' : Tag('N. America' , 72, 0.024, -0.694, -0.063, 0.194, 0.23, 0.28),
'NUBI' : Tag('Nubia' , 24, 0.099, -0.614, 0.733, 0.267, 0.28, 0.36),
'PCFC' : Tag('Pacific' , 18, -0.409, 1.047, -2.169, 0.679, 0.36, 0.31),
'SOAM' : Tag('S. America' , 30, -0.270, -0.301, -0.140, 0.119, 0.34, 0.35),
'SOMA' : Tag('Somalia' , 3, -0.121, -0.794, 0.884, 0.332, 0.32, 0.30),
}



######################################### Usage ##############################################
REFERENCE = """reference:
Expand Down
15 changes: 13 additions & 2 deletions mintpy/geocode.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,26 @@ def _check_inps(inps):
# 2. lookup table is in radar coordinates
if inps.laloStep:
if not inps.radar2geo:
print('ERROR: --lalo-step can NOT be used together with --geo2radar!')
print('ERROR: "--lalo-step" can NOT be used together with "--geo2radar"!')
sys.exit(0)
atr = readfile.read_attribute(inps.lookupFile)
if 'Y_FIRST' in atr.keys():
print('ERROR: --lalo-step can NOT be used with lookup table file in geo-coordinates!')
print('ERROR: "--lalo-step" can NOT be used with lookup table file in geo-coordinates!')
sys.exit(0)

# check 5 - number of processors for multiprocessingg
inps.nprocs = check_num_processor(inps.nprocs)


# check 6 - geo2radar
if not inps.radar2geo:
if inps.SNWE:
print('ERROR: "--geo2radar" can NOT be used together with "--bbox"!')
sys.exit(0)
if inps.software == 'scipy':
print('ERROR: "--geo2radar" is NOT supported for "--software scipy"!')
sys.exit(0)

return inps


Expand Down
18 changes: 10 additions & 8 deletions mintpy/subset.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,26 @@ def get_coverage_box(atr):
width = int(atr['WIDTH'])

# Get geo box
try:
if all(x in atr.keys() for x in ['Y_STEP', 'X_STEP', 'Y_FIRST', 'X_FIRST']):
lat_step = float(atr['Y_STEP'])
lon_step = float(atr['X_STEP'])
ul_lat = float(atr['Y_FIRST'])
ul_lon = float(atr['X_FIRST'])
lr_lat = ul_lat + lat_step*length
lr_lon = ul_lon + lon_step*width
geo_box = (ul_lon, ul_lat, lr_lon, lr_lat)
except ValueError:
else:
geo_box = None

# Get pixel box
try:
pix_box = (int(atr['SUBSET_XMIN']),
int(atr['SUBSET_YMIN']),
int(atr['SUBSET_XMAX']),
int(atr['SUBSET_YMAX']))
except ValueError:
if all(f'SUBSET_{x}' in atr.keys() for x in ['YMIN', 'XMIN', 'YMAX', 'XMAX']):
pix_box = (
int(atr['SUBSET_XMIN']),
int(atr['SUBSET_YMIN']),
int(atr['SUBSET_XMAX']),
int(atr['SUBSET_YMAX']),
)
else:
pix_box = None

return pix_box, geo_box
Expand Down
2 changes: 1 addition & 1 deletion mintpy/utils/arg_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def add_figure_argument(parser):
action='store_false', help='do not display title')
fig.add_argument('--title-in', dest='fig_title_in',
action='store_true', help='draw title in/out of axes')
fig.add_argument('--figtitle', dest='fig_title',
fig.add_argument('--title','--fig-title','--figtitle', dest='fig_title',
help='Title shown in the figure.')
fig.add_argument('--title4sen','--title4sentinel1', dest='disp_title4sentinel1', action='store_true',
help='display Sentinel-1 A/B and IPF info in title.')
Expand Down
1 change: 1 addition & 0 deletions mintpy/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
###########################################################################
Tag = collections.namedtuple('Tag', 'version date')
release_history = (
Tag('1.4.0', '2022-08-04'),
Tag('1.3.3', '2022-04-14'),
Tag('1.3.2', '2021-11-21'),
Tag('1.3.1', '2021-08-02'),
Expand Down

0 comments on commit 68cdbbe

Please sign in to comment.