How to use intake - 10 common examples

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 codeforamerica / intake / tests / acceptance / test_screenshots.py View on Github external
]
        counties = models.County.objects.all()
        for county in counties:
            if county.slug == constants.Counties.SAN_FRANCISCO:
                self.sfcounty = county
            elif county.slug == constants.Counties.CONTRA_COSTA:
                self.cccounty = county
        self.submissions = []
        for org_set in org_sets:
            answers = {
                **intake_mock.fake.cleaned_sf_county_form_answers(),
                **intake_mock.fake.contra_costa_county_form_answers(),
                **intake_mock.fake.alameda_county_form_answers(),
                **intake_mock.fake.declaration_letter_answers(),
            }
            sub = models.FormSubmission.create_for_organizations(
                organizations=org_set, answers=answers)
            self.submissions.append(sub)
            for org in org_set:
                if org.slug != 'cfa':
                    attr_name = org.slug + '_submissions'
                    org_subs = getattr(self, attr_name)
                    org_subs.append(sub)
                    setattr(self, attr_name, org_subs)
        self.pdf = intake_mock.useable_pdf(self.sf_pubdef)
        self.superuser = auth_mock.fake_superuser()
        accounts_models.UserProfile.objects.create(
            user=self.superuser,
            organization=self.cfa)
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 NCAR / intake-esm / tests / gmet / test_gmet.py View on Github external
def test_to_xarray():
    with config.set({'database-directory': './tests/test_collections'}):
        col = intake.open_esm_metadatastore(collection_name='gmet_test')
        cat = col.search(direct_access=True)
        ds = cat.to_xarray(chunks={'time': 1}, decode_times=True)
        assert isinstance(ds, xr.Dataset)
        assert 'member_id' in ds.coords
github NCAR / intake-esm / tests / mpige / test_mpige.py View on Github external
def test_build_collection():
    with config.set({'database-directory': './tests/test_collections'}):
        collection_input_definition = os.path.join(here, 'mpi-ge.yml')
        col = intake.open_esm_metadatastore(
            collection_input_definition=collection_input_definition, overwrite_existing=True
        )
        assert isinstance(col.df, pd.DataFrame)
github NCAR / intake-esm / tests / mpige / test_mpige.py View on Github external
def test_search():
    with config.set({'database-directory': './tests/test_collections'}):
        c = intake.open_esm_metadatastore(collection_name='mpige_test')
        cat = c.search(component='mpiom', stream='monitoring_ym')

        assert isinstance(cat.df, pd.DataFrame)
        assert len(cat.df) > 0
github NCAR / intake-esm / tests / cmip5 / test_cmip5.py View on Github external
def test_search():
    c = intake.open_esm_metadatastore(esmcol_path)
    cat = c.search(model=['CanESM2', 'CSIRO-Mk3-6-0'])
    assert isinstance(cat.df, pd.DataFrame)
    assert len(cat.df) > 0