Repository: SETI/rms-cspyce (language: python)

Issue:
dskgd has incorrect DSK descriptor values
`dskgd`returns the DSK descriptor of a DSK segment. Here is the first half of the unit test:

```
def test_dskgd():
    # open the dsk file
    handle = cs.dasopr(ExtraKernels.phobosDsk)
    # get the dladsc from the file
    dladsc = cs.dlabfs(handle)
    # get dskdsc for target radius
    dskdsc = cs.dskgd(handle, dladsc)
```

The problem here is the values being returned in the `dskdsc` array. The array is split up into two distinct sections. 

The first section is a series of `int` values, while the second section is a series of c-double (or Python float) values. This is what the full result should look like:

```
DSK descriptor contents:
401
401
1
2
10021
1
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
-3.141593
3.141593
-1.570796
1.570796
8.049632
13.940940
-1577879958.816059
1577880066.183913
```


This is the current output:

```
8.5092e-312
4.24399e-314
2.122e-314
0
0
0
0
0
0
0
0
0
0
-3.14159
3.14159
-1.5708
1.5708
8.1819
13.8934
-1.57788e+09
1.57788e+09
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
```

The trailing zeros may also be included in the first example. The concern is with the `int` values being incorrect. It may have to do with Python arrays not allowing multiple datatypes. 


Discussion / hints:

Fix patch:
diff --git a/swig/cspyce0.i b/swig/cspyce0.i
index ce371a6c..8a69742d 100644
--- a/swig/cspyce0.i
+++ b/swig/cspyce0.i
@@ -14,7 +14,7 @@
 #define DAFSIZE 125     // size of DAF summary
 #define DASSIZE 256     // DAS size
 #define DLASIZE 8
-#define DSKSIZE 42
+#define DSKSIZE 21      // size in "doubles".  It's 6 integers then 18 doubles
 
 #define CLAUSES 100     // max number of expressions in a SELECT clause
 #define COLLEN 100      // max length of string columns or parsed items


Test patch:
diff --git a/unittests/test_d.py b/unittests/test_d.py
index 6168730f..2922a3e6 100644
--- a/unittests/test_d.py
+++ b/unittests/test_d.py
@@ -867,18 +867,36 @@ def test_dskd02():
     cs.dascls(handle)
 
 
-def fail_dskgd():
+DSK_DESCRIPTOR_TYPE =  np.dtype([
+    ('surfce', np.int32),
+    ('center', np.int32),
+    ('dclass', np.int32),
+    ('dtype_', np.int32),  # had to rename from dtype, which is taken.
+    ('frmcde', np.int32),
+    ('corsys', np.int32),
+    ('corpar', np.double, 10),
+    ('co1min', np.double),
+    ('co1max', np.double),
+    ('co2min', np.double),
+    ('co2max', np.double),
+    ('co3min', np.double),
+    ('co3max', np.double),
+    ('start',  np.double),
+    ('stop',   np.double)])
+
+def test_dskgd():
     # open the dsk file
     handle = cs.dasopr(ExtraKernels.phobosDsk)
     # get the dladsc from the file
     dladsc = cs.dlabfs(handle)
     # get dskdsc for target radius
     dskdsc = cs.dskgd(handle, dladsc)
-    # test results
+    dskdsc = np.rec.array(dskdsc, dtype=DSK_DESCRIPTOR_TYPE)[0]
+
     assert dskdsc.surfce == 401
     assert dskdsc.center == 401
     assert dskdsc.dclass == 1
-    assert dskdsc.dtype == 2
+    assert dskdsc.dtype_ == 2
     assert dskdsc.frmcde == 10021
     assert dskdsc.corsys == 1
     npt.assert_almost_equal(dskdsc.corpar, np.zeros(10))