Skip to content

Commit

Permalink
minor changes to ensure consistent documentation
Browse files Browse the repository at this point in the history
minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation

minor changes to ensure consistent documentation
  • Loading branch information
Sarah Lawrie committed May 1, 2017
1 parent 0e49d54 commit ab32716
Show file tree
Hide file tree
Showing 44 changed files with 1,090 additions and 857 deletions.
63 changes: 36 additions & 27 deletions pyrate/algorithm.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""
This Python module contains a collection of algorithms used in PyRate
This Python module contains a collection of algorithms used in PyRate.
"""
import logging
from numpy import sin, cos, unique, histogram, diag, dot
Expand All @@ -28,10 +28,11 @@
def is_square(arr):
"""
Determines whether a numpy array is square or not.
:param ndarray arr: numpy array
:param arr: numpy array
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
shape = arr.shape
if len(shape) == 2 and (shape[0] == shape[1]):
Expand All @@ -44,11 +45,12 @@ def least_squares_covariance(A, b, v):
Least squares solution in the presence of known covariance.
This function is known as lscov() in MATLAB.
:param A: Design matrix
:param b: Observations (vector of phase values)
:param v: Covariances (weights) in vector form
:param xxx(eg str, tuple, int, float ...) A: Design matrix
:param xxx b: Observations (vector of phase values)
:param xxx v: Covariances (weights) in vector form
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
# pylint: disable=too-many-locals
# X = LSCOV(A,b,V) returns the vector X that minimizes
Expand Down Expand Up @@ -94,10 +96,11 @@ def los_conversion(phase_data, unit_vec):
"""
Converts phase from line-of-sight (LOS) to horizontal/vertical components.
:param phase_data: Phase band data array (eg. ifg.phase_data)
:param unit_vec: 3 component sequence, eg. [EW, NS, vertical]
:param xxx(eg str, tuple, int, float ...) phase_data: Phase band data array (eg. ifg.phase_data)
:param xxx unit_vec: 3 component sequence, eg. [EW, NS, vertical]
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""

# NB: currently not tested as implementation is too simple
Expand All @@ -106,12 +109,13 @@ def los_conversion(phase_data, unit_vec):

def unit_vector(incidence, azimuth):
"""
xxxxxxx.
xxxx
:param incidence: xxxx
:param azimuth: xxxx
:param xxx(eg str, tuple, int, float ...) incidence: xxxx
:param xxx azimuth: xxxx
:return Unit vector tuple (east_west, north_south, vertical).
:return: Unit vector tuple (east_west, north_south, vertical).
:rtype: tuple
"""

vertical = cos(incidence)
Expand All @@ -124,10 +128,11 @@ def ifg_date_lookup(ifgs, date_pair):
"""
Interferogram which has a master/slave dates given in 'date_pair'.
:param ifgs: List of interferogram objects to search in
:param date_pair: A (datetime.date, datetime.date) tuple
:param xxx(eg str, tuple, int, float ...) ifgs: List of interferogram objects to search in
:param tuple date_pair: A (datetime.date, datetime.date)
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
if len(date_pair) != 2:
msg = "Need (datetime.date, datetime.date) master/slave pair"
Expand Down Expand Up @@ -156,10 +161,11 @@ def ifg_date_index_lookup(ifgs, date_pair):
"""
Interferogram index which has a master/slave dates given in 'date_pair'.
:param ifgs: List of interferogram objects to search in
:param date_pair: A (datetime.date, datetime.date) tuple
:param xxx(eg str, tuple, int, float ...) ifgs: List of interferogram objects
:param tuple date_pair: A (datetime.date, datetime.date)
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""

if len(date_pair) != 2:
Expand All @@ -185,9 +191,10 @@ def get_epochs(ifgs):
"""
EpochList derived from all given interferograms.
:param ifgs: List of interferogram objects
:param xxx(eg str, tuple, int, float ...) ifgs: List of interferogram objects
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
log.info('Finding unique epochs in given interferogram network')
if isinstance(ifgs, dict):
Expand All @@ -206,9 +213,10 @@ def get_all_epochs(ifgs):
"""
Sequence of all master and slave dates in given interferograms.
:param ifgs: List of interferogram objects
:param xxx(eg str, tuple, int, float ...) ifgs: List of interferogram objects
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""

return [ifg.master for ifg in ifgs] + [ifg.slave for ifg in ifgs]
Expand All @@ -220,9 +228,10 @@ def master_slave_ids(dates):
from oldest to newest, starting at 0.
Replaces ifglist.mas|slvnum used in the Matlab Pirate package.
:param dates: List of dates
:param xxx(eg str, tuple, int, float ...) dates: List of dates
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""

dset = sorted(set(dates))
Expand Down
76 changes: 43 additions & 33 deletions pyrate/config.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
This Python module contains utilities to parse PyRate configuration
files. It also includes numerous general constants relating to options
in configuration files. Examples of PyRate configuration files are
provided in the configs/ directory
provided in the configs/ directory.
"""
# coding: utf-8
# pylint: disable= invalid-name
Expand Down Expand Up @@ -179,9 +179,10 @@ def degree_conv(deg):
"""
Convenience: convert numerical degree to human readable string.
:param deg: xxxx
:param xxx(eg str, tuple, int, float...) deg: xxxx
:return xxxx
:return: xxxx
:rtype: str
"""

degree = int(deg)
Expand All @@ -198,9 +199,10 @@ def method_conv(meth):
"""
Convenience: convert numerical method to human readable string.
:param meth: xxxx
:param xxx(eg str, tuple, int, float...) meth: xxxx
:return xxxx
:return: xxxx
:rtype: str
"""

method = int(meth)
Expand Down Expand Up @@ -273,11 +275,12 @@ def method_conv(meth):

def get_config_params(path):
"""
Dictionary for the key:value pairs from the .conf file.
Dictionary for the key:value pairs from the config file.
:param path: xxxx
:param xxx(eg str, tuple, int, float...) path: xxxx
:return xxxx
:return: xxxx
:rtype: dict
"""
txt = ''
with open(path, 'r') as inputFile:
Expand All @@ -300,12 +303,12 @@ def get_config_params(path):

def _parse_conf_file(content):
"""
Parser for converting text content into a dict of parameters.
Parser for converting text content into a dictionary of parameters.
"""

def is_valid(line):
"""
check if line is not empty or has % or #.
Check if line is not empty or has % or #.
"""
return line != "" and line[0] not in "%#"

Expand Down Expand Up @@ -392,9 +395,10 @@ def parse_namelist(nml):
"""
Parses name list file into array of paths.
:param nml: xxxx
:param xxx(eg str, tuple, int, float...) nml: xxxx
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
with open(nml) as f_in:
lines = [line.rstrip() for line in f_in]
Expand All @@ -412,10 +416,11 @@ def write_config_file(params, output_conf_file):
"""
Takes a param object and write the config file. Reverse of get_conf_params.
:param params: params dictionary
;param output_conf_file: xxxx
:param dict params: params dictionary
:param xxx(eg str, tuple, int, float...) output_conf_file: xxxx
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
with open(output_conf_file, 'w') as f:
for k, v in params.items():
Expand All @@ -431,9 +436,10 @@ def reverse_degree_conv(v):
"""
Convenience: convert numerical degree to human readable string.
;param v: xxxx
:param xxx(eg str, tuple, int, float...) v: xxxx
:return xxxx
:return: xxxx
:rtype: str
"""
if v == PLANAR:
return 1
Expand All @@ -450,7 +456,7 @@ def transform_params(params):
"""
Subset of config parameters for cropping and multi-looking.
;param params: xxxx
:param xxx(eg str, tuple, int, float...) params: xxxx
:return xxxx
"""
Expand All @@ -464,9 +470,10 @@ def original_ifg_paths(ifglist_path):
"""
Sequence of paths to files in given ifglist file.
;param ifglist_path: xxxx
:param xxx(eg str, tuple, int, float...) ifglist_path: xxxx
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""

basedir = os.path.dirname(ifglist_path)
Expand All @@ -478,11 +485,12 @@ def mlooked_path(path, looks, crop_out):
"""
Adds suffix to path, for creating a new path for mlooked files.
;param path: xxxx
:param looks: xxxx
:param crop_out: xxxx
:param xxx(eg str, tuple, int, float...) path: xxxx
:param xxx looks: xxxx
:param xxx crop_out: xxxx
:return xxxx
:return: xxxx
:rtype: xxxx(eg float)
"""
base, ext = splitext(path)
return "{base}_{looks}rlks_{crop_out}cr{ext}".format(
Expand All @@ -493,12 +501,13 @@ def get_dest_paths(base_paths, crop, params, looks):
"""
xxxx
:param base_paths: Unwrapped interferogram paths
:param crop: Crop method to use
:param params: Parameters dictionary corresponding to config file used
:param looks: multi-looking
:param list base_paths: Unwrapped interferogram paths
:param int crop: Crop method to use
:param dict params: Parameters dictionary corresponding to config file used
:param int looks: multi-looking
:return list of output geotifs.
:return: List of output geotifs.
:rtype: xxxx(eg float)
"""
dest_mlooked_ifgs = [mlooked_path(os.path.basename(q).split('.')[0] + '_'
+ os.path.basename(q).split('.')[1] +
Expand All @@ -512,11 +521,12 @@ def get_ifg_paths(config_file):
"""
xxxx
:param config_file: Config file path
:param str config_file: Config file path
:return base_unw_paths: List of unwrapped inteferrograms
:return dest_paths: List of multi-looked and cropped geotifs
:return pars: Dictionary corresponding to the config file.
:return: base_unw_paths: List of unwrapped inteferograms
:return: dest_paths: List of multi-looked and cropped geotifs
:return: pars: Dictionary corresponding to the config file
:rtype: xxxx(eg float)
"""
pars = get_config_params(config_file)
ifg_file_list = pars.get(IFG_FILE_LIST)
Expand Down

0 comments on commit ab32716

Please sign in to comment.