imap_processing.hi.utils.full_dataarray#

imap_processing.hi.utils.full_dataarray(name: str, attrs: dict, coords: dict[str, DataArray] | None = None, shape: int | Sequence[int] | None = None, fill_value: float | None = None) DataArray#

Generate an empty xarray.DataArray with appropriate attributes.

Data in DataArray are filled with FILLVAL defined in attributes retrieved from ATTR_MGR with shape matching coordinates defined by dims or overridden by optional shape input.

Parameters:
  • name (str) – Variable name.

  • attrs (dict) – CDF variable attributes. Usually retrieved from ImapCdfAttributes.

  • coords (dict, Optional) – Coordinate variables for the Dataset. This function will extract the sizes of each dimension defined by the attributes dictionary to determine the size of the DataArray to be created.

  • shape (int or tuple, Optional) – Shape of ndarray data array to instantiate in the xarray.DataArray. If shape is provided, the DataArray created will have this shape regardless of whether coordinates are provided or not.

  • fill_value (Optional, float) – Override the fill value that the DataArray will be filled with. If not supplied, the “FILLVAL” value from attrs will be used.

Returns:

data_array – Meeting input specifications.

Return type:

xarray.DataArray