def test_search(query, require_all_on, expected): df = pd.DataFrame({ 'A': [ 'NCAR', 'IPSL', 'IPSL', 'CSIRO', 'IPSL', 'NCAR', 'NOAA', 'NCAR', 'NASA' ], 'B': ['CESM', 'FOO', 'FOO', 'BAR', 'FOO', 'CESM', 'GCM', 'WACM', 'foo'], 'C': [ 'hist', 'control', 'hist', 'control', 'hist', 'control', 'hist', 'hist', 'HiSt' ], 'D': ['O2', 'O2', 'O2', 'O2', 'NO2', 'O2', 'O2', 'TA', 'tAs'], }) x = search(df, require_all_on=require_all_on, **query).to_dict(orient='records') assert x == expected
def test_search_columns_with_iterables(df, query, expected): results = search(df, **query).to_dict(orient='records') assert results == expected
'compat': 'override' } }, 'time_range': { 'type': 'join_existing', 'options': { 'dim': 'time' } }, } subset_df = search( df, activity_id='CMIP', institution_id='CNRM-CERFACS', source_id='CNRM-CM6-1', experiment_id='historical', table_id='Amon', grid_label='gr', ) @pytest.fixture(scope='module') def group_args(): group_args = dict( key='foo', df=subset_df, aggregation_dict=aggregation_dict, path_column='path', variable_column='variable_id', data_format='netcdf',