Skip to content

Commit

Permalink
update prep_mintpy
Browse files Browse the repository at this point in the history
  • Loading branch information
mgovorcin committed Dec 23, 2023
1 parent d44a18f commit 17a133d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/ARIAtools/contrib/ARIA_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def find_aoi_intersection(self, south, north):
self.df_date12 = get_df_date12(self)
extent = get_union_extent(self.df_date12)
aoi = box(extent[0]-0.1, south, extent[2]+0.1, north)

# Convert to GeoDataframe
aoi_gdf = gpd.GeoDataFrame([1], geometry=[aoi],
crs=self.df_date12.crs)
Expand Down Expand Up @@ -163,6 +164,7 @@ def save_aria_bbox(self, overwrite=False):

# Get the min common area
bbox_shp = intersection_all(unioned_gdf.geometry)

# Write a new Shapefile
geojson_dict = dict(index=0, geometry='Polygon')
with fiona.open(self.user_json, 'w', 'GeoJSON', geojson_dict) as c:
Expand Down Expand Up @@ -363,7 +365,7 @@ def prepare_stack(self):
ARIA_STACK_OUTFILES[layer],
**stack_dict)

def prep_mintpy(self):
def prep_mintpy(self, execute=False):
# Create MIntpy directory
mintpy_dir = self.work_dir / 'MINTPY'
mintpy_dir.mkdir(parents=True, exist_ok=True)
Expand All @@ -373,8 +375,10 @@ def prep_mintpy(self):
cmd += f" -w {self.aria_dir}/mask/watermask.msk"

# Run prep_aria
os.chdir(str(mintpy_dir))
os.system(cmd)
print(cmd)
if execute:
os.chdir(str(mintpy_dir))
os.system(cmd)

def save2pickle(self, fname):
import pickle
Expand Down

0 comments on commit 17a133d

Please sign in to comment.