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

NDCUM-1016 #57

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

NDCUM-1016 #57

wants to merge 2 commits into from

Conversation

mikedorfman
Copy link
Collaborator

  • Updated call to updatePolygon so we're calling updatePolygons with a polygon array length of just the single polygon instead. This ensures we're using counter-clockwise arrangement of points in the polygon and reduces dual maintenance between these two methods.
  • Updated updatePolygons so we can optionally bypass the polygon validity check for backwards compatibility with updatePolygon.
  • Removed no-longer-used updatePolygon method.

… - the latter ensures counter-clockwise arrangement of points in the polygon.

Updated updatePolygons so we can optionally bypass the polygon validity check for backwards compatibility with updatePolygon
Removed no-longer-used updatePolygon method
@yenes56
Copy link
Contributor

yenes56 commented Jun 1, 2023

I have discussed with our lead @skorper
and we would like invalidOK to be removed. The old addPolygon function does not check if polygon is valid neither did it make sure coordinates are counter clockwise. if the polygon was not valid, then it would probably fail CMR Post anyway. Hence, please remove invalidOK and all calls to addPolygons shall go through

  • validation
  • counter clockwise-zed

if validation failed, global bounding box is added as geometry presentation, that logic is in addPolygons already.

thanks!

String polygon = ((IsoGranule) granule).getPolygon();
if (polygon != "" && polygon != null) {
String polygonString = ((IsoGranule) granule).getPolygon();
if (polygonString != "" && polygonString != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use apache lang3 StringUtils.isEmpty to accomplish this very same logic. It is null proof.
Hopefully not string with only space but it could be " "

hence. StringUtils.isEmpty(StringUtils.trim(polygonString)) will do

I like the way the variable is named. Thumb up on that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good - updated in the next commit.

@mikedorfman
Copy link
Collaborator Author

Hey @yenes56 - thanks for taking a look! That makes sense. What are your thoughts on attempting Polygon repair in the script if it's invalid? Right now, we have a polygon that does not pass this validity check but still publishes to CMR successfully. I'll take a closer look into why it's invalid to see if there's anything we can do elsewhere to fix this.

@mikedorfman
Copy link
Collaborator Author

@yenes56 - following up on this, I figured out why my validity check is failing - the polygon spans the International Date Line and, because of its geometry, it overlaps itself. This is not considered invalid in CMR, but it doesn't pass the validity test here. Would you still like the global bounding box to be used in this case?

 - Removed the validity check bypass for polygons
@mikedorfman
Copy link
Collaborator Author

An alternative thought @yenes56 - what are your thoughts on removing polygon validation and instead making a (optional) call to the CMR validate-granule endpoint (https://cmr.earthdata.nasa.gov/ingest/site/docs/ingest/api.html#validate-granule-endpoint) after the UMM-G is generated? That would assure the validation run against the generated UMM-G file is exactly what's run on CMR (assuming validation run here should, by definition, match the validation run by CMR). The downside is that it would add an external dependency, but it would remove the dual maintenance for validity checks between CMR and the MetadataAggregator.

@skorper
Copy link
Contributor

skorper commented Jun 15, 2023

@mikedorfman I like your ideas about polygon repair and CMR validation. Do you mind if we address/discuss those in a separate ticket and merge this as-is? I think this looks good and we can proceed with these changes

@mikedorfman
Copy link
Collaborator Author

@skorper - sounds good to me - thanks!

@mikedorfman
Copy link
Collaborator Author

@skorper - just following up on this - we're currently maintaining our own branch of the cumulus-metadata-aggregator with both the polygon-validity updates (changes in this PR) and a fix for the IDL-crossing case (mentioned needs more discussion above) and we've merged the latest Cumulus-V16-compatible release into our fork. We had a hard time with the merge because of the number of changes, so for the time being we're sticking with the previous version (our fork) of the cumulus-metadata-aggregator - which seems to be working in Cumulus v16 and Cumulus v18.

Are either of the changes above currently in the cumulus-v16-compatible release? How would you like to proceed WRT the IDL-crossing case? I'm happy to make a new PR where we can continue discussion if that works for you.

@skorper
Copy link
Contributor

skorper commented Nov 10, 2023

Hi @mikedorfman, the reason you probably had trouble merging our latest release is because we recently implemented something similar to support SWOT.

cumulus-metadata-aggregator:8.5.0 has a new feature where polygons extracted from the .iso.xml will be split into multiple polygons if they cross the IDL. It sounds like this is similar to the behavior you've added in this PR -- I wonder if you can try this capability out on our deployment and see if it works for you?

If not, we can take a look at merging your code into ours, we definitely want to help get your changes merged in so you don't have to work on a separate fork. Thank you!

@mikedorfman
Copy link
Collaborator Author

@skorper - sounds good - we'll give it a try just referencing the podaac release and will let you know how it goes! We'll probably give this a shot in the next week or two - I'll keep you updated.

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.

4 participants