From 73175e64bdf43d8cb63776a290aa938a485ca889 Mon Sep 17 00:00:00 2001 From: Alexey Pechnikov Date: Sat, 21 Sep 2024 19:41:44 +0700 Subject: [PATCH] Remove unused PRM.resamp() wrapper --- pygmtsar/pygmtsar/PRM_gmtsar.py | 66 --------------------------------- 1 file changed, 66 deletions(-) diff --git a/pygmtsar/pygmtsar/PRM_gmtsar.py b/pygmtsar/pygmtsar/PRM_gmtsar.py index 8a77225..d6de765 100644 --- a/pygmtsar/pygmtsar/PRM_gmtsar.py +++ b/pygmtsar/pygmtsar/PRM_gmtsar.py @@ -206,72 +206,6 @@ def SAT_llt2rat(self, coords=None, fromfile=None, tofile=None, precise=1, binary out = np.fromstring(stdout_data, dtype=float, sep=' ') return out if out.size==5 else out.reshape(-1,5) - def resamp(self, repeatPRM, repeatSLC_tofile, interp, debug=False): - """ - Resample the repeat image. - - Parameters - ---------- - repeatPRM : PRM - The PRM object for the repeat image. - repeatSLC_tofile : str - The file path to save the resampled repeat SLC image to. - interp : int - The interpolation method: 1 for nearest, 2 for bilinear, 3 for biquadratic, or 4 for bisinc. - debug : bool, optional - If True, debug information will be printed. Default is False. - - Returns - ------- - PRM - The PRM object for the resampled repeat image. - - Notes - ----- - This method resamples the repeat image using the current PRM object and the PRM object for the repeat image. - The resampled repeat SLC image is saved to the specified file, and the resulting PRM parameters are returned. - """ - import os - import subprocess - from pygmtsar import PRM - - if not isinstance(repeatPRM, PRM): - raise Exception('Argument should be PRM class instance') - - SLC_tmpname = os.path.split(repeatSLC_tofile)[-1] + '.tmp' - - pipe1 = os.pipe() - os.write(pipe1[1], bytearray(repeatPRM.to_str(), 'utf8')) - os.close(pipe1[1]) - #print ('descriptor 1', pipe1[0]) - - pipe2 = os.pipe() - #print ('descriptor 2', pipe2[1]) - - # Usage: resamp master.PRM repeat.PRM new_repeat.PRM new_repeat.SLC interp - argv = ['resamp', f'/dev/stdin', f'/dev/fd/{pipe1[0]}', - f'/dev/fd/{pipe2[1]}', SLC_tmpname, str(interp)] - if debug: - print ('DEBUG: argv', argv) - cwd = os.path.dirname(self.filename) if self.filename is not None else '.' - if debug: - print ('DEBUG: cwd', cwd) - p = subprocess.Popen(argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, pass_fds=[pipe1[0], pipe2[1]], - cwd=cwd) - stdout_data, stderr_data = p.communicate(input=bytearray(self.to_str(), 'utf8')) - - if len(stderr_data) > 0 and debug: - print ('DEBUG: resamp', stderr_data.decode('utf8')) - - # rename the file to the persistent name - if os.path.exists(repeatSLC_tofile + '.tmp'): - os.rename(repeatSLC_tofile + '.tmp', repeatSLC_tofile) - - # PRM file should be small text - data = os.read(pipe2[0],int(10e6)) - return PRM.from_str(data.decode('utf8')) - def SAT_look(self, coords=None, fromfile=None, tofile=None, binary=False, debug=False): """ Compute the satellite look vector.