:orphan: :mod:`astrohack.io.base_mds` ============================ .. py:module:: astrohack.io.base_mds Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: astrohack.io.base_mds.AstrohackBaseFile .. class:: AstrohackBaseFile(file: str) Base Data class for astrohack. Data within an object of this class can be selected for further inspection, plotted or produce a report .. method:: is_open(self) -> bool :property: Check whether the object has opened the corresponding hack file. :return: True if open, else False. :rtype: bool .. method:: keys(self, *args, **kwargs) Get children keys :param args: args to deliver to dict.keys() method :type args: list :param kwargs: Dict of keyword args to deliver to dict.keys() method :type kwargs: dict :return: dict keys iterable :rtype: dict_keys .. method:: items(self, *args, **kwargs) Get children items :param args: args to deliver to dict.items() method :type args: list :param kwargs: Dict of keyword args to deliver to dict.items() method :type kwargs: dict :return: dict items iterable :rtype: dict_items .. method:: values(self, *args, **kwargs) Get children values :param args: args to deliver to dict.values() method :type args: list :param kwargs: Dict of keyword args to deliver to dict.values() method :type kwargs: dict :return: dict values iterable :rtype: dict_values .. method:: open(self, file: str = None) -> bool Open Base file. :param file: File to be opened, if None defaults to the previously defined file :type file: str, optional :return: True if file is properly opened, else returns False :rtype: bool .. method:: write(self, mode='w') Write mds to disk by saving the data tree to a file :param mode: File mode :type mode: str .. method:: summary(self) -> None Prints summary of this Astrohack File object, with available data, attributes and methods :return: None :rtype: NoneType .. method:: create_from_input_parameters(cls, file_name: str, input_parameters: dict) :classmethod: Create an AstrohackBaseFile object from a filename and initializes xdtree root attributes. :param file_name: Name of the file in disk to be created :type file_name: str :param input_parameters: Input parameters for the calling function to be stored in root attributes. :type input_parameters: dict :return: Initialized AstrohackBaseFile object :rtype: AstrohackBaseFile .. method:: add_node(self, xarray_data: Union[xarray.Dataset, xarray.DataTree], key_list: Union[list[str], tuple[str]]) Add a node to the data tree file structure, however this node is not yet consolidated into the data tree structure, consolidate must be called to integrate all nodes writen by add_node onto the tree structure. :param xarray_data: XDS or XDT to be included into the data tree structure. :type xarray_data: xr.DataSet, xr.DataTree :param key_list: list of data identifying keys to determine where to add node :type key_list: list, tuple :return: None :rtype: NoneType .. method:: is_close_to(self, other_mds, tol=1e-06) Tests if self and other_mds are close to each other. :param other_mds: Another mds :type other_mds: AstrohackBaseFile :param tol: Tolerance :type tol: float :return: True if Mdses are close up to tolerance :rtype: bool .. method:: consolidate(self, key_order: list[str]) Traverse own file structure on disk consolidating metadata to create a unified data tree entity. :param key_order: Order in which keys appear in file structure, ordered by depth. :type key_order: list :return: None :rtype: NoneType