bugfix in save_gdal for boolean type & cluster.split_box2sub_boxes for tiny last step#1024
Merged
yunjunz merged 4 commits intoinsarlab:mainfrom Jun 14, 2023
Merged
bugfix in save_gdal for boolean type & cluster.split_box2sub_boxes for tiny last step#1024yunjunz merged 4 commits intoinsarlab:mainfrom
save_gdal for boolean type & cluster.split_box2sub_boxes for tiny last step#1024yunjunz merged 4 commits intoinsarlab:mainfrom
Conversation
…st one + objects.cluster.split_box2sub_boxes(): if the last step is too small (<5% or <5 pixels), merge it to the 2nd last one. This change is necessary to avoid the reshaping error when the step size of the last sub-box is 1, turning a 3D matrix into 2D, thus, resulting in a reshape error, such as in diff.py. + update the num_box based on the returned box_list from split_box2sub_boxes(), as it maybe different from the initially input num_box. This is similar to insarlab#940, but search and update all the other instances.
+ save_gdal.py: convert numpy array from boolean to uint8, as GDAL does not support boolean data type, such as used in all the mask files.
save_gdal for boolean type & cluster.split_box* for very large sizesave_gdal + cluster.split_box2sub_boxes return updated num_box
save_gdal + cluster.split_box2sub_boxes return updated num_boxsave_gdal for boolean type & cluster.split_box2sub_boxes for tiny last step
yunjunz
added a commit
to yunjunz/MintPy
that referenced
this pull request
Jun 14, 2023
…` for tiny last step (insarlab#1024) + `save_gdal.py`: convert numpy array from boolean to uint8, as GDAL does not support boolean data type, such as used in all the mask files. + `objects.cluster.split_box2sub_boxes()`: avoid the tiny last step (<5% of the normal step, or <5 pixels), by merging it into the 2nd last one. This happens to very large datasets sometimes. For example, if the last step has a size of 1, a 3D matrix will be turned into 2D, resulting in a reshape error. + `objects.cluster.split_box2sub_boxes()`: return the final number of sub_boxes, in addition to the current list of sub_boxes, for easier usage (as it may be different from the initial num_box as identified in insarlab#940). Update the usage in all occurrences: - objects.resample - dem_error - diff - reference_date - timeseries2velocity
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of proposed changes
save_gdal.py: convert numpy array from boolean to uint8, as GDAL does not support boolean data type, such as used in all the mask files.objects.cluster.split_box2sub_boxes(): avoid the tiny last step (<5% of the normal step, or <5 pixels), by merging it into the 2nd last one. This happens to very large datasets sometimes. For example, if the last step has a size of 1, a 3D matrix will be turned into 2D, resulting in a reshape error.objects.cluster.split_box2sub_boxes(): return the final number of sub_boxes, in addition to the current list of sub_boxes, for easier usage (as it may be different from the initial num_box as identified inresample: fix discrepancy betweennum_boxanddest_box_list#940). Update the usage in all occurrences:Reminders