docstr: Transforms a (sequence of) of series by calling the user-implemeneted `ts_transform` method.
  
  In case a ``Sequence[TimeSeries]`` is passed as input data, this function takes care of
  parallelising the transformation of multiple series in the sequence at the same time. Additionally,
  if the `mask_components` attribute was set to `True` when instantiating `BaseDataTransformer`,
  then any provided `component_mask`s will be automatically applied to each input `TimeSeries`;
  please refer to 'Notes' for further details on component masking.
  
  Any additionally specified `*args` and `**kwargs` are automatically passed to `ts_transform`.
  
  Parameters
  ----------
  series
      (sequence of) series to be transformed.
  args
      Additional positional arguments for each :func:`ts_transform()` method call
  component_mask : Optional[np.ndarray] = None
      Optionally, a 1-D boolean np.ndarray of length ``series.n_components`` that specifies which
      components of the underlying `series` the transform should consider. If the `mask_components`
      attribute was set to `True` when instantiating `BaseDataTransformer`, then the component mask
      will be automatically applied to each `TimeSeries` input. Otherwise, `component_mask` will be
      provided as an addition keyword argument to `ts_transform`. See 'Notes' for further details.
  kwargs
      Additional keyword arguments for each :func:`ts_transform()` method call
  
  Returns
  -------
  Union[TimeSeries, List[TimeSeries]]
      Transformed data.
  
  Notes
  -----
  If the `mask_components` attribute was set to `True` when instantiating `BaseDataTransformer`,
  then any provided `component_mask`s will be automatically applied to each `TimeSeries` input to
  transform; `component_mask`s are simply boolean arrays of shape `(series.n_components,)` that
  specify which components of each `series` should be transformed using `ts_transform` and which
  components should not. If `component_mask[i]` is `True`, then the `i`th component of each
  `series` will be transformed by `ts_transform`. Conversely, if `component_mask[i]` is `False`,
  the `i`th component will be removed from each `series` before being passed to `ts_transform`;
  after transforming this masked series, the untransformed `i`th component will be 'added back'
  to the output. Note that automatic `component_mask`ing can only be performed if the `ts_transform`
  does *not* change the number of timesteps in each series; if this were to happen, then the transformed
  and untransformed components are unable to be concatenated back together along the component axis.
  
  If `mask_components` was set to `False` when instantiating `BaseDataTransformer`, then any provided
  `component_masks` will be passed as a keyword argument `ts_transform`; the user can then manually specify
  how the `component_mask` should be applied to each series.
docstr_tok: ["Transforms","a","(","sequence","of",")","of","series","by","calling","the","user-implemeneted","`","ts_transform","`","method",".","In","case","a","``","Sequence","[","TimeSeries","]","``","is","passed","as","input","data",",","this","function","takes","care","of","parallelising","the","transformation","of","multiple","series","in","the","sequence","at","the","same","time",".","Additionally",",","if","the","`","mask_components","`","attribute","was","set","to","`","True","`","when","instantiating","`","BaseDataTransformer","`",",","then","any","provided","`","component_mask","`","s","will","be","automatically","applied","to","each","input","`","TimeSeries","`",";","please","refer","to","'Notes","'","for","further","details","on","component","masking",".","Any","additionally","specified","`","*","args","`","and","`","*","*","kwargs","`","are","automatically","passed","to","`","ts_transform","`",".","Parameters","--","--","--","--","--","series","(","sequence","of",")","series","to","be","transformed",".","args","Additional","positional","arguments","for","each",":","func",":","`","ts_transform","(",")","`","method","call","component_mask",":","Optional","[","np.ndarray","]","=","None","Optionally",",","a","1-D","boolean","np.ndarray","of","length","``","series.n_components","``","that","specifies","which","components","of","the","underlying","`","series","`","the","transform","should","consider",".","If","the","`","mask_components","`","attribute","was","set","to","`","True","`","when","instantiating","`","BaseDataTransformer","`",",","then","the","component","mask","will","be","automatically","applied","to","each","`","TimeSeries","`","input",".","Otherwise",",","`","component_mask","`","will","be","provided","as","an","addition","keyword","argument","to","`","ts_transform","`",".","See","'Notes","'","for","further","details",".","kwargs","Additional","keyword","arguments","for","each",":","func",":","`","ts_transform","(",")","`","method","call","Returns","--","--","--","-","Union","[","TimeSeries",",","List","[","TimeSeries","]","]","Transformed","data",".","Notes","--","--","-","If","the","`","mask_components","`","attribute","was","set","to","`","True","`","when","instantiating","`","BaseDataTransformer","`",",","then","any","provided","`","component_mask","`","s","will","be","automatically","applied","to","each","`","TimeSeries","`","input","to","transform",";","`","component_mask","`","s","are","simply","boolean","arrays","of","shape","`","(","series.n_components",",",")","`","that","specify","which","components","of","each","`","series","`","should","be","transformed","using","`","ts_transform","`","and","which","components","should","not",".","If","`","component_mask","[","i","]","`","is","`","True","`",",","then","the","`","i","`","th","component","of","each","`","series","`","will","be","transformed","by","`","ts_transform","`",".","Conversely",",","if","`","component_mask","[","i","]","`","is","`","False","`",",","the","`","i","`","th","component","will","be","removed","from","each","`","series","`","before","being","passed","to","`","ts_transform","`",";","after","transforming","this","masked","series",",","the","untransformed","`","i","`","th","component","will","be","'added","back'","to","the","output",".","Note","that","automatic","`","component_mask","`","ing","can","only","be","performed","if","the","`","ts_transform","`","does","*","not","*","change","the","number","of","timesteps","in","each","series",";","if","this","were","to","happen",",","then","the","transformed","and","untransformed","components","are","unable","to","be","concatenated","back","together","along","the","component","axis",".","If","`","mask_components","`","was","set","to","`","False","`","when","instantiating","`","BaseDataTransformer","`",",","then","any","provided","`","component_masks","`","will","be","passed","as","a","keyword","argument","`","ts_transform","`",";","the","user","can","then","manually","specify","how","the","`","component_mask","`","should","be","applied","to","each","series","."]
code: def transform(
      self,
      series: Union[TimeSeries, Sequence[TimeSeries]],
      *args,
      component_mask: Optional[np.array] = None,
      **kwargs,
  ) -> Union[TimeSeries, List[TimeSeries]]:
      """Transforms a (sequence of) of series by calling the user-implemeneted `ts_transform` method.
  
      In case a ``Sequence[TimeSeries]`` is passed as input data, this function takes care of
      parallelising the transformation of multiple series in the sequence at the same time. Additionally,
      if the `mask_components` attribute was set to `True` when instantiating `BaseDataTransformer`,
      then any provided `component_mask`s will be automatically applied to each input `TimeSeries`;
      please refer to 'Notes' for further details on component masking.
  
      Any additionally specified `*args` and `**kwargs` are automatically passed to `ts_transform`.
  
      Parameters
      ----------
      series
          (sequence of) series to be transformed.
      args
          Additional positional arguments for each :func:`ts_transform()` method call
      component_mask : Optional[np.ndarray] = None
          Optionally, a 1-D boolean np.ndarray of length ``series.n_components`` that specifies which
          components of the underlying `series` the transform should consider. If the `mask_components`
          attribute was set to `True` when instantiating `BaseDataTransformer`, then the component mask
          will be automatically applied to each `TimeSeries` input. Otherwise, `component_mask` will be
          provided as an addition keyword argument to `ts_transform`. See 'Notes' for further details.
      kwargs
          Additional keyword arguments for each :func:`ts_transform()` method call
  
      Returns
      -------
      Union[TimeSeries, List[TimeSeries]]
          Transformed data.
  
      Notes
      -----
      If the `mask_components` attribute was set to `True` when instantiating `BaseDataTransformer`,
      then any provided `component_mask`s will be automatically applied to each `TimeSeries` input to
      transform; `component_mask`s are simply boolean arrays of shape `(series.n_components,)` that
      specify which components of each `series` should be transformed using `ts_transform` and which
      components should not. If `component_mask[i]` is `True`, then the `i`th component of each
      `series` will be transformed by `ts_transform`. Conversely, if `component_mask[i]` is `False`,
      the `i`th component will be removed from each `series` before being passed to `ts_transform`;
      after transforming this masked series, the untransformed `i`th component will be 'added back'
      to the output. Note that automatic `component_mask`ing can only be performed if the `ts_transform`
      does *not* change the number of timesteps in each series; if this were to happen, then the transformed
      and untransformed components are unable to be concatenated back together along the component axis.
  
      If `mask_components` was set to `False` when instantiating `BaseDataTransformer`, then any provided
      `component_masks` will be passed as a keyword argument `ts_transform`; the user can then manually specify
      how the `component_mask` should be applied to each series.
      """
  
      desc = f"Transform ({self._name})"
  
      # Take note of original input for unmasking purposes:
      if isinstance(series, TimeSeries):
          input_series = [series]
          data = [series]
      else:
          input_series = series
          data = series
  
      if self._mask_components:
          data = [
              self.apply_component_mask(
                  ts, component_mask, return_ts=True
              )
              for ts in data
          ]
      else:
          kwargs["component_mask"] = component_mask
  
      input_iterator = _build_tqdm_iterator(
          zip(data, self._get_params(n_timeseries=len(data))),
          verbose=self._verbose,
          desc=desc,
          total=len(data),
      )
  
      transformed_data = _parallel_apply(
          input_iterator,
          self.__class__.ts_transform,
          self._n_jobs,
          args,
          kwargs,
      )
  
      if self._mask_components:
          unmasked = []
          for ts, transformed_ts in zip(input_series, transformed_data):
              unmasked.append(
                  self.unapply_component_mask(
                      ts, transformed_ts, component_mask
                  )
              )
          transformed_data = unmasked
  
      return (
          transformed_data[0]
          if isinstance(series, TimeSeries)
          else transformed_data
      )
  
imports: from abc import ABC, abstractmethod
  from typing import Any, Generator, List, Mapping, Optional, Sequence, Union
  import numpy
  import xarray
  from darts import TimeSeries
  from darts.logging import get_logger, raise_if, raise_if_not
  from darts.utils import _build_tqdm_iterator, _parallel_apply
label_desc: Use image node_id 5 for calling the BaseDataTransformer obj's underlying member method code with example usage: obj.transform(series) and returns: unknown