How to use the intake.open_catalog function in intake

To help you get started, we’ve selected a few intake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bluesky / databroker / test_intake_bluesky.py View on Github external
def test_read_canonical_scalar(bundle):
    cat = intake.open_catalog(bundle.intake_server, page_size=10)
    run = cat['xyz']()[bundle.det_scan_uid]
    run.read_canonical()

    def sorted_actual():
        for name_ in ('start', 'descriptor', 'event', 'stop'):
            for name, doc in bundle.det_scan_docs:
                if name == name_:
                    yield name, doc

    for actual, expected in zip(run.read_canonical(), sorted_actual()):
        actual_name, actual_doc = actual
        expected_name, expected_doc = expected
        assert actual_name == expected_name
        assert actual_doc == expected_doc
github bluesky / databroker / test_intake_bluesky.py View on Github external
def test_access_scalar_data(bundle):
    "Access simple scalar data that is stored directly in Event documents."
    cat = intake.open_catalog(bundle.intake_server, page_size=10)
    run = cat['xyz']()[bundle.det_scan_uid]()
    entry = run['primary']
    entry.read()
    entry().to_dask()
    entry().to_dask().load()
github bluesky / databroker / test_intake_bluesky.py View on Github external
def test_access_nonscalar_data(bundle):
    "Access nonscalar data that is stored directly in Event documents."
    cat = intake.open_catalog(bundle.intake_server, page_size=10)
    run = cat['xyz']()[bundle.direct_img_scan_uid]()
    entry = run['primary']
    entry.read()
    entry().to_dask()
    entry().to_dask().load()
github pangeo-data / pangeo-datastore / tests / test_datasets.py View on Github external
def get_master_catalog():
    # TODO: replace with environment variable
    fname = os.path.join(os.path.dirname(__file__),
                         '../intake-catalogs/master.yaml')
    return intake.open_catalog(fname)
github bluesky / databroker / test_intake_bluesky.py View on Github external
def test_read_canonical_nonscalar(bundle):
    cat = intake.open_catalog(bundle.intake_server, page_size=10)
    run = cat['xyz']()[bundle.direct_img_scan_uid]
    run.read_canonical()

    def sorted_actual():
        for name_ in ('start', 'descriptor', 'event', 'stop'):
            for name, doc in bundle.direct_img_scan_docs:
                if name == name_:
                    yield name, doc

    for actual, expected in zip(run.read_canonical(), sorted_actual()):
        actual_name, actual_doc = actual
        expected_name, expected_doc = expected
        assert actual_name == expected_name
        assert actual_doc == expected_doc
github intake / intake / intake / gui / panel.py View on Github external
def cat_from_string_or_cat(cat):
    """Return a catalog instance when given a cat or a string"""
    if isinstance(cat, str):
        cat = intake.open_catalog(cat)
    return cat
github intake / intake / intake / gui / catalog / select.py View on Github external
def preprocess(cls, cat):
        """Function to run on each cat input"""
        if isinstance(cat, str):
            cat = intake.open_catalog(cat)
        return cat
github holoviz / hvplot / hvplot / sample_data.py View on Github external
try:
    from intake import open_catalog
except:
    raise ImportError('Loading hvPlot sample data requires intake '
                      'and intake-parquet. Install it using conda or '
                      'pip before loading data.')

_file_path = os.path.dirname(__file__)
if os.path.isdir(os.path.join(_file_path, 'examples')):
    _cat_path = os.path.join(_file_path, 'examples', 'datasets.yaml')
else:
    _cat_path = os.path.join(_file_path, '..', 'examples', 'datasets.yaml')

# Load catalogue
catalogue = open_catalog(_cat_path)

# Add catalogue entries to namespace
for _c in catalogue:
    globals()[_c] = catalogue[_c]
github intake / intake / intake / gui / widgets.py View on Github external
def add_cat(self, ev=None):
        """Add catalog instance to the browser

        Also called, without a catalog instance, when the (+) button is
        pressed, which will attempt to read a catalog and, if successful,
        add it to the browser.
        """
        if isinstance(ev, intake.catalog.Catalog):
            cat = ev
        else:
            try:
                cat = intake.open_catalog(ev)
                list(cat)  # fails if parse is bad
            except Exception as e:
                self.exception = e
                return
        self.cats[cat.name] = cat
        self.update_cat_list()
        self.cat_list.value = cat._name
        self.cat_selected({'new': cat._name})
github intake / intake / intake / gui / catalog / add.py View on Github external
def cat(self):
        """Catalog object initialized from from cat_url"""
        # might want to do some validation in here
        return intake.open_catalog(self.cat_url)