access_nri_intake.experiment.main
=================================

.. py:module:: access_nri_intake.experiment.main


Functions
---------

.. autoapisummary::

   access_nri_intake.experiment.main.use_datastore
   access_nri_intake.experiment.main.find_esm_datastore
   access_nri_intake.experiment.main.scaffold_catalog_entry


Module Contents
---------------

.. py:function:: use_datastore(experiment_dir, builder = None, catalog_dir = None, builder_kwargs = None, open_ds = True, datastore_name = 'experiment_datastore', description = None)

   
   Specify a builder and an experiment directory in order to build and/or open
   an esm-datastore in place for that experiment. Valid and up to date datastores
   will not be overwritten.

   Further configuration can be done by passing additional keyword arguments

   :Parameters:

       **builder** : Builder
           The builder object that will be used to build the datastore.

       **experiment_dir** : Path | str
           The directory containing the experiment. If a string is passed, it will be
           converted to a Path object.

       **catalog_dir** : Path | str, optional
           The directory containing/to write the catalog to, if it differs from the
           experiment directory. If None, the catalog will be written to the experiment
           directory. If a string is passed, it will be converted to a Path object.

       **open_ds** : bool
           Whether to open the datastore after building it. Typically set to false
           when called from a console script.

       **builder_kwargs** : dict, optional
           Any additional keyword arguments to pass to the builder if needed - for
           example, AccessEsm15Builder additionally takes an `ensemble` argument

       **datastore_name** : str, optional
           The name of the datastore to be written. Defaults to 'experiment_datastore'.
           Datastores are written as `catalog_dir / datastore_name.json`.

       **description** : str, optional
           A description of the datastore. If None, a default description will be used.



   :Returns:

       esm_datastore | None
           The datastore object, if it was requested to be opened. Otherwise, None.




   :Raises:

       TBC
           ..







   ..
       !! processed by numpydoc !!

.. py:function:: find_esm_datastore(experiment_dir, datastore_name)

   
   Try to find an ESM datastore in the experiment directory, with the same name
   as the one we intend to build. If not, return a dummy DatastoreInfo object.

   To find an ESM datastore, we use the heuristic that an esm_datastore comprises
   a json file and a csv.gz (or.csv) file with the same name. To find these, we are
   first going to search experiment_dir and all its subdirectories for a json file,
   and then look for a file in the same directory where '.csv' is a member of the
   file objects suffixes property.

   :Parameters:

       **experiment_dir** : Path
           The directory containing the experiment.

       **datastore_name** : str
           The name of the datastore to be found.



   :Returns:

       DatastoreInfo
           A DatastoreInfo object containing the json and csv files if found, or
           a null DatastoreInfo object if not found.











   ..
       !! processed by numpydoc !!

.. py:function:: scaffold_catalog_entry(interactive)

   
   Provides the user information about how to add a datastore to the access-nri-intake
   catalog. If interactive is set to True, the user will be prompted to confirm that they
   are ready to continue with each step - else, all steps will be printed at once.


   :Parameters:

       **interactive** : bool
           Whether to provide interactive help or not.














   ..
       !! processed by numpydoc !!

