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

Changes to convert to cog #132

Merged
merged 4 commits into from
Aug 22, 2018
Merged

Changes to convert to cog #132

merged 4 commits into from
Aug 22, 2018

Conversation

guydou
Copy link
Contributor

@guydou guydou commented Aug 22, 2018

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

Copy link
Contributor

@astrojuanlu astrojuanlu left a 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

return create_option


def convert_to_cog(source_file, destination_file, resampling=rasterio.enums.Resampling.gauss, blocksize=256,
Copy link
Contributor

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

Copy link
Contributor Author

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

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
Copy link
Contributor

Choose a reason for hiding this comment

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

uses, create_options, guarantees

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@codecov-io
Copy link

codecov-io commented Aug 22, 2018

Codecov Report

Merging #132 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
telluric/util/raster_utils.py 91.5% <100%> (+1.91%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9bee4df...5bda8c0. Read the comment docs.

Copy link
Contributor

@astrojuanlu astrojuanlu left a 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 🙏

"""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,
Copy link
Contributor

Choose a reason for hiding this comment

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

s/dictioanry/dictionary/g

: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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

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
Copy link
Contributor

Choose a reason for hiding this comment

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

s/grantees/guarantees/g

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
Copy link
Contributor

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

@astrojuanlu astrojuanlu merged commit ddc884e into master Aug 22, 2018
@astrojuanlu astrojuanlu deleted the cover_to_cog_changes branch August 22, 2018 10:27
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