src/tropycal/tracks/storm.py
def to_xarray(self):
        
        r"""
        Converts the storm dict into an xarray Dataset object.
        
        Returns
        -------
        xarray.Dataset
            An xarray Dataset object containing information about the storm.
        """
        
        #Try importing xarray
        try:
            import xarray as xr
        except ImportError as e:
            raise RuntimeError("Error: xarray is not available. Install xarray in order to use this function.") from e
            
        #Set up empty dict for dataset
        time = self.dict['date']
        ds = {}
        attrs = {}
        
        #Add every key containing a list into the dict, otherwise add as an attribute
        keys = [k for k in self.dict.keys() if k != 'date']
        for key in keys:
            if isinstance(self.dict[key], list):
                ds[key] = xr.DataArray(self.dict[key],coords=[time],dims=['time'])
            else:
                attrs[key] = self.dict[key]
                    
        #Convert entire dict to a Dataset
        ds = xr.Dataset(ds,attrs=attrs)

        #Return dataset
        return ds
r"""
        Converts the storm dict into an xarray Dataset object.
        
        Returns
        -------
        xarray.Dataset
            An xarray Dataset object containing information about the storm.
        
r"""
Converts the storm dict into an xarray Dataset object.

Returns

xarray.Dataset
An xarray Dataset object containing information about the storm.
r " " " Converts the storm dict into an xarray Dataset object . Returns xarray . Dataset An xarray Dataset object containing information about the storm .
def to_xarray(self):
        try:
            import xarray as xr
        except ImportError as e:
            raise RuntimeError("Error: xarray is not available. Install xarray in order to use this function.") from e
        time = self.dict['date']
        ds = {}
        attrs = {}
        keys = [k for k in self.dict.keys() if k != 'date']
        for key in keys:
            if isinstance(self.dict[key], list):
                ds[key] = xr.DataArray(self.dict[key],coords=[time],dims=['time'])
            else:
                attrs[key] = self.dict[key]
        ds = xr.Dataset(ds,attrs=attrs)
        return ds
def to_xarray ( self ) : try : import xarray as xr except ImportError as e : raise RuntimeError ( "Error: xarray is not available. Install xarray in order to use this function." ) from e time = self . dict [ 'date' ] ds = { } attrs = { } keys = [ k for k in self . dict . keys ( ) if k != 'date' ] for key in keys : if isinstance ( self . dict [ key ] , list ) : ds [ key ] = xr . DataArray ( self . dict [ key ] , coords = [ time ] , dims = [ 'time' ] ) else : attrs [ key ] = self . dict [ key ] ds = xr . Dataset ( ds , attrs = attrs ) return ds
r"""
Converts the storm dict into an xarray Dataset object.
r " " " Converts the storm dict into an xarray Dataset object .
r"""
        Converts the storm dict into an xarray Dataset object.
        
        Returns
        -------
        xarray.Dataset
            An xarray Dataset object containing information about the storm.
        """ #Try importing xarray #Set up empty dict for dataset #Add every key containing a list into the dict, otherwise add as an attribute #Convert entire dict to a Dataset #Return dataset
self