@@ -334,6 +334,10 @@ def extract(self, name, example):
334334 template = re .sub ('@pad_fieldid[|]' , '{fieldid}' , template )
335335 if re .search ('@plateid6[|]' , template ):
336336 template = re .sub ('@plateid6[|]' , '{plateid:0>6}' , template )
337+ if re .search ('@component_default[|]' , template ):
338+ template = re .sub ('@component_default[|]' , '{component_default}' , template )
339+ if re .search ('@catalogid_groups[|]' , template ):
340+ template = re .sub ('@catalogid_groups[|]' , '{catalogid_groups}' , template )
337341
338342 # check if template has any brackets
339343 haskwargs = re .search ('[{}]' , template )
@@ -1215,6 +1219,59 @@ def healpixgrp(self, filetype, **kwargs):
12151219 subdir = "{:d}" .format (healpix // 1000 )
12161220 return subdir
12171221
1222+ def catalogid_groups (self , filetype , ** kwargs ):
1223+ '''
1224+ Return a folder structure to group data together based on their catalog
1225+ identifier so that we don't have too many files in any one folder.
1226+
1227+ Parameters
1228+ ----------
1229+ filetype : str
1230+ File type parameter.
1231+ catalogid : int or str
1232+ SDSS-V catalog identifier
1233+
1234+ Returns
1235+ -------
1236+ catalogid_group : str
1237+ A set of folders.
1238+ '''
1239+ catalogid = int (kwargs ['catalogid' ])
1240+ return f"{ catalogid % 10000 :.0f} /{ catalogid % 100 :.0f} "
1241+
1242+ def component_default (self , filetype , ** kwargs ):
1243+ ''' Return the component name, if given.
1244+
1245+ The component designates a stellar or planetary body following the
1246+ Washington Multiplicity Catalog, which was adopted by the XXIV meeting
1247+ of the International Astronomical Union. When no component is given,
1248+ the star is assumed to be without a discernible companion. When a
1249+ component is given it follows the system (Hessman et al., arXiv:1012.0707):
1250+
1251+ – the brightest component is called “A”, whether it is initially resolved
1252+ into sub-components or not;
1253+ – subsequent distinct components not contained within “A” are labeled “B”,
1254+ “C”, etc.;
1255+ – sub-components are designated by the concatenation of on or more suffixes
1256+ with the primary label, starting with lowercase letters for the 2nd
1257+ hierarchical level and then with numbers for the 3rd.
1258+
1259+ Parameters
1260+ ----------
1261+ filetype : str
1262+ File type parameter. This argument is not used here, but is required for
1263+ all special functions in the `sdss_access` product.
1264+ component : str [optional]
1265+ The component name as given by the fields.
1266+
1267+ Returns
1268+ -------
1269+ component : str
1270+ The component name if given, otherwise a blank string.
1271+ '''
1272+ # the (..) or '' resolves None to ''
1273+ return str (kwargs .get ('component' , '' ) or '' )
1274+
12181275 def apgprefix (self , filetype , ** kwargs ):
12191276 ''' Returns APOGEE prefix using telescope/instrument.
12201277
0 commit comments