Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AleksMat committed Feb 21, 2018
1 parent c18f4c9 commit 070af19
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sentinelhub/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _to_tuple(bbox):
:return: A flat tuple of size
:raises: TypeError
"""
if isinstance(bbox, list) or isinstance(bbox, tuple):
if isinstance(bbox, (list, tuple)):
return BBox._tuple_from_list_or_tuple(bbox)
elif isinstance(bbox, str):
return BBox._tuple_from_str(bbox)
Expand All @@ -118,7 +118,7 @@ def _tuple_from_list_or_tuple(bbox):
"""
if len(bbox) == 4:
return tuple(map(float, bbox))
elif len(bbox) == 2 and all([isinstance(point, list) or isinstance(point, tuple) for point in bbox]):
elif len(bbox) == 2 and all([isinstance(point, (list, tuple)) for point in bbox]):
return BBox._tuple_from_list_or_tuple(bbox[0] + bbox[1])
raise TypeError('Expected a valid list or tuple representation of a bbox')

Expand Down
6 changes: 4 additions & 2 deletions sentinelhub/ogc.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def get_filename(request, date, size_x, size_y):
The files are stored in the folder specified by the user when initialising OGC-type
of request. The name of the file has the following structure:
{service_type}_{layer}_{crs}_{bbox}_{time}_{size_x}X{size_y}_{custom_url_param}_{custom_url_param_val}.{image_format}
{service_type}_{layer}_{crs}_{bbox}_{time}_{size_x}X{size_y}_{custom_url_param}_
{custom_url_param_val}.{image_format}
In case of `TIFF_d32f` a `'_tiff_depth32f'` is added at the end of the filename (before format suffix)
to differentiate it from 16-bit float tiff.
Expand Down Expand Up @@ -272,7 +273,8 @@ def get_image_dimensions(request):
:return: horizontal and vertical dimensions of requested image
:rtype: (int or str, int or str)
"""
if request.service_type is ServiceType.WCS or (isinstance(request.size_x, int) and isinstance(request.size_y, int)):
if request.service_type is ServiceType.WCS or (isinstance(request.size_x, int) and
isinstance(request.size_y, int)):
return request.size_x, request.size_y
if not isinstance(request.size_x, int) and not isinstance(request.size_y, int):
raise ValueError("At least one of parameters 'width' and 'height' must have an integer value")
Expand Down

0 comments on commit 070af19

Please sign in to comment.