- Subject: [slang-users] slciftsio bug fix (plus optional change)
- From: arik.mitschang@xxxxxxxxx
- Date: Wed, 25 Sep 2013 15:42:14 +1000
Hi John,
I ran across a bug in cfitsio in the handling of string columns whose
TDIMn keyword is specified. In the example I have, a 32 character string
has the TDIMn=(32), which, according to the standard, is valid, but the
slang fits implementation (specifically the higher level fits_read_*
functions) attempts to convert this to a [nrow,32] array. The following
fix works for my case, and hopefully more generally.
Also included in the patch is a change of behaviour: when tdim specifies
an array of exactly a single element, do not reshape to [nrow,1]. I
personally find that more appropriate.
Cheers,
-Arik
--- /usr/local/share/slsh/local-packages/fits.sl 2013-02-04 12:15:16.471742949 +1100
+++ fits.sl 2013-09-25 15:36:23.682466822 +1000
@@ -768,10 +768,13 @@
variable col = columns[i];
variable data = data_arrays[i];
variable tdim = tdims[i];
- if (tdim != NULL)
+ if (tdim != NULL && _typeof(data)!= String_Type)
{
- tdim = convert_tdim_string (tdim, want_num_rows);
- reshape (data, tdim);
+ if (tdim != "(1)")
+ {
+ tdim = convert_tdim_string (tdim, want_num_rows);
+ reshape (data, tdim);
+ }
}
else if (typeof (data) == Array_Type)
{
[2013 date index]
[2013 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]