Apply enhancements to dataset *dset* and return the resulting data
    array of the image.
559094
def enhance2dataset(dset):
    """"""
    attrs = dset.attrs
    img = get_enhanced_image(dset)
    # Clip image data to interval [0.0, 1.0]
    data = img.data.clip(0.0, 1.0)
    data.attrs = attrs

    return data
478850
def _load_dataset_clipping(self, dataset_dir, epsilon):
    
    self.dataset_max_clip = {}
    self.dataset_min_clip = {}
    self._dataset_image_count = 0
    for fname in os.listdir(dataset_dir):
      if not fname.endswith('.png'):
        continue
      image_id = fname[:-4]
      image = np.array(
          Image.open(os.path.join(dataset_dir, fname)).convert('RGB'))
      image = image.astype('int32')
      self._dataset_image_count += 1
      self.dataset_max_clip[image_id] = np.clip(image + epsilon,
                                                0,
                                                255).astype('uint8')
      self.dataset_min_clip[image_id] = np.clip(image - epsilon,
                                                0,
                                                255).astype('uint8')
510149
def addDataset(self, dataset):
        
        item = XChartDatasetItem()
        self.addItem(item)
        item.setDataset(dataset)
        return item
1042927
def load_dataset(*args, **kwargs):
    
    warnings.warn(
        "load_dataset` will be removed in a future version of xarray. The "
        "current behavior of this function can be achived by using "
        "`tutorial.open_dataset(...).load()`.",
        DeprecationWarning, stacklevel=2)
    return open_dataset(*args, **kwargs).load()
334545
def create_dset(directory,slice_order='alt+z',sort_order='zt',force_slices=None):
    ''''''
    return _create_dset_dicom(directory,slice_order,sort_order,force_slices=force_slices)
725103
public static MultiDataSet toMultiDataSet(DataSet dataSet) {
        INDArray f = dataSet.getFeatures();
        INDArray l = dataSet.getLabels();
        INDArray fMask = dataSet.getFeaturesMaskArray();
        INDArray lMask = dataSet.getLabelsMaskArray();

        INDArray[] fNew = f == null ? null : new INDArray[] {f};
        INDArray[] lNew = l == null ? null : new INDArray[] {l};
        INDArray[] fMaskNew = (fMask != null ? new INDArray[] {fMask} : null);
        INDArray[] lMaskNew = (lMask != null ? new INDArray[] {lMask} : null);

        return new org.nd4j.linalg.dataset.MultiDataSet(fNew, lNew, fMaskNew, lMaskNew);
    }
752495
def _slice_datasets(self, dataset_ids, slice_key, new_area, area_only=True):
        """"""
        new_datasets = {}
        datasets = (self[ds_id] for ds_id in dataset_ids)
        for ds, parent_ds in dataset_walker(datasets):
            ds_id = DatasetID.from_dict(ds.attrs)
            # handle ancillary variables
            pres = None
            if parent_ds is not None:
                pres = new_datasets[DatasetID.from_dict(parent_ds.attrs)]
            if ds_id in new_datasets:
                replace_anc(ds, pres)
                continue
            if area_only and ds.attrs.get('area') is None:
                new_datasets[ds_id] = ds
                replace_anc(ds, pres)
                continue

            if not isinstance(slice_key, dict):
                # match dimension name to slice object
                key = dict(zip(ds.dims, slice_key))
            else:
                key = slice_key
            new_ds = ds.isel(**key)
            if new_area is not None:
                new_ds.attrs['area'] = new_area

            new_datasets[ds_id] = new_ds
            if parent_ds is None:
                # don't use `__setitem__` because we don't want this to
                # affect the existing wishlist/dep tree
                self.datasets[ds_id] = new_ds
            else:
                replace_anc(new_ds, pres)
843471
def resample_image(arr, max_size=400):
    """"""
    dim = np.max(arr.shape[0:2])
    if dim < max_size:
        max_size = dim
    x, y, _ = arr.shape
    sx = int(np.ceil(x / max_size))
    sy = int(np.ceil(y / max_size))
    img = np.zeros((max_size, max_size, 3), dtype=arr.dtype)
    arr = arr[0:-1:sx, 0:-1:sy, :]
    xl = (max_size - arr.shape[0]) // 2
    yl = (max_size - arr.shape[1]) // 2
    img[xl:arr.shape[0]+xl, yl:arr.shape[1]+yl, :] = arr
    return img
658197
def _canonize_input(self, dataset):
        
        unpack = lambda x: x
        if isinstance(dataset, _tc.SArray):
            dataset = _tc.SFrame({self.feature: dataset})
        elif isinstance(dataset, _tc.Image):
            dataset = _tc.SFrame({self.feature: [dataset]})
            unpack = lambda x: x[0]
        return dataset, unpack
694352
def _load_dataset(name, data_home=None, return_dataset=False):
    
    info = DATASETS[name]
    data = Dataset(name, data_home=data_home, **info)
    if return_dataset:
        return data
    return data.to_data()
465789
def _load_dataset(dsid, ds_info, file_handlers, dim='y'):
        """"""
        slice_list = []
        failure = True
        for fh in file_handlers:
            try:
                projectable = fh.get_dataset(dsid, ds_info)
                if projectable is not None:
                    slice_list.append(projectable)
                    failure = False
            except KeyError:
                logger.warning("Failed to load {} from {}".format(dsid, fh),
                               exc_info=True)

        if failure:
            raise KeyError(
                "Could not load {} from any provided files".format(dsid))

        if dim not in slice_list[0].dims:
            return slice_list[0]
        res = xr.concat(slice_list, dim=dim)

        combined_info = file_handlers[0].combine_info(
            [p.attrs for p in slice_list])

        res.attrs = combined_info
        return res
716969
def get_dataset(self, dsid, dsinfo):
        
        data = self[dsinfo.get('file_key', dsid.name)]
        data.attrs.update(dsinfo)

        data.attrs["platform_name"] = self['/attr/satellite_name']
        data.attrs["sensor"] = self['/attr/instrument_name']

        return data
1289231
def images(self):
        """"""
        for ds_id, projectable in self.datasets.items():
            if ds_id in self.wishlist:
                yield projectable.to_image()
1273816
def _load(self, dataset_spec):
        """"""

        for idx, ds in enumerate(dataset_spec):
            self.append(ds, idx)
26670
def loaded_dataset_ids(self):
        """"""
        return set(ds_id for scene in self.scenes for ds_id in scene.keys())
1224724
def _addDatasetAction(self, dataset):
        
        # create the toolbar action
        action = QAction(dataset.name(), self)
        action.setIcon(XColorIcon(dataset.color()))
        action.setCheckable(True)
        action.setChecked(True)
        action.setData(wrapVariant(dataset))
        action.toggled.connect(self.toggleDataset)
        
        self.uiDatasetTBAR.addAction(action)
1195652
def get_dataset(self, ds_id, ds_info):
        """"""
        var_path = ds_info['file_key']
        fill_value = ds_info.get('fill_value', 65535)
        metadata = self.get_metadata(ds_id, ds_info)

        data = self[var_path]
        if ((ds_info.get('standard_name') == "longitude" or
             ds_info.get('standard_name') == "latitude") and
                ds_id.resolution == 10000):
            # FIXME: Lower frequency channels need CoRegistration parameters applied
            data = data[:, ::2] * self[var_path + "/attr/SCALE FACTOR"]
        else:
            data = data * self[var_path + "/attr/SCALE FACTOR"]
        data = data.where(data != fill_value)
        data.attrs.update(metadata)
        return data