Skip to content

Commit 04531f9

Browse files
author
David Nidever
committed
added configgrp to path.py
1 parent 59c7963 commit 04531f9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

python/sdss_access/path/path.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ def extract(self, name, example):
326326
template = re.sub('@apgprefix[|]', '{prefix}', template)
327327
elif re.search('@healpixgrp[|]', template):
328328
template = re.sub('@healpixgrp[|]', '{healpixgrp}', template)
329+
elif re.search('@configgrp[|]', template):
330+
template = re.sub('@configgrp[|]', '{configgrp}', template)
329331
if re.search('@plateid6[|]', template):
330332
template = re.sub('@plateid6[|]', '{plateid:0>6}', template)
331333

@@ -1268,6 +1270,27 @@ def apginst(self, filetype, **kwargs):
12681270
return instrument[telescope]
12691271
return ''
12701272

1273+
def configgrp(self, filetype, **kwargs):
1274+
''' Returns configuration summary file group subdirectory
1275+
1276+
Parameters
1277+
----------
1278+
filetype : str
1279+
File type parameter.
1280+
configid : int or str
1281+
Configuration ID number. Will be converted to int internally.
1282+
1283+
Returns
1284+
-------
1285+
configgrp : str
1286+
Configuration group directory in the format ``NNNNXX``.
1287+
1288+
'''
1289+
1290+
configid = kwargs.get('configid', None)
1291+
if not configid:
1292+
return '0000XX'
1293+
return '{:0>4d}XX'.format(int(configid) // 100)
12711294

12721295
class AccessError(Exception):
12731296
pass

0 commit comments

Comments
 (0)