-
Notifications
You must be signed in to change notification settings - Fork 21
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
Review/cog optimized geotiffs #98
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed! |
||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "793aee06", | ||
"metadata": {}, | ||
|
@@ -27,25 +28,26 @@ | |
"mamba env create -f environment.yml\n", | ||
"```\n", | ||
"\n", | ||
"then activate and select the kernel in the notebook (running in Jupyter)\n", | ||
"Finally, you may activate and select the kernel in the notebook (running in Jupyter)\n", | ||
"\n", | ||
"```bash\n", | ||
"conda activate coguide-cog\n", | ||
"```\n", | ||
"\n", | ||
"This notebook has been tested to work with the listed Conda environment." | ||
"The notebook has been tested to work with the listed Conda environment." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "5a8aa8b4", | ||
"metadata": {}, | ||
"source": [ | ||
"## Setup\n", | ||
"\n", | ||
"For demonstrating some COG concepts, we will download a regular GeoTIFF, create a Cloud-Optimized GeoTIFF and explore how they are different.\n", | ||
"To demonstrate some COG concepts, we will download a regular GeoTIFF, create a Cloud-Optimized GeoTIFF, and explore their differences.\n", | ||
"\n", | ||
"First we use the [earthaccess](https://github.com/nsidc/earthaccess) library to setup credentials to fetch data from NASA's EarthData catalog." | ||
"First, we use the [earthaccess](https://github.com/nsidc/earthaccess) library to set up credentials to fetch data from NASA's EarthData catalog." | ||
] | ||
}, | ||
{ | ||
|
@@ -102,13 +104,14 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "8ecd2c7c", | ||
"metadata": {}, | ||
"source": [ | ||
"## Download a GeoTIFF from EarthData\n", | ||
"\n", | ||
"Note: The whole point of is that we _don't_ download data. So in future examples, we will demonstrate how to access just subsets of data using COG and compare that with a GeoTIFF." | ||
"Note: The whole point is that we _don't_ download data. So, in future examples, we will demonstrate how to access just subsets of data using COG and compare that with a GeoTIFF." | ||
] | ||
}, | ||
{ | ||
|
@@ -188,13 +191,14 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "451dbe01", | ||
"metadata": {}, | ||
"source": [ | ||
"## Is it a valid COG?\n", | ||
"\n", | ||
"We can use `rio_cogeo.cog_validate` to check. It returns `is_valid`, `errors` and `warnings`." | ||
"We can use `rio_cogeo.cog_validate` to check. It returns `is_valid`, `errors`, and `warnings`:" | ||
] | ||
}, | ||
{ | ||
|
@@ -232,25 +236,27 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "25a82b89", | ||
"metadata": {}, | ||
"source": [ | ||
"Return values:\n", | ||
"Here's some more context on the output message:\n", | ||
" \n", | ||
"1. `is_valid` is `False`: this is not a valid COG.\n", | ||
"2. `errors` are `'The file is greater than 512xH or 512xW, but is not tiled'`. To be a valid COG, the file should be tiled since it has a height and width both greater than 512.\n", | ||
"3. `warnings` are `'The file is greater than 512xH or 512xW, it is recommended to include internal overviews'`. It is recommended to provide overviews." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "f2826f57-6df4-458f-98b2-f639f25450ba", | ||
"metadata": {}, | ||
"source": [ | ||
"## Converting a GeoTIFF to COG\n", | ||
"\n", | ||
"We can use `rio_cogeo.cog_create` to convert a GeoTIFF into a Cloud Optimized GeoTIFF" | ||
"We can use `rio_cogeo.cog_create` to convert a GeoTIFF into a Cloud Optimized GeoTIFF:" | ||
] | ||
}, | ||
{ | ||
|
@@ -299,25 +305,25 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "35f1787d", | ||
"metadata": {}, | ||
"source": [ | ||
"This is a valid COG, so we will use it to compare with our GeoTIFF." | ||
"The file is a valid COG, so we will use it to compare with our GeoTIFF." | ||
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "ff2cc531", | ||
"metadata": {}, | ||
"source": [ | ||
"## Data Structure\n", | ||
"\n", | ||
"**Dimensions**\n", | ||
"Dimensions are the number of bands, rows and columns stored in a GeoTIFF. [More Info](intro.qmd#dimensions)\n", | ||
"**Dimensions**: the number of bands, rows, and columns stored in a GeoTIFF. [More Info](intro.qmd#dimensions)\n", | ||
"\n", | ||
"**Internal Blocks** (aka chunks or internal tiles)\n", | ||
"Internal blocks are required if the dimensions of data are over 512x512. [More Info](intro.qmd#internal-blocks)\n", | ||
"**Internal Blocks (chunks or internal tiles)**: Internal blocks are required if the data dimensions are over 512x512. [More Info](intro.qmd#internal-blocks)\n", | ||
"\n", | ||
"Let's check out the dimensions and blocks of our GeoTIFF and Cloud-Optimized GeoTIFF." | ||
] | ||
|
@@ -363,13 +369,14 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "51828845-3531-4813-b694-25a4563a58f5", | ||
"metadata": {}, | ||
"source": [ | ||
"They have the same dimensions which is what we expect, so that is good!\n", | ||
"They have the exact dimensions that we expected, which is good!\n", | ||
"\n", | ||
"We can also print information about the GeoTIFF's IFD (Internal File Directory). Only one item is returned because the GeoTIFF doesn't have overviews. When we print the IFD info for the COG, which has overviews, we see more items returned." | ||
"We can also print information about the GeoTIFF's IFD (Internal File Directory). Only one item is returned because the GeoTIFF needs overviews. We see more items returned when we print the IFD info for the COG, which has overviews." | ||
] | ||
}, | ||
{ | ||
|
@@ -426,6 +433,7 @@ | |
] | ||
}, | ||
{ | ||
"attachments": {}, | ||
"cell_type": "markdown", | ||
"id": "12c0b3e4", | ||
"metadata": {}, | ||
|
@@ -434,14 +442,14 @@ | |
"\n", | ||
"Overviews are downsampled (aggregated) data intended for visualization.\n", | ||
"\n", | ||
"The smallest size overview should match the tiling components’ fetch size, typically 256x256. Due to aspect ratio variation just aim to have at least one dimension at or slightly less than 256. \n", | ||
"> The COG driver in GDAL, or rio cogeo tools should do this.\n", | ||
"The most miniature size overview should match the tiling components’ fetch size, typically 256x256. Due to aspect ratio variation, aim to have at least one dimension at or slightly less than 256. \n", | ||
"> The COG driver in GDAL or rio cogeo tools should do this.\n", | ||
"\n", | ||
"There are many resampling algorithms for generating overviews. The best resampling algorithm depends on the range, type, and distribution of the data. When creating overviews several options should be compared before deciding which resampling method to apply. \n", | ||
"There are many resampling algorithms for generating overviews. The best resampling algorithm depends on the data's range, type, and distribution. When creating overviews, several options should be compared before deciding which resampling method to apply. \n", | ||
"\n", | ||
"GDAL >= 3.2 allows for the overview resampling method to be set directly.\n", | ||
"\n", | ||
"<!-- TODO: need to add hints on how to check which resampling method to use for overviews. Possibly provide code for comparing. Alex has a draft of this to add.-->" | ||
"For more information on overviews, see the [COG overview resampling notebook](cogs-overview_resampling.ipynb)." | ||
] | ||
}, | ||
{ | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
TODO: for later, we should add a section showing a verification that the values of the data have not changed in the conversion. This question/issue actually came up recently.
Reply via ReviewNB
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.
Opened issue #99