How to use the intake.open_esm_metadatastore 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 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
github NCAR / intake-esm / tests / cmip5 / test_cmip5.py View on Github external
def test_to_xarray_cmip(chunks, expected_chunks):
    c = intake.open_esm_metadatastore(esmcol_path)
    cat = c.search(variable=['hfls'], frequency='mon', modeling_realm='atmos', model=['CNRM-CM5'])

    dset = cat.to_dataset_dict(cdf_kwargs=dict(chunks=chunks))
    _, ds = dset.popitem()
    assert ds['hfls'].data.chunksize == expected_chunks
github NCAR / intake-esm / tests / test_storage.py View on Github external
def test_file_transfer_hsi():
    data_cache_dir = f'{TMPDIR}/intake-esm-tests/transferred-data'
    with config.set(
        {'database-directory': './tests/test_collections', 'data-cache-directory': data_cache_dir}
    ):
        collection_input_definition = os.path.join(
            here, 'ensure-file-hsi-transfer-collection-input.yml'
        )
        col = intake.open_esm_metadatastore(
            collection_input_definition=collection_input_definition, overwrite_existing=True
        )

        cat = col.search(variable=['SST'])

        query_results = _ensure_file_access(cat.df)
        local_urlpaths = query_results['path'].tolist()
        assert isinstance(local_urlpaths, list)
        assert len(local_urlpaths) > 0

        shutil.rmtree(data_cache_dir)
github NCAR / intake-esm / tests / era5 / test_era5.py View on Github external
def test_build_collection():
    with config.set({'database-directory': './tests/test_collections'}):
        collection_input_definition = os.path.join(here, 'era5-test.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 / gmet / test_gmet.py View on Github external
def test_build_collection():
    with config.set({'database-directory': './tests/test_collections'}):
        collection_input_definition = os.path.join(here, 'gmet-test.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 / cmip6 / test_cmip6_gs.py View on Github external
def test_search():
    col = intake.open_esm_metadatastore(path=csv_spec)
    cat = col.search(
        variable_id=['pr'],
        experiment_id='ssp370',
        activity_id='AerChemMIP',
        source_id='BCC-ESM1',
        table_id='Amon',
        grid_label='gn',
    )
    assert len(cat.df) > 0
    assert len(col.df.columns) == len(cat.df.columns)