insarlab / MintPy

Miami InSAR time-series software in Python
https://mintpy.readthedocs.io
Other
603 stars 257 forks source link

Making time series using Hyp3 outputs #1040

Closed hemengul closed 1 year ago

hemengul commented 1 year ago

hi, ı am pretty new in this environment. ı want to make time series via Mintpy using Hyp3 outputs but there is no ".h5" file in these Hyp3 outputs. When i use these codes: "# Clone MintPy, create environment, install MintPy. Environment creation takes 10-15 min

git clone https://github.com/insarlab/MintPy.git

!mamba env create -f MintPy/docs/environment.yml !conda activate mintpy !python -m ipykernel install --user --name=mintpy

Import required packages

%matplotlib inline import os import numpy as np import matplotlib.pyplot as plt import mintpy from mintpy.objects import ifgramStack from mintpy.utils import plot as pp, utils as ut from mintpy import view, plot_network from mintpy.unwrap_error_phase_closure import plot_num_triplet_with_nonzero_integer_ambiguity

create directory for data

if not os.path.exists('/tmp/data'): os.makedirs('/tmp/data')

os.chdir('/tmp/data')

create directory for MintPy

os.chdir('/tmp')

if not os.path.exists('/tmp/mintpy'): os.makedirs('/tmp/mintpy')

os.chdir('/tmp/mintpy')

Function to write to MintPy config file

def write_config_file(out_file, CONFIG_TXT, mode='a'): """Write configuration files for MintPy to process products""" if not os.path.isfile(out_file) or mode == 'w': with open(out_file, "w") as fid: fid.write(CONFIG_TXT) print('write configuration to file: {}'.format(out_file)) else: with open(out_file, "a") as fid: fid.write("\n" + CONFIG_TXT) print('add the following to file: \n{}'.format(CONFIG_TXT)) CONFIG_TXT = '''# vim: set filetype=cfg:

----------------------------- hyp3 ---------------------

mintpy.load.processor = hyp3

---------interferogram datasets:

mintpy.load.unwFile = /tmp/data//unw_phase.tif mintpy.load.corFile = /tmp/data//corr.tif

---------geometry datasets:

mintpy.load.demFile = /tmp/data//dem.tif mintpy.load.incAngleFile = /tmp/data//lv_theta.tif mintpy.load.waterMaskFile = /tmp/data//water_mask.tif

mintpy.network.excludeDate = 20220617,20220629 mintpy.networkInversion.minTempCoh = 0.4 mintpy.deramp = linear mintpy.reference.lalo = auto

'''

config_file = os.path.join('/tmp/mintpy', "coloradoSenDT56.txt") write_config_file(config_file, CONFIG_TXT, mode='w')

View MintPy options

!smallbaselineApp.py --help"

ı receive "there is no ".h5" file in these Hyp3 outputs" error. When i use these codes: "pairs = [ ('S1A_IW_SLC1SDV_20190610T135156_20190610T135223_027618_031DEF_C70F', 'S1A_IW_SLC__1SDV_20190622T135157_20190622T135224_027793_03232E_0388'), ('S1A_IW_SLC1SDV_20190610T135156_20190610T135223_027618_031DEF_C70F', 'S1A_IW_SLC1SDV_20190704T135158_20190704T135225_027968_032877_1C4D'), ('S1A_IW_SLC__1SDV_20190622T135157_20190622T135224_027793_03232E_0388', 'S1A_IW_SLC1SDV_20190704T135158_20190704T135225_027968_032877_1C4D'), ('S1A_IW_SLC1SDV_20190622T135157_20190622T135224_027793_03232E_0388', 'S1A_IW_SLC__1SDV_20190716T135159_20190716T135226_028143_032DC3_512B'), ('S1A_IW_SLC1SDV_20190704T135158_20190704T135225_027968_032877_1C4D', 'S1A_IW_SLC1SDV_20190716T135159_20190716T135226_028143_032DC3_512B'), ('S1A_IW_SLC__1SDV_20190704T135158_20190704T135225_027968_032877_1C4D', 'S1A_IW_SLC1SDV_20190728T135159_20190728T135226_028318_03331A_C807'), ('S1A_IW_SLC1SDV_20190716T135159_20190716T135226_028143_032DC3_512B', 'S1A_IW_SLC__1SDV_20190728T135159_20190728T135226_028318_03331A_C807'), ('S1A_IW_SLC1SDV_20190716T135159_20190716T135226_028143_032DC3_512B', 'S1A_IW_SLC1SDV_20190809T135200_20190809T135227_028493_033887_08A4'), ('S1A_IW_SLC__1SDV_20190728T135159_20190728T135226_028318_03331A_C807', 'S1A_IW_SLC1SDV_20190809T135200_20190809T135227_028493_033887_08A4'), ('S1A_IW_SLC1SDV_20190728T135159_20190728T135226_028318_03331A_C807', 'S1A_IW_SLC__1SDV_20190821T135201_20190821T135228_028668_033EA0_ADF7'), ('S1A_IW_SLC1SDV_20190809T135200_20190809T135227_028493_033887_08A4', 'S1A_IW_SLC1SDV_20190821T135201_20190821T135228_028668_033EA0_ADF7'), ('S1A_IW_SLC__1SDV_20190809T135200_20190809T135227_028493_033887_08A4', 'S1B_IW_SLC1SDV_20190815T135119_20190815T135146_017597_0211A9_DE22'), ('S1A_IW_SLC1SDV_20190821T135201_20190821T135228_028668_033EA0_ADF7', 'S1B_IW_SLC__1SDV_20190815T135119_20190815T135146_017597_0211A9_DE22'), ('S1A_IW_SLC1SDV_20190821T135201_20190821T135228_028668_033EA0_ADF7', 'S1B_IW_SLC1SDV_20190827T135119_20190827T135146_017772_021724_4F37'), ('S1B_IW_SLC__1SDV_20190815T135119_20190815T135146_017597_0211A9_DE22', 'S1B_IW_SLC1SDV_20190827T135119_20190827T135146_017772_021724_4F37'), ]

os.chdir(hyp3_dir) print('Go to directory:', hyp3_dir)

initiate HyP3 object

hyp3 = sdk.HyP3(prompt = True)

hyp3 = hyp3_sdk.HyP3(hyp3_sdk.HYP3_TEST)

insar_jobs = hyp3_sdk.Batch()

submit InSAR jobs

for pair in pairs: reference_granule = pair[0] secondary_granule = pair[1] insar_jobs += hyp3.submit_insar_job(reference_granule, secondary_granule, name=proj_name, include_look_vectors=True, include_dem=True)

watch InSAR jobs

insar_jobs = hyp3.watch(insar_jobs)

download and uncompress InSAR results

zip_files = insar_jobs.download_files()

for zip_file in zip_files: with zipfile.ZipFile(zip_file) as zip_ref: zip_ref.extractall(hyp3_dir)

prepared data structure are:

! tree {hyp3_dir}

names = glob.glob(os.path.join(hyp3_dir, '/.tif'))

determine the smallest area covered by all input files

corners = [gdal.Info(f, format='json')['cornerCoordinates'] for f in fnames] ulx = max(corner['upperLeft'][0] for corner in corners) uly = min(corner['upperLeft'][1] for corner in corners) lrx = min(corner['lowerRight'][0] for corner in corners) lry = max(corner['lowerRight'][1] for corner in corners)

subset all input files to these common coordinates

for fname in fnames: fname_out = fname.replace('.tif', '_clip.tif') gdal.Translate(destName=fname_out, srcDS=fname, projWin=[ulx, uly, lrx, lry])

show the data structure

! tree {hyp3_dir}

config_txt = f''' mintpy.load.processor = hyp3

---------interferogram datasets:

mintpy.load.unwFile = {hyp3_dir}//unw_phase_clip.tif mintpy.load.corFile = {hyp3_dir}//corr_clip.tif

---------geometry datasets:

mintpy.load.demFile = {hyp3_dir}//dem_clip.tif mintpy.load.incAngleFile = {hyp3_dir}//lv_theta_clip.tif '''

write to file

config_file = os.path.join(mintpy_dir, f'{proj_name}.txt') with open(config_file, 'w') as fid: fid.write(config_txt) print('write file:', config_file)

print(mintpy_dir)

! smallbaselineApp.py --work-dir {mintpy_dir} {config_file}

tsview.main(['mintpy/timeseries.h5'])

"

ı receive " some file related to hyp3.sdk is epsent" error.

Could you please help me? How can ı generate time series directly using hyp3 outputs?

welcome[bot] commented 1 year ago

👋 Thanks for opening your first issue here! Please filled out the template with as much details as possible. We appreciate that you took the time to contribute! Make sure you read our contributing guidelines.

yunjunz commented 1 year ago

It's hard to see what is happening here, please follow the bug report template for a more informative issue description.

hemengul commented 1 year ago

Hi, I tried to summarize the error message at the bottom, thank you. When I try to run these codes in linux environment, after running first two codes, it stops (process was killed) Could you plesase help me? Best regards

Zhang Yunjun @.***>, 14 Tem 2023 Cum, 10:11 tarihinde şunu yazdı:

It's hard to see what is happening here, please follow the bug report template https://github.com/insarlab/MintPy/blob/main/.github/ISSUE_TEMPLATE/bug_report.md for a more informative issue description.

— Reply to this email directly, view it on GitHub https://github.com/insarlab/MintPy/issues/1040#issuecomment-1635397503, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANADSEIOXPCYAKEZEZFKITTXQDWJPANCNFSM6AAAAAAZ633BC4 . You are receiving this because you authored the thread.Message ID: @.***>

hemengul commented 1 year ago

Pardon me, I want to correct bug report. Best regards.

Hemengül Selma Acar @.***>, 18 Tem 2023 Sal, 10:45 tarihinde şunu yazdı:

Hi, I tried to summarize the error message at the bottom, thank you. When I try to run these codes in linux environment, after running first two codes, it stops (process was killed) Could you plesase help me? Best regards

Zhang Yunjun @.***>, 14 Tem 2023 Cum, 10:11 tarihinde şunu yazdı:

It's hard to see what is happening here, please follow the bug report template https://github.com/insarlab/MintPy/blob/main/.github/ISSUE_TEMPLATE/bug_report.md for a more informative issue description.

— Reply to this email directly, view it on GitHub https://github.com/insarlab/MintPy/issues/1040#issuecomment-1635397503, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANADSEIOXPCYAKEZEZFKITTXQDWJPANCNFSM6AAAAAAZ633BC4 . You are receiving this because you authored the thread.Message ID: @.***>