Skip to content

Commit 37f22ff

Browse files
authored
Merge pull request #196 from desihub/195-column_descriptions-with-shorter-descriptions-for-fits-headers
Updated column_description.csv with short descriptions
2 parents 6937e98 + 547accc commit 37f22ff

File tree

7 files changed

+472
-465
lines changed

7 files changed

+472
-465
lines changed

doc/DESI_SPECTRO_REDUX/SPECPROD/zcatalog/zpix-SURVEY-PROGRAM.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Required Data Table Columns
9595
========================== =========== ============ =====================================================================================================================================
9696
Name Type Units Description
9797
========================== =========== ============ =====================================================================================================================================
98-
TARGETID int64 ID (unique to file? and the whole survey?)
98+
TARGETID int64 Unique DESI target ID
9999
SURVEY [1]_ char[7] Survey name
100100
PROGRAM [1]_ char[6] DESI program type - BRIGHT, DARK, BACKUP, OTHER
101101
HEALPIX int32 HEALPixel containing this location at NSIDE=64 in the NESTED scheme

doc/DESI_SPECTRO_REDUX/SPECPROD/zcatalog/ztile-SURVEY-PROGRAM-GROUPTYPE.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Required Data Table Columns
9494
========================== =========== ============ =====================================================================================================================================
9595
Name Type Units Description
9696
========================== =========== ============ =====================================================================================================================================
97-
TARGETID int64 ID (unique to file? and the whole survey?)
97+
TARGETID int64 Unique DESI target ID
9898
SURVEY [1]_ char[7] Survey name
9999
PROGRAM [1]_ char[6] DESI program type - BRIGHT, DARK, BACKUP, OTHER
100100
LASTNIGHT int32 Final night of observation included in a series of coadds

doc/changes.rst

+3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ desidatamodel Change Log
1111
* Update definition of ``ZCAT_NSPEC`` (PR `#187`_).
1212
* Add note about equivalent width values in ``fuji`` and ``guadalupe`` (PR `#181`_).
1313
* Add note about units in FITS files (PR `#178`_).
14+
* Update ``column_descriptions.csv`` for short Description (for FITS headers)
15+
and FullDescription (longer, for data model) (PR `#196`_).
1416

1517
.. _`#178`: https://github.com/desihub/desidatamodel/pull/178
1618
.. _`#181`: https://github.com/desihub/desidatamodel/pull/181
1719
.. _`#187`: https://github.com/desihub/desidatamodel/pull/187
1820
.. _`#189`: https://github.com/desihub/desidatamodel/pull/189
1921
.. _`#192`: https://github.com/desihub/desidatamodel/pull/192
2022
.. _`#193`: https://github.com/desihub/desidatamodel/pull/193
23+
.. _`#196`: https://github.com/desihub/desidatamodel/pull/196
2124

2225
23.1 (2023-06-12)
2326
-----------------

py/desidatamodel/data/column_descriptions.csv

+452-452
Large diffs are not rendered by default.

py/desidatamodel/stub.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ def read_column_descriptions(filename):
701701
"""Read column descriptions csv file and return dictionary
702702
703703
Args:
704-
filename (str): csv filename with columns NAME,TYPE,UNITS,DESCRIPTION
704+
filename (str): csv filename with columns NAME,TYPE,UNITS,DESCRIPTION,FULLDESCRIPTION
705705
706706
Returns:
707707
coldesc_dict[NAME] = dict with keys TYPE, UNITS, DESCRIPTION
@@ -713,15 +713,15 @@ def read_column_descriptions(filename):
713713

714714
with open(filename) as fp:
715715
header = fp.readline().strip()
716-
correct_header = 'Name,Type,Units,Description'
716+
correct_header = 'Name,Type,Units,Description,FullDescription'
717717
if header != correct_header:
718-
raise ValueError(f'{filename} header {header} should be {correct_header}')
718+
raise ValueError(f'{filename} header {header} should be {correct_header}.')
719719

720720
coldesc = dict()
721721
csvreader = csv.reader(fp)
722722
for row in csvreader:
723-
name, dtype, units, desc = row
724-
coldesc[name] = dict(Type=dtype, Units=units, Description=desc)
723+
name, dtype, units, short_desc, full_desc = row
724+
coldesc[name] = dict(Type=dtype, Units=units, Description=full_desc)
725725

726726
return coldesc
727727

@@ -754,7 +754,7 @@ def main():
754754
parser.add_argument('filename', help='A FITS file.', metavar='FILE',
755755
nargs='+')
756756
parser.add_argument("--column_descriptions",
757-
help="CSV file with column info Name,Type,Units,Description; "
757+
help="CSV file with column info Name,Type,Units,Description,FullDescription; "
758758
"default=%(default)s",
759759
default=(ir.files('desidatamodel') / 'data' / 'column_descriptions.csv'))
760760

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Name,Type,Units,Description
2-
target,char[20],,Target Name
3-
V_mag,float32,nanomaggy,V-band nanomaggy to test units
4-
vdisp,float64,m/s,Velocity dispersion
1+
Name,Type,Units,Description,FullDescription
2+
target,char[20],,Target Name,Target Name
3+
V_mag,float32,nanomaggy,V-band flux,V-band nanomaggy to test units
4+
vdisp,float64,m/s,Vel Disp,Velocity dispersion

py/desidatamodel/test/test_stub.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,10 @@ def test_Stub_with_descriptions(self, mock_log):
685685

686686
# incorrect format column description file
687687
baddescfile = self.test_files / 'bad_column_descriptions.csv'
688-
with self.assertRaises(ValueError):
688+
header = 'Name,dtype,Units,Description'
689+
correct_header = 'Name,Type,Units,Description,FullDescription'
690+
with self.assertRaises(ValueError) as exc:
689691
stub = Stub(filename, description_file=baddescfile)
690692
lines = str(stub)
693+
self.assertEqual(exc.exception.args[0],
694+
f'{str(baddescfile)} header {header} should be {correct_header}.')

0 commit comments

Comments
 (0)