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

Add option to pre-warp to a common projection #601

Merged
merged 27 commits into from
Nov 5, 2024

Conversation

dmannarino
Copy link
Member

@dmannarino dmannarino commented Oct 31, 2024

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). Don't request your master!
  • Make sure you are making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Check the commit's or even all commits' message styles matches our requested structure.
  • Check your code additions will fail neither code linting checks nor unit test.

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Other information

@codecov-commenter
Copy link

codecov-commenter commented Oct 31, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 43.47826% with 13 lines in your changes missing coverage. Please review.

Project coverage is 81.07%. Comparing base (7e9eef9) to head (989c14f).

Files with missing lines Patch % Lines
...s/raster_tile_set_assets/raster_tile_set_assets.py 46.66% 8 Missing ⚠️
app/tasks/raster_tile_set_assets/utils.py 28.57% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #601      +/-   ##
===========================================
- Coverage    81.23%   81.07%   -0.17%     
===========================================
  Files          130      130              
  Lines         5857     5876      +19     
===========================================
+ Hits          4758     4764       +6     
- Misses        1099     1112      +13     
Flag Coverage Δ
unittests 81.07% <43.47%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@danscales danscales left a comment

Choose a reason for hiding this comment

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

Looks good so far (assuming xargs parallelization works well), but as I comment below, don't you need a dependency so the unify_projection job finishes completely before running the pixetl job?


jobs.append(
await create_pixetl_job(
dataset, version, creation_options, "create_raster_tile_set", callback
Copy link
Collaborator

Choose a reason for hiding this comment

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

***In the case the unify_projection is True, don't you need to specify a parent dependency argument here? The create_unify_projection_job must run fully before the create_pixetl_job runs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, thanks!

mkdir -p "$reprojected_dir"

cd $source_dir
for d in $((tree -dfi)); do
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you mean $(tree -dfi) here (only one set of parens). Also, I guess we are sure the docker has the 'tree' command in it? You could use 'find' here as well.

I guess this may not matter right now, since our source URIs don't current have sub-directories of files.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wasn't sure, I'll admit that was a try-it-and-see commit. It turns out we don't, and I've replaced the tree command with a find. Thanks for the parenthesis hint!

if [[ $s == gs://* ]]; then
gsutil cp -m -r "$s" "$source_dir"
elif [[ $s == s3://* ]]; then
aws s3 cp --no-progress "$s" "$source_dir"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know we're not using aws for the source_uri, but shouldn't this have "--recursive" on it to copy an entire folder path and sub-folders?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, thanks!

@dmannarino
Copy link
Member Author

Looks good so far (assuming xargs parallelization works well), but as I comment below, don't you need a dependency so the unify_projection job finishes completely before running the pixetl job?

You're right, thanks!

@dmannarino dmannarino changed the title Add option to pre-warp to a common projection projection Add option to pre-warp to a common projection Nov 3, 2024
@dmannarino dmannarino marked this pull request as ready for review November 5, 2024 15:42
Copy link
Contributor

@gtempus gtempus left a comment

Choose a reason for hiding this comment

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

I appreciate all the descriptions, @dmannarino . 👍
No tests? 🤷
raster_tile_set_asset is getting kinda long. Did you consider decomposing that function? Just curious.

Copy link
Collaborator

@danscales danscales left a comment

Choose a reason for hiding this comment

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

Looks good! Let's get it pushed into staging and try it out on the dist alerts composites!

callback: Callback = callback_constructor(asset_id)

create_raster_tile_set_job: Job = await create_pixetl_job(
dataset, version, creation_options, "create_raster_tile_set", callback
unify_job: Job | None = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think "Job | None" is more usually expressed as Optional[Job], probably more readable.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you think it's more readable, I'll change it! It's true that it had to be expressed as you say until Python 3.10. This is my first time actually using the new syntax.

#
# USAGE: ./crosses_dateline.sh infile [outfile]
#
# if no outfile is given, the script returns "true" or "false"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think with the current modifications, there is no outfile arg, so maybe fix lines 6 and 8?

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right, thanks!

callback: Callback
):
"""
"""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a function comment here? Mainly would be that target_prefix is where the folders of warped files are placed, under SRC_0, SRC_1, SRC_2, etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, thanks!

@dmannarino
Copy link
Member Author

I appreciate all the descriptions, @dmannarino . 👍 No tests? 🤷 raster_tile_set_asset is getting kinda long. Did you consider decomposing that function? Just curious.

True. Let me decompose and write a test as a follow-up.

@dmannarino dmannarino merged commit 4dc4186 into develop Nov 5, 2024
2 checks passed
@dmannarino dmannarino deleted the add_unify_projection branch November 5, 2024 21:39

crossing_dateline=false
test $(python -c "print(${ulx}>${lrx})") = True && crossing_dateline=true
test $(python -c "print(${ulx}>${lrx})") = True && crossing_dateline=true
Copy link
Member

Choose a reason for hiding this comment

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

@dmannarino: lines 37 and 38 look identical, just a duplicate or meant to check a different condition?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oooh, good catch! It looks like I messed this up copying and pasting! They are meant to check a different condition. Will fix, thanks!

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.

5 participants