Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prep_nisar: update for changes in NISAR GUNW products #1158

Merged
merged 11 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/mintpy/prep_nisar.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ def load_nisar(inps):
print(f"Found {len(input_files)} unwrapped files")

if inps.subset_lat:
bbox = (inps.subset_lat[0], inps.subset_lon[0], inps.subset_lat[1], inps.subset_lon[1])
bbox = (inps.subset_lon[0], inps.subset_lat[0], inps.subset_lon[1], inps.subset_lat[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this isn't converting from SNWE to (left, bottom, right top), it's just fixing the ordering for (left, bottom, right, top)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes the input arguments follows mintpy subsetting with two arguments --sub-lat and --sub-lon . They are ordered to make bbox here

else:
bbox=None
bbox = None

# extract metadata
metadata, bounds = extract_metadata(input_files, bbox)
Expand Down Expand Up @@ -164,7 +164,6 @@ def extract_metadata(input_files, bbox=None, polarization='HH'):
utm_bbox = None
bounds = common_raster_bound(input_files, utm_bbox)
meta['bbox'] = ",".join([str(b) for b in bounds])

col1, row1, col2, row2 = get_rows_cols(xcoord, ycoord, bounds)
length = row2 - row1
width = col2 - col1
Expand Down Expand Up @@ -204,8 +203,8 @@ def common_raster_bound(input_files, utm_bbox=None):
x_bounds.append([west, east])
y_bounds.append([south, north])
if not utm_bbox is None:
x_bounds.append([utm_bbox[1], utm_bbox[3]])
y_bounds.append([utm_bbox[0], utm_bbox[2]])
x_bounds.append([utm_bbox[0], utm_bbox[2]])
y_bounds.append([utm_bbox[1], utm_bbox[3]])

bounds = max(x_bounds)[0], max(y_bounds)[0], min(x_bounds)[1], min(y_bounds)[1]
return bounds
Expand Down
2 changes: 2 additions & 0 deletions src/mintpy/tropo_pyaps3.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,10 @@ def dload_grib_files(grib_files, tropo_model='ERA5', snwe=None):

# Download grib file using PyAPS
if len(date_list2dload) > 0:
# This was the default for a file pattern of "ERA5_N30_N50_W130_W110_20200403_14.grb"
pattern = re.findall(r'\d{8}[-_]\d{2}', os.path.basename(grib_files2dload[0]))
yunjunz marked this conversation as resolved.
Show resolved Hide resolved
if len(pattern) == 0:
# This is an exception for when the file has a naming format like: "ERA5_N30_N40_W130_W110_20080125T000000_06.grb"
pattern = re.findall(r'\d{8}T\d{6}[-_]\d{2}', os.path.basename(grib_files2dload[0]))
hour = pattern[0].replace('-', '_').split('_')[1]
#hour = re.findall(r'\d{8}[-_]\d{2}', os.path.basename(grib_files2dload[0]))[0].replace('-', '_').split('_')[1]
Expand Down