#169: Add support for complex numbers to CF
-----------------------------+------------------------------
Reporter: mikedixon | Owner: cf-conventions@…
Type: enhancement | Status: new
Priority: high | Milestone:
Component: cf-conventions | Version:
Resolution: | Keywords:
-----------------------------+------------------------------
Comment (by piyush.agram):
Hi,
I wanted to comment on this CF proposal from an implementer's point of
view (I apologize if my perspective is HDF5 and GDAL centered).
1. Representation of complex numbers.
- Would it be possible to consider using compound data types? This is
already the case with h5py and storing numpy.complex datatypes. Here is an
example h5ls output for a numpy.complex64 array written using h5py
{{{
f32 Dataset {5/5, 5/5}
Location: 1:1400
Links: 1
Storage: 200 logical bytes, 200 allocated bytes, 100.00% utilization
Type: struct {
"r" +0 native float
"i" +4 native float
} 8 bytes
}}}
2. Products generated like these are already by GDAL's HDF5 driver and
treated as complex data. See
https://github.com/OSGeo/gdal/blob/master/gdal/frmts/hdf5/hdf5dataset.cpp#L407-L448
3. In general, working with an extra complex dimension seems cumbersome
since a lot of SAR/InSAR datasets now are represented as data cubes
(acquisitiondate, time, range) or (baseline, time, range) for stacks/
tomograms. It would be lot simpler if queries for dimensions directly
returned the sizes instead of us having to check for dimension size of 2
and is_complex. This is a personal preference I guess.
4. I like the idea of is_complex attribute for disambiguation. As an
implementer, I would detect a compound data type and confirm with this
attribute that the data represents complex numbers.
5. I would prefer the usage of a different attribute name than "units".
Very often, amplitudes are replaced by a coherence / correlation measure
which are unitless. Maybe something like "format" or "representation"
which could be used as follows:
{{{
# For real and imaginary parts
IQ:format = "cartesian"
# For polar representation for fields like coherence/correlation
IQ:format = "amplitude,degree"
# For db representation
IQ:format = "dBm,degree"
}}}
Thanks for starting this discussion.
Piyush
--
Ticket URL: <https://cf-trac.llnl.gov/trac/ticket/169#comment:4>
CF Metadata <http://cf-convention.github.io/>
CF Metadata