Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
evil hack for #361
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Sep 11, 2017
1 parent 95d5bf2 commit ff506da
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cate/util/im/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,10 @@ def pad_tile(tile: Tile, target_tile_size: Size2D, fill_value: float = np.nan) -
return tile


LC_STANDARD_NAMES = {'land_cover_lccs algorithmic_confidence', 'land_cover_lccs status_flag', 'land_cover_lccs',
'land_cover_lccs number_of_observations', 'land_cover_lccs status_flag'}


class ImagePyramid:
"""
A stack of tiled images (see TileImage) that form a quadtree image pyramid with increasing levels of detail.
Expand Down Expand Up @@ -773,6 +777,18 @@ def compute_layout(array=None,
:param num_levels: optional number of levels
:return: pyramid layout as tuple (max_size, tile_size, num_level_zero_tiles, num_levels)
"""

# TODO (forman): this is an evil hack for issue # for LC CCI data.
# Must replace it by some automatics detection.
# This is only for full-size product, it won't work for spatial subsets at all
if hasattr(array, 'attrs') and 'standard_name' in array.attrs:
standard_name = array.attrs['standard_name']
if standard_name in LC_STANDARD_NAMES:
w = array.shape[-1]
h = array.shape[-2]
if w == 129600 and h == 64800:
return (w, h), (675, 675), (6, 3), 6

if array is not None and hasattr(array, 'shape'):
size = array.shape[-1], array.shape[-2]
if not max_size:
Expand Down

0 comments on commit ff506da

Please sign in to comment.