Skip to content

Commit

Permalink
Change the way the base URL is computed in HipsSurveyDescription
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeil committed Jul 2, 2017
1 parent 7ee7ab1 commit 8af9058
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
19 changes: 10 additions & 9 deletions hips/tiles/surveys.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ class HipsSurveyProperties:
Examples
--------
>>> url = 'https://raw.githubusercontent.com/hipspy/hips/master/hips/tiles/tests/data/properties.txt'
>>> from hips import HipsSurveyProperties
>>> url = 'http://alasky.unistra.fr/DSS/DSS2Merged/properties'
>>> hips_survey_property = HipsSurveyProperties.fetch(url)
>>> hips_survey_property.base_url
'http://alasky.u-strasbg.fr/DSS/DSSColor'
'http://alasky.u-strasbg.fr/DSS/DSS2Merged'
"""
hips_to_astropy_frame_mapping = OrderedDict([
('equatorial', 'icrs'),
Expand Down Expand Up @@ -91,11 +92,6 @@ def parse(cls, text: str) -> 'HipsSurveyProperties':

return cls(data)

@property
def base_url(self) -> str:
"""HiPS service base URL (`str`)."""
return self.data['hips_service_url']

@property
def title(self) -> str:
"""HiPS title (`str`)."""
Expand Down Expand Up @@ -127,14 +123,19 @@ def tile_format(self) -> str:
return self.data['hips_tile_format']

@property
def access_url(self):
def base_url(self):
"""HiPS access url"""
return self.data['moc_access_url'].rsplit('/', 1)[0]

@property
def tile_access_url(self):
"""Tile access URL for a HiPS surveys"""
return self.access_url + '/Norder' + str(self.hips_order) + '/Dir0/'
return self.base_url + '/Norder' + str(self.hips_order) + '/Dir0/'

@property
def hips_service_url(self) -> str:
"""HiPS service base URL (`str`)."""
return self.data['hips_service_url']


class HipsSurveyPropertiesList:
Expand Down
7 changes: 2 additions & 5 deletions hips/tiles/tests/test_surveys.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ def setup_class(cls):
filename = get_pkg_data_filename('data/properties.txt')
cls.hips_survey_property = HipsSurveyProperties.read(filename)

def test_base_url(self):
assert self.hips_survey_property.base_url == 'http://alasky.u-strasbg.fr/DSS/DSSColor'

def test_title(self):
assert self.hips_survey_property.title == 'DSS colored'

Expand All @@ -31,8 +28,8 @@ def test_hips_order(self):
def test_tile_format(self):
assert self.hips_survey_property.tile_format == 'jpeg'

def test_access_url(self):
assert self.hips_survey_property.access_url == 'http://alasky.u-strasbg.fr/DSS/DSSColor'
def test_base_url(self):
assert self.hips_survey_property.base_url == 'http://alasky.u-strasbg.fr/DSS/DSSColor'

def test_tile_access_url(self):
assert self.hips_survey_property.tile_access_url == 'http://alasky.u-strasbg.fr/DSS/DSSColor/Norder9/Dir0/'
Expand Down

0 comments on commit 8af9058

Please sign in to comment.