-
Notifications
You must be signed in to change notification settings - Fork 18
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
s1_geocode_stack.py: Add ability to read "DH" SAFE files #193
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Couple of comments are in the below. - Seongsu
@@ -135,6 +139,30 @@ def generate_burst_map(zip_files, orbit_dir, output_epsg=None, bbox=None, | |||
burst_map = pd.DataFrame(data=burst_map) | |||
return burst_map | |||
|
|||
def _get_pol_str(zip_file, pol_type): | |||
"""Get the polarization string from the zip file name and the type of polarization.""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to mention what values are expected for pol_type
in the docstring.
if count == "S" and pol_type in ["dual-pol", "cross-pol"]: | ||
raise ValueError(f"{zip_file} is single-pol. Unable to process {pol_type}") | ||
if pol_type == "dual-pol": | ||
raise NotImplementedError("TODO") | ||
if h_or_v == "H": | ||
return ["hh", "hv"] | ||
else: | ||
return ["vv", "vh"] | ||
elif pol_type == "cross-pol": | ||
return 'hv' if h_or_v == "H" else "vh" | ||
elif pol_type == "co-pol": | ||
return 'hh' if h_or_v == "H" else "vv" | ||
else: | ||
raise ValueError(f"Invalid {pol_type = }") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if count == "S" and pol_type in ["dual-pol", "cross-pol"]: | |
raise ValueError(f"{zip_file} is single-pol. Unable to process {pol_type}") | |
if pol_type == "dual-pol": | |
raise NotImplementedError("TODO") | |
if h_or_v == "H": | |
return ["hh", "hv"] | |
else: | |
return ["vv", "vh"] | |
elif pol_type == "cross-pol": | |
return 'hv' if h_or_v == "H" else "vh" | |
elif pol_type == "co-pol": | |
return 'hh' if h_or_v == "H" else "vv" | |
else: | |
raise ValueError(f"Invalid {pol_type = }") | |
if pol_type not in ["dual-pol", "cross-pol", "co-pol"]: | |
raise ValueError(f"Invalid {pol_type = }") | |
if count == "S" and pol_type in ["dual-pol", "cross-pol"]: | |
raise ValueError(f"{zip_file} is single-pol. Unable to process {pol_type}") | |
if pol_type == "dual-pol": | |
raise NotImplementedError("TODO") | |
if h_or_v == "H": | |
return ["hh", "hv"] | |
else: | |
return ["vv", "vh"] | |
if pol_type == "cross-pol": | |
return "hv" if h_or_v == "H" else "vh" | |
if pol_type == "co-pol": | |
return "hh" if h_or_v == "H" else "vv" |
Early returns for readability
Another thought. Currently the default pol for |
Oh that's a great point. I knew there was somewhere that made more sense than tucked away in this stack script lol. |
This adds the ability to recognize SAFE files that have HH/HV instead of VV/VH.
Right now I'm raising a
NotImplementedError
in_get_pol_str
if you try to ask fordual-pol
, since I'm not sure how we're handling that elsewhere in the code and it seems like it would need some further refactoring to allow.