AlexeyPechnikov / pygmtsar

PyGMTSAR (Python InSAR): Powerful and Accessible Satellite Interferometry
http://insar.dev/
BSD 3-Clause "New" or "Revised" License
387 stars 88 forks source link

[Help]: I want to run it into my local machine (ubuntu) and then align_images() doesnt work #116

Closed mbahmu25 closed 3 months ago

mbahmu25 commented 3 months ago

*sorry for my bad english When i run sbas.computer_align(DEM) it gives me "[ERRNO 2] no such file or directory : raw_fogo/{filename}.PRM" i think it because self._make_s1a_tops(subswath,debug=debug) didnt work correctyly can you help me how to fix this ?

mbahmu25 commented 3 months ago

this is the full error msg

`--------------------------------------------------------------------------- _RemoteTraceback Traceback (most recent call last) _RemoteTraceback: """ Traceback (most recent call last): File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/externals/loky/process_executor.py", line 463, in _process_worker r = call_item() ^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/externals/loky/process_executor.py", line 291, in call return self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py", line 589, in call return [func(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py", line 589, in return [func(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/gmtsar/pygmtsar/notebooks/pygmtsar/Stack_align.py", line 124, in _align_ref_subswath PRM.from_file(path_stem+ '.PRM')\ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/gmtsar/pygmtsar/notebooks/pygmtsar/PRM.py", line 234, in from_file prm = PRM._from_io(prm_filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/gmtsar/pygmtsar/notebooks/pygmtsar/PRM.py", line 262, in _from_io df = pd.read_csv(prm, sep='\s+=\s+', header=None, names=['name', 'value'], engine='python').set_index('name') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv return _read(filepath_or_buffer, kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 620, in _read parser = TextFileReader(filepath_or_buffer, **kwds) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 1620, in init self._engine = self._make_engine(f, self.engine) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine self.handles = get_handle( ^^^^^^^^^^^ File "/home/genta/miniconda3/envs/sar/lib/python3.11/site-packages/pandas/io/common.py", line 873, in get_handle handle = open( ^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'raw_fogo/S1_20141108_073035_F1.PRM' """

The above exception was the direct cause of the following exception:

FileNotFoundError Traceback (most recent call last) Cell In[28], line 1 ----> 1 sbas.compute_align(DEM)

File ~/gmtsar/pygmtsar/notebooks/pygmtsar/Stack_align.py:865, in Stack_align.compute_align(self, geometry, dates, n_jobs, degrees, joblib_aligning_backend, debug) 862 # prepare reference scene 863 #self.stack_ref() 864 with self.tqdm_joblib(tqdm(desc='Aligning Reference', total=len(subswaths))) as progress_bar: --> 865 joblib.Parallel(n_jobs=n_jobs, backend=joblib_backend)(joblib.delayed(self._align_ref_subswath)(subswath, debug=debug) for subswath in subswaths) 867 # prepare secondary images 868 with self.tqdm_joblib(tqdm(desc='Aligning Repeat', total=len(dates_rep)*len(subswaths))) as progress_bar: 869 # threading backend is the only one working inside Docker container to run multiple binaries in parallel

File ~/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py:1952, in Parallel.call(self, iterable) 1946 # The first item from the output is blank, but it makes the interpreter 1947 # progress until it enters the Try/Except block of the generator and 1948 # reach the first yield statement. This starts the aynchronous 1949 # dispatch of the tasks to the workers. 1950 next(output) -> 1952 return output if self.return_generator else list(output)

File ~/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py:1595, in Parallel._get_outputs(self, iterator, pre_dispatch) 1592 yield 1594 with self._backend.retrieval_context(): -> 1595 yield from self._retrieve() 1597 except GeneratorExit: 1598 # The generator has been garbage collected before being fully 1599 # consumed. This aborts the remaining tasks if possible and warn 1600 # the user if necessary. 1601 self._exception = True

File ~/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py:1699, in Parallel._retrieve(self) 1692 while self._wait_retrieval(): 1693 1694 # If the callback thread of a worker has signaled that its task 1695 # triggered an exception, or if the retrieval loop has raised an 1696 # exception (e.g. GeneratorExit), exit the loop and surface the 1697 # worker traceback. 1698 if self._aborting: -> 1699 self._raise_error_fast() 1700 break 1702 # If the next job is not ready for retrieval yet, we just wait for 1703 # async callbacks to progress.

File ~/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py:1734, in Parallel._raise_error_fast(self) 1730 # If this error job exists, immediatly raise the error by 1731 # calling get_result. This job might not exists if abort has been 1732 # called directly or if the generator is gc'ed. 1733 if error_job is not None: -> 1734 error_job.get_result(self.timeout)

File ~/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py:736, in BatchCompletionCallBack.get_result(self, timeout) 730 backend = self.parallel._backend 732 if backend.supports_retrieve_callback: 733 # We assume that the result has already been retrieved by the 734 # callback thread, and is stored internally. It's just waiting to 735 # be returned. --> 736 return self._return_or_raise() 738 # For other backends, the main thread needs to run the retrieval step. 739 try:

File ~/miniconda3/envs/sar/lib/python3.11/site-packages/joblib/parallel.py:754, in BatchCompletionCallBack._return_or_raise(self) 752 try: 753 if self.status == TASK_ERROR: --> 754 raise self._result 755 return self._result 756 finally:

FileNotFoundError: [Errno 2] No such file or directory: 'raw_fogo/S1_20141108_073035_F1.PRM'`

AlexeyPechnikov commented 3 months ago

But do you have installed GMTSAR binary tools?

mbahmu25 commented 3 months ago

yes, i already install it, with same step like in the colab or docker

mbahmu25 commented 3 months ago

i dont use docker, because i can't install (error) it :')

AlexeyPechnikov commented 3 months ago

It's difficult to pinpoint the exact issue without any indication of why the required file is missing. However, it could be related to either the GMTSAR binaries being missing or improperly installed (can you execute them directly from the command line?) or due to the Python version being used (try using the same version as on Google Colab). I suggest using Docker Desktop software as the simplest solution. Otherwise, you may need to utilize PyGMTSAR's debugging features to investigate the problem further.

mbahmu25 commented 3 months ago

GMTSAR binary is working good, i test it using terminal. But when i backtrack the error i come into this line of code image it seems the module can't get the right path for metapath and datapath, i also test it by changing argv var into 'argv = ['make_s1a_tops path_to_xmlfile path_to_tiff Path_to_output 1']' and it works but only for 1 image.

AlexeyPechnikov commented 3 months ago

You can use Stack.compute_align(..., debug=True) for debugging. And have you defined the required environment variables as in the example notebooks?

mbahmu25 commented 3 months ago

ah, i found the solution, i change the argv to this image and it works, Thankyou Mr. Alexey.