-
Notifications
You must be signed in to change notification settings - Fork 18
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
Changes to convert to cog #132
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some style comments and questions
telluric/util/raster_utils.py
Outdated
return create_option | ||
|
||
|
||
def convert_to_cog(source_file, destination_file, resampling=rasterio.enums.Resampling.gauss, blocksize=256, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is create_option
a dictionary? If so, we should add a docstring and probably rename it to create_options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check out the docstring of convert_to_cog
telluric/util/raster_utils.py
Outdated
def convert_to_cog(source_file, destination_file, resampling=Resampling.gauss): | ||
def _create_options_for_cog(create_option, source_profile, blocksize): | ||
""" | ||
it useses the profile of the source raster, override anything using the creation_options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uses
, create_options
, guarantees
telluric/util/raster_utils.py
Outdated
with TemporaryDirectory() as temp_dir: | ||
temp_file = os.path.join(temp_dir, 'temp.tif') | ||
rasterio_sh.copy(source_file, temp_file, tiled=True, compress='DEFLATE', photometric='MINISBLACK') | ||
# rasterio_sh.copy(source_file, temp_file, **create_option) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Codecov Report
@@ Coverage Diff @@
## master #132 +/- ##
==========================================
+ Coverage 89.34% 89.41% +0.06%
==========================================
Files 30 30
Lines 4270 4279 +9
==========================================
+ Hits 3815 3826 +11
+ Misses 455 453 -2
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I detected some typos, sorry for being picky 🙏
telluric/util/raster_utils.py
Outdated
"""Convert source file to a Cloud Optimized GeoTiff new file. | ||
|
||
:param source_file: path to the original raster | ||
:param destination_file: path to the new raster | ||
:param resampling: which Resampling to use on reading, default Resampling.gauss | ||
:param blocksize: the size of the blocks default 256 | ||
:param overview_blocksize: the block size of the overviews, default 256 | ||
:param create_options: <dictioanry>, options that can override the source raster profile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/dictioanry/dictionary/g
telluric/util/raster_utils.py
Outdated
:param blocksize: the size of the blocks default 256 | ||
:param overview_blocksize: the block size of the overviews, default 256 | ||
:param create_options: <dictioanry>, options that can override the source raster profile, | ||
notice that you can't override tiled=True, and the blocksize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The user can't override the blocksize
because it's a separate parameter of the function, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
telluric/util/raster_utils.py
Outdated
def _create_options_for_cog(create_options, source_profile, blocksize): | ||
""" | ||
it uses the profile of the source raster, override anything using the creation_options | ||
and grantees we will have tiled raster and blocksize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/grantees/guarantees/g
telluric/util/raster_utils.py
Outdated
def convert_to_cog(source_file, destination_file, resampling=Resampling.gauss): | ||
def _create_options_for_cog(create_options, source_profile, blocksize): | ||
""" | ||
it uses the profile of the source raster, override anything using the creation_options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/creation_options/create_options/g
Not specifying the the compressing or no-data but using what comes from the source
allowing the user to add some creation parameters
we lost the behaviour of mask, I want to do it somwhen else so I opnned a ticket #133