Hi PDL Wizards,

I am creating a routine that reads a sequence of HDF files, extracts their
content, combines with some other information, and produces a data structure
with the multi-file output. The final data structure is a hash with values
that are either Perl arrays or piddles, depending on the data type. The code
does this to combine the data from a single HDF file $little_piddle_hash
into the multi-file output $big_piddle_hash :

            foreach(keys %big_piddle_hash){
                if(ref($big_piddle_hash{$_}) eq 'PDL'){
        
$big_piddle_hash{$_}=$big_piddle_hash{$_}->append(${$little_piddle_hash}{$_}
);
                } else {
        
$big_piddle_hash{$_}=[$big_piddle_hash{$_},${$little_piddle_hash}{$_}];}

The error from PDL looks like this:

Uncaught exception from user code:
        PDL: PDL::Primitive::append(a,b,c): Parameter 'b':
  Mismatched implicit thread dimension 0: size 10264 vs. 7638
There are 3 PDLs in the expression; 1 thread dim.
   PDL IN EXPR.    ACTIVE DIMS | THREAD DIMS
   #  0 (normal):            8 |    10264
   #  1 (normal):            8 |     7638
   #  2 (null)

My questions are these:

Q1. It appears that '$fielddata = $hdfobj->SDget($field);' returns a 'null
piddle' if the HDF file does not contain $field. Q1A: Why does it not just
return undefined? Q1B: What is the easiest way to check for this condition?

Q2: What other checks can I put in to avoid this error?

Thanks in advance,

--Edward H.


Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
_______________________________________________
pdl-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdl-general

Reply via email to