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

Fix geogrid chunking to accept "auto" and to preserve dtype #61

Merged
merged 3 commits into from
Nov 21, 2023

Conversation

mraspaud
Copy link
Member

This PR fixes the GeoGridInterpolator to preserve type and accept "auto" and other string chunk specifications.

  • Closes #xxxx
  • Tests added
  • Tests passed
  • Passes git diff origin/main **/*py | flake8 --diff
  • Fully documented

@mraspaud mraspaud self-assigned this Nov 15, 2023
Copy link

codecov bot commented Nov 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (11e0519) 88.07% compared to head (ed60b5c) 88.31%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
+ Coverage   88.07%   88.31%   +0.24%     
==========================================
  Files          21       21              
  Lines        1434     1464      +30     
==========================================
+ Hits         1263     1293      +30     
  Misses        171      171              
Flag Coverage Δ
unittests 88.31% <100.00%> (+0.24%) ⬆️

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.


vchunks = range(0, shape[0], v_chunk_size)
hchunks = range(0, shape[1], h_chunk_size)
chunks = normalize_chunks(chunks, shape, dtype=self.values.dtype)
Copy link
Member

Choose a reason for hiding this comment

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

Is there no input dask array to take the chunk size from or to calculate the chunk size from (ex. multiply by a factor)?

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 think this is very dependent on the input data/reader. In the cases where the chunk sizes are known and provided here, normalize_chunks should not be interfering.

Eg:

In [6]: normalize_chunks(((2, 2, 2, 2, 2), (2, 2, 2, 2, 2)), (10, 10), dtype=np.float32)
Out[6]: ((2, 2, 2, 2, 2), (2, 2, 2, 2, 2))

However, using it allows passing more abstract values, like 10MiB or auto.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good

@coveralls
Copy link

Coverage Status

coverage: 87.468% (+0.2%) from 87.219%
when pulling ed60b5c on mraspaud:fix-dask-chunking-geogrid
into 11e0519 on pytroll:main.

@mraspaud mraspaud mentioned this pull request Nov 16, 2023
11 tasks
@mraspaud mraspaud merged commit de23a17 into pytroll:main Nov 21, 2023
17 checks passed
@mraspaud mraspaud deleted the fix-dask-chunking-geogrid branch November 21, 2023 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants