Skip to content

prep_hyp3: ignore whitespace in keys#690

Merged
yunjunz merged 3 commits intoinsarlab:mainfrom
forrestfwilliams:hyp3_error
Nov 13, 2021
Merged

prep_hyp3: ignore whitespace in keys#690
yunjunz merged 3 commits intoinsarlab:mainfrom
forrestfwilliams:hyp3_error

Conversation

@forrestfwilliams
Copy link
Copy Markdown
Collaborator

In the metadata file provided with HyP3 InSAR products, the syntax of the UTC time key has changed form UTCtime to UTC time and the prep_hyp3 scripts needs to be updated to reflect this.

A try except statement was added that first tries to index on UTC time , then indexes on UTCtime if this produces a Key Error. This ensures backward compatibility with old products.

  • Pass Codacy code review (green)
  • Pass Circle CI test (green)
  • Make sure that your code follows our style. Use the other functions/files as a basis.
  • If modifying functionality, describe changes to function behavior and arguments in a comment below the function declaration.
  • If adding new functionality, add a detailed description to the documentation and/or an example.

@yunjunz
Copy link
Copy Markdown
Member

yunjunz commented Nov 7, 2021

Thank you for the update @forrestfwilliams. The subtle change of adding/removing whitespace in the upstream (HyP3) can be error-prone to the downstream code (MintPy). How about we ignore the whitespace in all keys while reading the HyP3 metadata file, by adding key.replace(' ', '') after this line?

key, value = line.strip().split(': ')

If so, a few other places in prep_hyp3.py need to remove the whitespace as well.

@forrestfwilliams
Copy link
Copy Markdown
Collaborator Author

Yeah @yunjunz I think that would be an improvement. I'll go ahead and make the changes.

@jhkennedy
Copy link
Copy Markdown
Collaborator

Sorry -- this one is my bad (I reviewed the HyP3 PR that made the change). Eventually we'd like to do something a bit better with an included metadata file, but for now, stripping whitespace is probably a good solution. We don't have plans in the near future to modify this file, or the keys in it however.

@yunjunz yunjunz changed the title prep_hyp3: fix utc time error prep_hyp3: strip off whitespace for stability Nov 12, 2021
Copy link
Copy Markdown
Member

@yunjunz yunjunz left a comment

Choose a reason for hiding this comment

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

Thank you @forrestfwilliams for the update. It looks all good to me. Please feel free to go ahead and merge the PR.

@yunjunz yunjunz changed the title prep_hyp3: strip off whitespace for stability prep_hyp3: ignore whitespace in keys Nov 13, 2021
@yunjunz yunjunz merged commit 928db34 into insarlab:main Nov 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants