-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/geodesymiami/rsmas_insar
- Loading branch information
Showing
13 changed files
with
439 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
import sys | ||
import glob | ||
import argparse | ||
import re | ||
import h5py | ||
from pathlib import Path | ||
from minsar.objects import message_rsmas | ||
from minsar.objects.auto_defaults import PathFind | ||
|
@@ -17,6 +17,9 @@ | |
sys.path.insert(0, os.getenv('SSARAHOME')) | ||
import password_config as password | ||
|
||
REMOTEHOST_INSARMAPS = os.getenv('REMOTEHOST_INSARMAPS') | ||
REMOTEHOST_INSARMAPS2 = os.getenv('REMOTEHOST_INSARMAPS2') | ||
|
||
pathObj = PathFind() | ||
############################################################ | ||
EXAMPLE = """example: | ||
|
@@ -30,7 +33,7 @@ def create_parser(): | |
epilog = EXAMPLE | ||
parser = argparse.ArgumentParser(description=synopsis, epilog=epilog, formatter_class=argparse.RawTextHelpFormatter) | ||
parser.add_argument('data_dir', nargs=1, help='Directory with hdf5eos file.\n') | ||
parser.add_argument('--dataset', dest='dataset', choices=['PS', 'DS', 'PSDS', 'geo', 'all'], default='PS', help='Plot data as image or scatter (default: %(default)s).') | ||
parser.add_argument('--dataset', dest='dataset', choices=['PS', 'DS', 'PSDS', 'geo', 'filt*DS','all'], default='geo', help='Plot data as image or scatter (default: %(default)s).') | ||
parser.add_argument("--queue", dest="queue", metavar="QUEUE", default=os.getenv('QUEUENAME'), help="Name of queue to submit job to") | ||
parser.add_argument('--walltime', dest='wall_time', metavar="WALLTIME (HH:MM)", default='1:00', help='job walltime (default=1:00)') | ||
|
||
|
@@ -48,21 +51,20 @@ def main(iargs=None): | |
inps.num_data = 1 | ||
job_obj = JOB_SUBMIT(inps) | ||
|
||
files = glob.glob(inps.work_dir + '/' + inps.data_dir[0] + '/*.he5') | ||
all_files = glob.glob(inps.work_dir + '/' + inps.data_dir[0] + '/*.he5') | ||
|
||
file_DS = None | ||
file_PS = None | ||
file_geo = [file for file in all_files if 'DS' not in file and 'PS' not in file] | ||
file_PS = [file for file in all_files if 'PS' in file] | ||
file_DS = [file for file in all_files if 'DS' in file and 'filt' not in file] | ||
file_filtDS = [file for file in all_files if 'DS' in file and 'filt' in file] | ||
|
||
for file in files: | ||
if re.search(r'filt.*DS', file): | ||
file_DS = file | ||
elif 'PS' in file: | ||
file_PS = file | ||
else: | ||
file_geo = file | ||
|
||
|
||
job_name = f"insarmaps" | ||
job_file_name = job_name | ||
|
||
with h5py.File(file_geo[0], 'r') as f: | ||
ref_lat = float(f.attrs['REF_LAT']) | ||
ref_lon = float(f.attrs['REF_LON']) | ||
|
||
files = [] | ||
suffixes = [] | ||
|
@@ -75,6 +77,9 @@ def main(iargs=None): | |
if inps.dataset == "DS": | ||
files.append(file_DS) | ||
suffixes.append("_DS") | ||
if inps.dataset == "filt*DS": | ||
files.append(file_filtDS) | ||
suffixes.append("_filtDS") | ||
if inps.dataset == "PSDS" or inps.dataset == "DSPS": | ||
files.append(file_PS) | ||
files.append(file_DS) | ||
|
@@ -90,29 +95,33 @@ def main(iargs=None): | |
|
||
command = [] | ||
for file, suffix in zip(files, suffixes): | ||
command.append( f'rm -r {inps.data_dir[0]}/JSON{suffix}\n' ) | ||
command.append( f'hdfeos5_2json_mbtiles.py {file} {inps.work_dir}/{inps.data_dir[0]}/JSON{suffix} --num-workers 8\n' ) | ||
command.append( f'rm -rf {inps.data_dir[0]}/JSON{suffix}' ) | ||
command.append( f'hdfeos5_2json_mbtiles.py {file[0]} {inps.work_dir}/{inps.data_dir[0]}/JSON{suffix} --num-workers 8' ) | ||
|
||
command.append('wait\n\n') | ||
command.append('wait\n') | ||
for file, suffix in zip(files, suffixes): | ||
path_obj = Path(file) | ||
path_obj = Path(file[0]) | ||
mbtiles_file = f"{path_obj.parent}/JSON{suffix}/{path_obj.name}" | ||
mbtiles_file = mbtiles_file.replace('he5','mbtiles') | ||
command.append( f'json_mbtiles2insarmaps.py --num-workers 8 -u {password.insaruser} -p {password.insarpass} --host insarmaps.miami.edu -P rsmastest -U rsmas\@gmail.com --json_folder {inps.work_dir}/{inps.data_dir[0]}/JSON{suffix} --mbtiles_file {mbtiles_file} &\n' ) | ||
command.append( f'json_mbtiles2insarmaps.py --num-workers 8 -u {password.docker_insaruser} -p {password.docker_insarpass} --host 149.165.174.11 -P insarmaps -U [email protected] --json_folder {inps.work_dir}/{inps.data_dir[0]}/JSON{suffix} --mbtiles_file {mbtiles_file} &\n' ) | ||
command.append( f'json_mbtiles2insarmaps.py --num-workers 8 -u {password.insaruser} -p {password.insarpass} --host {REMOTEHOST_INSARMAPS} -P {password.databasepass} -U {password.databaseuser} --json_folder {inps.work_dir}/{inps.data_dir[0]}/JSON{suffix} --mbtiles_file {mbtiles_file} &' ) | ||
command.append( f'json_mbtiles2insarmaps.py --num-workers 8 -u {password.docker_insaruser} -p {password.docker_insarpass} --host {REMOTEHOST_INSARMAPS2} -P {password.docker_databasepass} -U {password.docker_databaseuser} --json_folder {inps.work_dir}/{inps.data_dir[0]}/JSON{suffix} --mbtiles_file {mbtiles_file} &' ) | ||
|
||
command.append('wait\n\n') | ||
str = [f'cat >> insarmaps.log<<EOF\n'] | ||
command.append('wait\n') | ||
str = [f'cat >> insarmaps.log<<EOF'] | ||
for file in files: | ||
base_name = os.path.basename(file) | ||
base_name = os.path.basename(file[0]) | ||
name_without_extension = os.path.splitext(base_name)[0] | ||
str.append(f"https://insarmaps.miami.edu/start/25.78/-80.3/11.0?flyToDatasetCenter=true&startDataset={name_without_extension}\n") | ||
str.append(f"149.165.174.11/start/25.78/-80.3/11.0?flyToDatasetCenter=true&startDataset={name_without_extension}\n") | ||
# str.append(f"https://insarmaps.miami.edu/start/25.78/-80.3/11.0?flyToDatasetCenter=true&startDataset={name_without_extension}") | ||
# str.append(f"149.165.174.11/start/25.78/-80.3/11.0?flyToDatasetCenter=true&startDataset={name_without_extension}") | ||
|
||
str.append(f"https://{REMOTEHOST_INSARMAPS}/start/{ref_lat:.1f}/{ref_lon:.1f}/11.0?flyToDatasetCenter=true&startDataset={name_without_extension}") | ||
str.append(f"{REMOTEHOST_INSARMAPS2}/start/{ref_lat:.1f}/{ref_lon:.1f}/11.0?flyToDatasetCenter=true&startDataset={name_without_extension}") | ||
|
||
str.append( 'EOF' ) | ||
command.append( "".join(str) ) | ||
command.append( '\n'.join(str) ) | ||
final_command =[ '\n'.join(command) ] | ||
|
||
job_obj.submit_script(job_name, job_file_name, command, writeOnly='True') | ||
job_obj.submit_script(job_name, job_file_name, final_command, writeOnly='True') | ||
print('jobfile created: ',job_file_name + '.job') | ||
|
||
return None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.