Get showcase dataset dict

        Args:
            showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary

        Returns:
            Dict: showcase dataset dict
321069
def _get_showcase_dataset_dict(self, dataset):
        # type: (Union[hdx.data.dataset.Dataset,Dict,str]) -> Dict
        
        if isinstance(dataset, hdx.data.dataset.Dataset) or isinstance(dataset, dict):
            if 'id' not in dataset:
                dataset = hdx.data.dataset.Dataset.read_from_hdx(dataset['name'])
            dataset = dataset['id']
        elif not isinstance(dataset, str):
            raise hdx.data.hdxobject.HDXError('Type %s cannot be added as a dataset!' % type(dataset).__name__)
        if is_valid_uuid(dataset) is False:
            raise hdx.data.hdxobject.HDXError('%s is not a valid dataset id!' % dataset)
        return {'showcase_id': self.data['id'], 'package_id': dataset}
568162
def all(self):
        
        return self._get_json(HTTPMethods.GET,
                              self._cached_datasets_url,
                              self._get_master_key())
847916
def _get_collection_item(collection_id, dataset_id):
    
    collection_item = db.DBSession.query(DatasetCollectionItem).\
            filter(DatasetCollectionItem.collection_id==collection_id,
                   DatasetCollectionItem.dataset_id==dataset_id).first()
    return collection_item
208885
def getVariantAnnotationSets(self, datasetId):
        
        # TODO this should be displayed per-variant set, not per dataset.
        variantAnnotationSets = []
        dataset = app.backend.getDataRepository().getDataset(datasetId)
        for variantSet in dataset.getVariantSets():
            variantAnnotationSets.extend(
                variantSet.getVariantAnnotationSets())
        return variantAnnotationSets
1222412
def get_data_metadata(self):
        
        # Implemented from template for osid.resource.ResourceForm.get_group_metadata_template
        metadata = dict(self._mdata['data'])
        metadata.update({'existing_object_values': self._my_map['data']})
        return Metadata(**metadata)
230063
def get_dataset():
    
    seg_data = "segmentation-X.npy"
    seg_labels = "segmentation-y.npy"
    # seg_ids = "segmentation-ids.npy"
    if os.path.isfile(seg_data) and os.path.isfile(seg_labels):
        X = numpy.load(seg_data)
        y = numpy.load(seg_labels)

        with open('datasets.pickle', 'rb') as f:
            datasets = pickle.load(f)
        return (X, y, datasets)
    datasets = get_segmented_raw_data()
    X, y = [], []
    for i, data in enumerate(datasets):
        if i % 10 == 0:
            logging.info("[Create Dataset] i=%i/%i", i, len(datasets))
        segmentation = json.loads(data['segmentation'])
        recording = json.loads(data['data'])
        X_symbol = [get_median_stroke_distance(recording)]
        if len([p for s in recording for p in s if p['time'] is None]) > 0:
            continue
        combis = itertools.combinations(list(range(len(recording))), 2)
        for strokeid1, strokeid2 in combis:
            stroke1 = recording[strokeid1]
            stroke2 = recording[strokeid2]
            if len(stroke1) == 0 or len(stroke2) == 0:
                logging.debug("stroke len 0. Skip.")
                continue
            X.append(get_stroke_features(recording, strokeid1, strokeid2) +
                     X_symbol)
            same_symbol = (_get_symbol_index(strokeid1, segmentation) ==
                           _get_symbol_index(strokeid2, segmentation))
            y.append(int(same_symbol))
    X = numpy.array(X, dtype=numpy.float32)
    y = numpy.array(y, dtype=numpy.int32)
    numpy.save(seg_data, X)
    numpy.save(seg_labels, y)
    datasets = filter_recordings(datasets)
    with open('datasets.pickle', 'wb') as f:
        pickle.dump(datasets, f, protocol=pickle.HIGHEST_PROTOCOL)
    return (X, y, datasets)
464622
def _get_metadata(dataset_ids):
    
    metadata = []
    if len(dataset_ids) == 0:
        return []
    if len(dataset_ids) > qry_in_threshold:
        idx = 0
        extent = qry_in_threshold
        while idx < len(dataset_ids):
            log.info("Querying %s metadatas", len(dataset_ids[idx:extent]))
            rs = db.DBSession.query(Metadata).filter(Metadata.dataset_id.in_(dataset_ids[idx:extent])).all()
            metadata.extend(rs)
            idx = idx + qry_in_threshold

            if idx + qry_in_threshold > len(dataset_ids):
                extent = len(dataset_ids)
            else:
                extent = extent +qry_in_threshold
    else:
        metadata_qry = db.DBSession.query(Metadata).filter(Metadata.dataset_id.in_(dataset_ids))
        for m in metadata_qry:
            metadata.append(m)

    return metadata
904121
def show(self, dataset_id, overlay=None):
        """"""
        from satpy.writers import get_enhanced_image
        from satpy.utils import in_ipynb
        img = get_enhanced_image(self[dataset_id].squeeze(), overlay=overlay)
        if not in_ipynb():
            img.show()
        return img
957572
def asDictionary(self):
        
        template =  {
            "type": "dataLayer",
            "dataSource": self._dataSource
        }
        if not self._fields is None:
            template['fields'] = self._fields
        return template
656688
def merge(self, samples_uuid):
        

        all_meta_data = pd.DataFrame()
        for dm in self.data_model:
            all_meta_data = pd.concat([all_meta_data, dm.meta], axis=0)

        group = all_meta_data.groupby([samples_uuid])['sample']
        sample_sets = group.apply(list).values

        merged_df = pd.DataFrame()
        multi_index = list(map(list, zip(*sample_sets)))
        multi_index_names = list(range(0, len(sample_sets[0])))
        i = 1
        for pair in sample_sets:
            i += 1
            numbers = list(range(0, len(pair)))
            df_temp = pd.DataFrame()
            for n in numbers:
                try:  # data.loc[pair[n]] may not be found due to the fast loading (full_load = False)
                    df_temp = pd.concat([df_temp, self.data_model[n].data.loc[pair[n]]], axis=1)
                except:
                    pass
            merged_df = pd.concat([merged_df, df_temp.T.bfill().iloc[[0]]], axis=0)

        multi_index = np.asarray(multi_index)
        multi_index = pd.MultiIndex.from_arrays(multi_index, names=multi_index_names)
        merged_df.index = multi_index
        return merged_df
1175150
def get_template(template_id,**kwargs):
    
    try:
        tmpl_i = db.DBSession.query(Template).filter(Template.id==template_id).options(joinedload_all('templatetypes.typeattrs.default_dataset.metadata')).one()

        #Load the attributes.
        for tmpltype_i in tmpl_i.templatetypes:
            for typeattr_i in tmpltype_i.typeattrs:
                typeattr_i.attr

        return tmpl_i
    except NoResultFound:
        raise HydraError("Template %s not found"%template_id)
420198
def get_data(
    dataset,
    query=None,
    crs="epsg:4326",
    bounds=None,
    sortby=None,
    pagesize=10000,
    max_workers=5,
):
    
    param_dicts = define_request(dataset, query, crs, bounds, sortby, pagesize)

    with ThreadPoolExecutor(max_workers=max_workers) as executor:
        results = executor.map(make_request, param_dicts)

    outjson = dict(type="FeatureCollection", features=[])
    for result in results:
        outjson["features"] += result
    return outjson
916082
def fetch_model_data(model_querysets, model_ids_to_fetch):
    
    return {
        model: id_dict(model_querysets[model].filter(id__in=ids_to_fetch))
        for model, ids_to_fetch in model_ids_to_fetch.items()
    }
335155
def iris(display=False):
    

    d = sklearn.datasets.load_iris()
    df = pd.DataFrame(data=d.data, columns=d.feature_names) # pylint: disable=E1101
    if display:
        return df, [d.target_names[v] for v in d.target] # pylint: disable=E1101
    else:
        return df, d.target
468225
def get_dataset(self, dataset_id, ds_info):
        """"""
        msg = self._get_message(ds_info)
        ds_info = self.get_metadata(msg, ds_info)
        fill = msg['missingValue']
        data = msg.values.astype(np.float32)
        if msg.valid_key('jScansPositively') and msg['jScansPositively'] == 1:
            data = data[::-1]

        if isinstance(data, np.ma.MaskedArray):
            data = data.filled(np.nan)
            data = da.from_array(data, chunks=CHUNK_SIZE)
        else:
            data[data == fill] = np.nan
            data = da.from_array(data, chunks=CHUNK_SIZE)

        return xr.DataArray(data, attrs=ds_info, dims=('y', 'x'))
1061655
def get_metadata(self, dataset_identifier, content_type="json"):
        '''
        
        '''
        resource = _format_old_api_request(dataid=dataset_identifier, content_type=content_type)
        return self._perform_request("get", resource)
1121112
def get_dataset_key(self, key, **kwargs):
        
        return get_key(key, self.ids.keys(), **kwargs)