s1_geocode_stack.py: Add ability to read "DH" SAFE files#193
Open
scottstanie wants to merge 1 commit intoopera-adt:mainfrom
Open
s1_geocode_stack.py: Add ability to read "DH" SAFE files#193scottstanie wants to merge 1 commit intoopera-adt:mainfrom
scottstanie wants to merge 1 commit intoopera-adt:mainfrom
Conversation
seongsujeong
reviewed
Aug 1, 2023
Contributor
seongsujeong
left a comment
There was a problem hiding this comment.
Looks good overall. Couple of comments are in the below. - Seongsu
| 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.""" |
Contributor
There was a problem hiding this comment.
I think it would be better to mention what values are expected for pol_type in the docstring.
Comment on lines
+152
to
+165
| 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 = }") |
Contributor
There was a problem hiding this comment.
Suggested change
| 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
Contributor
|
Another thought. Currently the default pol for |
Contributor
Author
|
Oh that's a great point. I knew there was somewhere that made more sense than tucked away in this stack script lol. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the ability to recognize SAFE files that have HH/HV instead of VV/VH.
Right now I'm raising a
NotImplementedErrorin_get_pol_strif 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.