pyrocko.carpet¶
Multi-component waveform data model.
A Carpet holds the samples of several components on a common
time axis in a single 2D array. Typical uses are the waveforms of a
multi-component sensor or of a sensor array, and spectrograms, where each
component is a frequency band (see Carpet.component_axes).
Carpets can be stored in files of the .rug format (see
pyrocko.io.rug) and are handled by Squirrel like other content
(see pyrocko.squirrel.base.Squirrel.get_carpets()).
Note
This module is experimental. Its interface may still change and a warning is shown when it is used.
Functions
|
Check that carpets have the same sampling and components. |
|
Check that carpets with the same codes do not overlap in time. |
|
Check that two carpets have the same components. |
|
Cross-correlate traces and/or carpets. |
|
Join carpets which are contiguous in time. |
|
Sum carpets sample by sample. |
Classes
|
Container for multi-component waveforms with common time span and sampling. |
|
Summary statistics of the data samples of a carpet. |
|
Placeholder values for |
Exceptions
Base class for errors raised by |
|
Raised by some |
|
Raised when |
- exception CarpetOverlapError[source]¶
Bases:
CarpetErrorRaised by some
Carpetoperations when carpets overlap but should not (seecheck_overlaps()).
- exception CarpetResampleError[source]¶
Bases:
CarpetErrorRaised when
Carpet.resample_band()cannot be applied.
- class CarpetStringFiller(carpet, additional={})[source]¶
Bases:
objectPlaceholder values for
Carpet.fill_template().Gives access to the following placeholders by name:
network,station,location,channel,extraCodes of the carpet (
Carpet.codes).network_safe, …,extra_safe,nslce_safe,nslc_safeThe same, with characters other than
0-9,A-Z,a-z,_and-replaced by_, for use in file names.nslce_safeandnslc_safejoin the codes with..network_dsafe, …,extra_dsafeLike the
_safevariants, but_instead of an empty string, for use as directory names.tmin,tmaxStart and end time as
YYYY-MM-DD_HH-MM-SS.tmin_ms,tmax_ms,tmin_us,tmax_usThe same, with milli- or microseconds.
tmin_year,tmin_month,tmin_day,tmin_jday,tmax_...Parts of the start and end time (
jday: day of the year).juliandayDay of the year of the start time, without zero padding.
Any other name is looked up in
additional.
- class CarpetStats(**kwargs)[source]¶
Bases:
ObjectSummary statistics of the data samples of a carpet.
Masked samples are ignored. Non-finite values are ignored in the percentiles and counted in
nan_count.- classmethod make(data, mask=None)[source]¶
Compute statistics of a data array.
- Parameters:
data (
numpy.ndarray) – Data samples.mask (
numpy.ndarrayofbool) – Mask of samples to ignore (True= masked).
- Returns:
New statistics object.
- Return type:
- class Carpet(traces=None, assemble='concatenate', data=None, nsamples=None, codes=None, component_codes=None, component_axes=None, tmin=None, deltat=None, mask=None, meta=None, stats=None)[source]¶
Bases:
ObjectContainer for multi-component waveforms with common time span and sampling.
Instances of this class can be used to efficiently represent multi-component waveforms of a single sensor or of a sensor array, or spectrograms. The data samples are stored in a single 2D array where the first index runs over components and the second index over time. Metadata contains sampling interval, start time and
CodesNSLCEidentifiers for the carpet as a whole (codes) and for each component (component_codes). Further coordinates of the components, e.g. the frequencies of a spectrogram, can be attached ascomponent_axes.The samples are held in
data, a plainnumpy.ndarray. Missing or invalid samples, e.g. gaps or samples polluted by artifacts, can be marked in the optional booleanmask(True= masked). Without a mask (None), all samples are valid. The values of masked samples are undefined. Methods carry the mask along: filters treat masked samples as zeros and keep them masked, andbleed()extends the masked regions to hide edge effects.masked_datagives anumpy.ma.MaskedArrayview, for use withnumpy.mafunctions.Some carpets, e.g. spectrograms, mark missing values with NaN instead.
mask_invalid()converts NaN (and inf) into masked samples.A carpet can also be created without data (“dataless”), e.g. to hold metadata only. In this case,
component_codesandnsamplesmust be given.Most methods returning a carpet create a new one, which may share the data with the original (
chop(),chopper(),crop()). The filter methods (lowpass(),highpass(),smooth(),whiten(), …) modify the carpet in place.- Parameters:
traces (
listofTrace) – If given, construct the carpet from these single-component waveforms, seeassemble.data,component_codes,tminanddeltatare then taken from the traces.assemble (str) – How to combine
traces:'concatenate'(default) stacks the traces in the given order, one component per trace. They must have the same time span, sampling interval and data type (seeget_traces_data_as_array()).'merge'combines traces with the same codes into one component each (sorted by codes), covering the joint time span of all traces. Samples not covered by any trace are masked (seemerge_traces_data_as_array()). The traces must have the same sampling interval and sampling instants.data (
numpy.ndarrayornumpy.ma.MaskedArray) – Data samples, indexed as(icomponent, isample). If anumpy.ma.MaskedArrayis given, its mask is combined withmask.mask (
numpy.ndarrayofbool) – Mask of invalid samples, same shape asdata(True= masked).nsamples (int) – Number of samples. Required for a dataless carpet, otherwise taken from
data(and checked, if given).codes (
CodesNSLCE) – Codes identifying the carpet as a whole.component_codes (
listofCodesNSLCE) – Codes of the components, one per row ofdata. Default: empty codes for all components.component_axes (
dictofstrtonumpy.ndarray) – Auxiliary coordinate axes of the components, by name, e.g.{'frequency': frequencies}. Each array must have one value per component.tmin (
get_time_float()) – Time of the first sample [s].deltat (float) – Sampling interval [s].
meta (
dict) – Additional free-form metadata.
- Raises:
ValueErrorif the arguments are inconsistent, e.g. if the number of component codes does not match the number of rows ofdata.- ♦ codes¶
pyrocko.model.codes.CodesNSLCE, default:CodesNSLCE()Codes identifying the carpet as a whole.
- ♦ component_codes¶
listofpyrocko.model.codes.CodesNSLCEobjects, default:[]List of codes identifying the components.
- ♦ component_axes¶
dictof numpy.ndarray (pyrocko.guts_array.Array) objects, default:{}Auxiliary component coordinate axes, by name, e.g. the frequencies of a spectrogram. Each axis has one value per component.
- ♦ nsamples¶
intNumber of samples.
- ♦ data¶
numpy.ndarray (
pyrocko.guts_array.Array), optionalArray containing the data samples indexed as
(icomponent, isample).
- ♦ mask¶
numpy.ndarray (
pyrocko.guts_array.Array), optionalMask of invalid samples, same shape as
data(True= masked).Noneif all samples are valid.
- ♦ tmin¶
pyrocko.util.get_time_float (
pyrocko.guts.Timestamp), default:str_to_time('1970-01-01 00:00:00')Time of first sample [s].
- ♦ deltat¶
float, default:1.0Sampling interval [s].
- ♦ meta¶
dictofpyrocko.guts.Anyobjects, default:{}Additional free-form metadata.
- ♦ stats¶
CarpetStats, optionalSummary statistics of the data samples. Computed on first access and cached; the cache is not updated when the data changes.
- property masked_data¶
The data as
numpy.ma.MaskedArray(read-only).Shares the data samples with the carpet. Changing the mask of the returned array does not change the carpet’s
mask, useset_mask()for that.
- get_mask()[source]¶
Get the mask, also if all samples are valid.
- Returns:
Boolean array of the shape of
data,Truefor masked samples. A new array ofFalsevalues if the carpet has no mask.- Return type:
- set_mask(mask)[source]¶
Set the mask.
- Parameters:
mask (
numpy.ndarray) – Boolean array of the shape ofdata(True= masked), orNoneto mark all samples as valid. A mask without any masked samples is stored asNone.
- mask_invalid()[source]¶
Mask non-finite samples (NaN, inf), in place.
The samples already masked stay masked.
- property summary_component_codes¶
Short textual representation of the component codes, e.g. first and last, for
summary.
- property summary_entries¶
Entries of
summary, as a tuple of strings: class name, codes, number of components, number of samples, data type, sampling interval, start and end time, and component codes.
- property summary¶
One-line textual summary of the carpet’s metadata attributes.
- itime(time, out_of_bounds='raise')[source]¶
Get index of the sample nearest to a given time.
- Parameters:
time (
get_time_float()) – Time [s].out_of_bounds (str) – What to do if
timeis outside the carpet’s time span:'raise'raisesValueError,'clip'returns the index of the first or last sample,'ignore'returns the index anyway (it may then be negative or too large).
- Returns:
Sample index.
- Return type:
- fill_template(template, **additional)[source]¶
Fill placeholders in a template string with the carpet’s attributes.
Used e.g. to create file names. Placeholders can be given in
str.formatstyle, e.g.'{station}_{tmin}.rug', or in%style, e.g.'%(station)s_%(tmin)s.rug'. SeeCarpetStringFillerfor the available names.
- copy(data='copy')[source]¶
Create a copy.
Codes, component codes, component axes, start time, sampling interval and
metaare copied (shallow).- Parameters:
data (str or
numpy.ndarray) –'copy'to deeply copy the data and mask, or'reference'to create a shallow copy, referencing the original data and mask, or'drop'to create a dataless copy. An array given here is used as the data of the copy instead, with the mask of anumpy.ma.MaskedArrayor else no mask.- Return type:
- chop(tmin, tmax, snap=(<built-in function round>, <built-in function round>))[source]¶
Cut out a time span.
Unlike
pyrocko.trace.Trace.chop(), this does not modify the carpet but returns a new one, sharing the data with the original.The new carpet contains the samples with indices from
snap[0]((tmin - self.tmin) / deltat)up to, but excluding,snap[1]((tmax - self.tmin) / deltat), limited to the available samples. With the default rounding,tmaxis therefore exclusive:chop(t, t + n*deltat)givesnsamples.- Parameters:
tmin (
get_time_float()) – Start time [s].tmax (
get_time_float()) – End time [s].snap (
tupleof two functions) – Rounding functions to converttminandtmaxto sample indices, e.g.(math.floor, math.ceil)to include partially covered samples.
- Raises:
NoDataif no samples remain.- Return type:
- chopper(tinc)[source]¶
Iterate over consecutive time windows.
The windows start at
tminand have a length offloor(tinc / deltat)samples each. The last window may be shorter. The yielded carpets share the data with the original.
- overlaps(*args)[source]¶
Check if this carpet overlaps with a given time span or other carpet.
Call as
overlaps(tmin, tmax)oroverlaps(other_carpet). Time spans touching at a single instant count as overlapping. Only times are compared, not codes.- Returns:
Trueif the time spans overlap.- Return type:
- property tmax¶
End time (time of last sample, read-only).
- property times¶
Times of the samples [s] (read-only).
- Return type:
- get_trace(i, span=slice(None, None, None))[source]¶
Get single component waveform (shared data).
The trace refers to the raw sample values: masked samples are included with whatever value they hold. Use
iter_valid_traces()to get the unmasked parts only.
- iter_valid_traces()[source]¶
Iterate over the unmasked parts of the components, as traces.
Each contiguous range of unmasked samples of a component gives one trace (shared data).
- Yields:
Traceobjects.
- get_traces()[source]¶
Get all components as traces, including masked samples.
See
get_trace().
- get_valid_traces()[source]¶
Get the unmasked parts of the components as traces.
See
iter_valid_traces().
- get_component_axis(name=None)[source]¶
Get coordinates of the components.
- Parameters:
name (str) – Name of an entry in
component_axes, orNoneto get the component indices.- Return type:
- mpl_draw(axes, component_axis=None, fslice=slice(None, None, None), **kwargs)[source]¶
Draw the carpet into Matplotlib axes, with
matplotlib.axes.Axes.pcolormesh().Time runs along the x-axis, the components along the y-axis. Masked samples are left blank.
- Parameters:
axes (
matplotlib.axes.Axes) – Axes to draw into.component_axis (str) – Coordinates for the y-axis:
Nonefor the component indices,'default'for the only entry ofcomponent_axesif there is exactly one (indices otherwise), or the name of an entry ofcomponent_axes.fslice (
slice) – Components to draw.kwargs – Passed to
pcolormesh().
- Returns:
Object returned by
pcolormesh().
- plot(component_axis='default', component_axis_scale='linear', fslice=slice(None, None, None), path=None, **kwargs)[source]¶
Plot the carpet in a new Matplotlib figure.
See
mpl_draw()forcomponent_axis,fsliceandkwargs.
- snuffle(what='valid')[source]¶
Show the components in Snuffler.
- Parameters:
what (str) –
'valid'to show only the unmasked parts (seeget_valid_traces()),'raw'to show all samples.
- bleed(t)[source]¶
Extend masked regions and mask the edges, in place.
Masks
tseconds at both ends of every contiguous range of unmasked samples, and at the start and end of the carpet. Useful to hide edge effects, e.g. of filters, near gaps.- Parameters:
t (float) – Duration to mask [s]. Nothing is done if it is shorter than one sample.
- set_data(data)[source]¶
Replace the data samples, keeping the shape.
- Parameters:
data (
numpy.ndarrayornumpy.ma.MaskedArray) – New data samples, with the same shape as the current ones. If a plainnumpy.ndarrayis given, the current mask is kept. The mask of anumpy.ma.MaskedArrayreplaces the current mask.
- apply(f)[source]¶
Apply a function to the data samples, in place.
- Parameters:
f (callable) – Function taking and returning a data array of the same shape, see
set_data(). It gets the plain data array; masked samples hold undefined values.
- reduce(f, component_codes)[source]¶
Combine the components with a function, in place.
Example:
carpet.reduce(lambda data: data.sum(axis=0), codes)replaces all components by their sum.- Parameters:
f (callable) – Function taking the data array and returning a new one with the same number of samples, either 2D
(icomponent, isample)or 1D (a single component). If the carpet has a mask,fgetsmasked_data, so thatnumpy.masemantics apply (e.g.sumskips masked samples), and the mask of the result becomes the new mask.component_codes (
CodesNSLCEorlistof these) – Codes of the new components.
component_axesis kept if the number of components stays the same, and cleared otherwise.
- nyquist_check(frequency, intro='Corner frequency', warn=True, raise_exception=False)[source]¶
Check if a given frequency is above the Nyquist frequency of the carpet.
- Parameters:
frequency (float) – Frequency to check [Hz].
intro (str) – String used to introduce the warning/error message.
warn (bool) – Whether to emit a warning message.
raise_exception (bool) – Whether to raise
AboveNyquist.
- lfilter(b, a, demean=True)[source]¶
Filter all components with
scipy.signal.lfilter(), in place.Sample data is converted to type
float, possibly demeaned and filtered along the time axis usingscipy.signal.lfilter(). Masked samples are set to zero before filtering and stay masked. Usebleed()afterwards to mask the filter’s transients at gaps.- Parameters:
b (
numpy.ndarray) – Numerator coefficients.a (
numpy.ndarray) – Denominator coefficients.demean (bool) – Subtract the mean of each component (of the unmasked samples) before filtering.
- lowpass(order, corner, nyquist_warn=True, nyquist_exception=False, demean=True)[source]¶
Filter all components using a Butterworth lowpass, in place.
Sample data is converted to type
float, possibly demeaned and filtered usingscipy.signal.lfilter(). Filter coefficients are generated withscipy.signal.butter().- Parameters:
order (int) – Order of the filter.
corner (float) – Corner frequency of the filter [Hz].
demean (bool) – Subtract mean before filtering.
nyquist_warn (bool) – Warn if corner frequency is greater than Nyquist frequency.
nyquist_exception (bool) – Raise
pyrocko.trace.AboveNyquistif corner frequency is greater than Nyquist frequency.
- highpass(order, corner, nyquist_warn=True, nyquist_exception=False, demean=True)[source]¶
Filter all components using a Butterworth highpass, in place.
Sample data is converted to type
float, possibly demeaned and filtered usingscipy.signal.lfilter(). Filter coefficients are generated withscipy.signal.butter().- Parameters:
order (int) – Order of the filter.
corner (float) – Corner frequency of the filter [Hz].
demean (bool) – Subtract mean before filtering.
nyquist_warn (bool) – Warn if corner frequency is greater than Nyquist frequency.
nyquist_exception (bool) – Raise
AboveNyquistif corner frequency is greater than Nyquist frequency.
- fold(t, method=<function mean>)[source]¶
Downsample by combining blocks of samples.
Blocks of
nfold = round(t / deltat)consecutive samples are combined into one withmethod. The blocks are aligned to multiples of the new sampling intervalnfold * deltatin absolute time, so that folded carpets of different time spans fit together. Incomplete blocks at the start and end are dropped. If the carpet has a mask,methodgets anumpy.ma.MaskedArray: withnumpy.mean()(or other functions supporting masked arrays), masked samples are skipped and a block is only masked if all its samples are masked.- Parameters:
t (float) – New sampling interval [s], rounded to a multiple of
deltat.method (callable) – Function to combine the samples of a block, called as
method(data, axis=2)on an array of shape(ncomponents, nblocks, nfold), e.g.numpy.mean()(default) ornumpy.max().
- Raises:
NoDataif no complete block remains.- Returns:
New carpet.
- Return type:
- smooth(t, window=<function hanning>)[source]¶
Smooth along the time axis with a moving weighted average, in place.
Each sample is replaced by the average of the valid samples around it, weighted with the window. Masked samples and samples beyond the ends of the carpet are left out of the average, and the weights of the remaining samples are renormalized. So, a constant signal is left unchanged, also next to gaps and at the ends. The mask is not changed.
- Parameters:
t (float) – Window length [s], rounded to an odd number of samples.
window (callable) – Function returning the window for a given number of samples, e.g.
numpy.hanning()(default).
- filter_frequency_cos_taper(f1, f2, f3, f4)[source]¶
Bandpass filter with a cosine taper in the frequency domain, in place.
The spectrum is multiplied by a taper which rises from 0 at
f1to 1 atf2, and falls from 1 atf3to 0 atf4(seepyrocko.trace.costaper()). Seeapply_via_fft().
- whiten(deltaf, window=<function hanning>)[source]¶
Spectral whitening, in place.
The spectrum of each component is divided by its amplitude spectrum, smoothed over a frequency band of width
deltaf. Seeapply_via_fft(). The smoothing window is normalized to unit sum, so that the resulting amplitude spectrum is close to one.- Parameters:
deltaf (float) – Width of the smoothing window [Hz].
window (callable) – Function returning the smoothing window for a given number of samples.
- normalize(deltat, window=<function hanning>)[source]¶
Time-domain normalization, in place.
Each component is divided by its running mean absolute amplitude, i.e. its sample-wise absolute value, smoothed over a time window of length
deltat(seesmooth(), masked samples are left out). This is the running absolute mean normalization commonly used in ambient noise processing. Samples where this amplitude is zero are set to zero.- Parameters:
deltat (float) – Length of the smoothing window [s].
window (callable) – Function returning the smoothing window for a given number of samples.
- apply_via_fft(f, ntrans_min=0)[source]¶
Apply a function to the spectra of the components, in place.
The spectra are computed with
get_spectrum(), passed tof, and the result is transformed back to the time domain and cut to the original number of samples.- Parameters:
f (callable) – Function called as
f(frequency_delta, ntrans, spectrum), returning the modified spectrum (seeget_spectrum()for the arguments).ntrans_min (int) – Minimum FFT length.
- get_spectrum(ntrans_min=0)[source]¶
Get the spectra of the components.
Masked samples are replaced by zeros. The data is zero-padded to the next power of two of at least
ntrans_minand the number of samples, and transformed withnumpy.fft.rfft().
- get_cross_spectrum(ntrans_min=0)[source]¶
Get the cross spectra of all pairs of components.
- Parameters:
ntrans_min (int) – Minimum FFT length, see
get_spectrum().- Returns:
(frequency_delta, ntrans, cross_spectrum), wherecross_spectrum[i, j, k]isS_i(f_k) * conj(S_j(f_k))for the spectraSof componentsiandj.- Return type:
- get_component_codes_grouped(codes_projection)[source]¶
Group the components by their codes.
- Parameters:
codes_projection (
CodesProjection) – Determines the grouping, seegroup_key().- Returns:
Component indices by group key.
- Return type:
- get_energy(codes_projection=None, postprocessing=None)[source]¶
Get the energy, i.e. the sum of squared samples, of groups of components.
The components are grouped with
codes_projection, e.g. the three components of a sensor. Masked input samples do not contribute. Samples with zero energy, e.g. where all input samples are masked, are masked (and set to 1).- Parameters:
codes_projection (
CodesProjection) – Grouping of the components and codes of the resulting components. Default: one group per sensor, i.e. by network, station, location and channel code without the component character. The resulting components get these codes and the extra codeP.postprocessing (callable) – Function applied to the result, see
apply().
- Returns:
New carpet, one component per group.
- Return type:
- get_rms(codes_projection=None)[source]¶
Get the RMS amplitude, i.e. the square root of the energy, of groups of components.
Like
get_energy(), but with the square root applied.- Parameters:
codes_projection (
CodesProjection) – Grouping of the components, seeget_energy().- Returns:
New carpet, one component per group.
- Return type:
- get_log_rms(codes_projection=None)[source]¶
Get the natural logarithm of the RMS amplitude of groups of components.
Like
get_rms(), but logarithmic. Before taking the logarithm, the energy is smoothed over three samples with weights(0.25, 0.5, 0.25). Masked samples and samples beyond the ends are left out of the average.- Parameters:
codes_projection (
CodesProjection) – Grouping of the components, seeget_energy().- Returns:
New carpet, one component per group. Masked samples are set to zero.
- Return type:
- get_log10_rms(codes_projection=None)[source]¶
Get the decadic logarithm of the RMS amplitude of groups of components.
Like
get_log_rms(), but with the decadic logarithm.- Parameters:
codes_projection (
CodesProjection) – Grouping of the components, seeget_energy().- Returns:
New carpet, one component per group. Masked samples are set to zero.
- Return type:
- resample_band(fmin, fmax, nf, registration='cell', scale='log', component_axis='frequency')[source]¶
Resample the components to regularly spaced bins of a component axis.
Typically used to bring a spectrogram to
nffrequency bands, regularly spaced on a logarithmic or linear frequency scale. The value of each new band is the average of the data over the band, computed by integrating (trapezoidal rule, on the chosen scale) along the component axis, which must be increasing.Components whose axis value does not meet the scale’s condition, e.g. frequency 0 for logarithmic scale, are dropped first. Masked and NaN input samples count as zero in the integration. Bands outside the range of the component axis, or with a result of exactly zero, are set to NaN. The result has no mask.
- Parameters:
fmin (float) – Lower end of the range of the new bands. Default: lower end of the component axis.
fmax (float) – Upper end of the range of the new bands. Default: upper end of the component axis.
nf (int) – Number of new bands.
registration (str) –
'cell':fminandfmaxare the outer edges of the first and last band.'node': they are (approximately) the centres of the first and last band.scale (str or
tuple) –'log','lin', or a tuple(f, f_inverse, condition)of functions for a custom scale, e.g.(numpy.log, numpy.exp, lambda y: y > 0).component_axis (str) – Name of the component axis in
component_axes. If it is not present, the component indices are used.
- Raises:
CarpetResampleErrorif the scale is invalid, the component axis is not increasing, or no data is in the requested range.- Returns:
New carpet with
nfcomponents, empty component codes, and the band centres as component axiscomponent_axis.- Return type:
- correlate(a, b, mode='valid', normalization=None, use_fft=False)[source]¶
Cross-correlate traces and/or carpets.
Each of
aandbcan be aTraceor aCarpet. Components are correlated pairwise withpyrocko.trace.correlate(), see there for the other arguments.
- join(carpets)[source]¶
Join carpets which are contiguous in time.
Carpets with the same codes, number of components, sampling interval and data type are concatenated if one starts right after the other ends. Carpets without samples are dropped. Component codes and component axes are taken from the first carpet of each joined group. Masks are joined as well.
- check_same_components(a, b)[source]¶
Check that two carpets have the same components.
Compares the number of components, the component codes and the component axes.
- Raises:
CarpetErrorif the components differ.
- check_compatible(carpets)[source]¶
Check that carpets have the same sampling and components.
The carpets must have the same sampling interval, start time and number of samples, and the same components (see
check_same_components()).- Raises:
CarpetErrorif the carpets are not compatible.
- sum(carpets, nan_aware=False, normalize=False, dtype=<class 'float'>)[source]¶
Sum carpets sample by sample.
The carpets must be compatible (see
check_compatible()).- Parameters:
nan_aware (bool) – If
True, non-finite values (NaN, inf) are skipped. Otherwise they propagate into the sum. Masked samples are always skipped.normalize (bool) – If
True, divide by the number of finite, unmasked values summed, i.e. compute the average.dtype (
numpy.dtype) – Data type of the sum.
- Raises:
CarpetErrorif no carpets are given, a carpet has no data, or the carpets are not compatible.- Returns:
New carpet, with codes
.SUM...and the components of the first carpet. Samples with no finite, unmasked values are NaN. The result has no mask.- Return type: