Get metadata from a LiPD data in memory

    | Example
    | m = lipd.getMetadata(D["Africa-ColdAirCave.Sundqvist.2013"])

    :param dict L: One LiPD record
    :return dict d: LiPD record (metadata only)
778157
def getMetadata(L):
    
    _l = {}
    try:
        # Create a copy. Do not affect the original data.
        _l = copy.deepcopy(L)
        # Remove values fields
        _l = rm_values_fields(_l)
    except Exception as e:
        # Input likely not formatted correctly, though other problems can occur.
        print("Error: Unable to get data. Please check that input is LiPD data: {}".format(e))
    return _l
18744
public org.tensorflow.framework.RunMetadata getMetadata() {
    return metadata_ == null ? org.tensorflow.framework.RunMetadata.getDefaultInstance() : metadata_;
  }
314100
def _get_formatted_data(cls, path, context=None, site=None, language=None):
        
        return FormattedMetadata(cls(), cls._get_instances(path, context, site, language), path, site, language)
1353939
def getMetadata(self, objectId=None, **filters):
        
        return self.get_or(
            _cache_key("Nautilus", self.name, "GetMetadata", objectId),
            super(ProtoNautilusCtsResolver, self).getMetadata, objectId
        )
69848
def get_metadata(self, loadbalancer, node=None, raw=False):
        
        if node:
            uri = "/loadbalancers/%s/nodes/%s/metadata" % (
                    utils.get_id(loadbalancer), utils.get_id(node))
        else:
            uri = "/loadbalancers/%s/metadata" % utils.get_id(loadbalancer)
        resp, body = self.api.method_get(uri)
        meta = body.get("metadata", [])
        if raw:
            return meta
        ret = dict([(itm["key"], itm["value"]) for itm in meta])
        return ret
606297
def get_metaData(self, dcmlist, series_number):
        
        # if dcmlist is None:
        #     dcmlist = self.files_in_serie

        # number of slice where to extract metadata inforamtion
        ifile = 0
        if len(dcmlist) == 0:
            return {}

        logger.debug("Filename: " + dcmlist[ifile])
        data1 = self._read_file(dcmlist[ifile])
        try:
            # try to get difference from the beginning and also from the end
            voxeldepth = self._get_slice_location_difference(dcmlist, ifile)
            voxeldepth_end = self._get_slice_location_difference(dcmlist, -2)
            if voxeldepth != voxeldepth_end:
                logger.warning("Depth of slices is not the same in beginning and end of the sequence")
                voxeldepth_1 = self._get_slice_location_difference(dcmlist, 1)
                voxeldepth = np.median([voxeldepth, voxeldepth_end, voxeldepth_1])



            # head1, teil1 = os.path.split(dcmlist[ifile])
            # head2, teil2 = os.path.split(dcmlist[ifile + 1])
            #
            # data2 = self._read_file(dcmlist[ifile + 1])
            # loc1 = get_slice_location(data1, teil1)
            # loc2 = get_slice_location(data2, teil2)
            # voxeldepth = float(np.abs(loc1 - loc2))
        except Exception:
            logger.warning('Problem with voxel depth. Using SliceThickness')
            logger.debug(traceback.format_exc())
            # + ' SeriesNumber: ' + str(data1.SeriesNumber))

            try:
                voxeldepth = float(data1.SliceThickness)
            except Exception:
                logger.warning('Probem with SliceThicknes, setting zero. '
                               + traceback.format_exc())
                voxeldepth = 0

        try:
            pixelsize_mm = data1.PixelSpacing
        except:
            logger.warning('Problem with PixelSpacing. Using [1,1]')
            pixelsize_mm = [1, 1]
        voxelsize_mm = [
            voxeldepth,
            float(pixelsize_mm[0]),
            float(pixelsize_mm[1]),
        ]
        metadata = {'voxelsize_mm': voxelsize_mm,
                    'Modality': data1.Modality,
                    'SeriesNumber': series_number
                    }

        try:
            metadata['SeriesDescription'] = data1.SeriesDescription

        except:
            logger.info(
                'Problem with tag SeriesDescription, SeriesNumber: ' +
                str(data1.SeriesNumber))
        try:
            metadata['ImageComments'] = data1.ImageComments
        except:
            logger.info(
                'Problem with tag ImageComments')
            # , SeriesNumber: ' +
            # str(data1.SeriesNumber))
        try:
            metadata['Modality'] = data1.Modality
        except:
            logger.info(
                'Problem with tag Modality')
            # SeriesNumber: ' +
            #     str(data1.SeriesNumber))
        metadata = attr_to_dict(data1, "AcquisitionDate", metadata)
        metadata = attr_to_dict(data1, "StudyDate", metadata)
        metadata = attr_to_dict(data1, "StudyID", metadata)
        metadata = attr_to_dict(data1, "StudyDescription", metadata)
        metadata = attr_to_dict(data1, "RequestedProcedureDescription", metadata)
        metadata = attr_to_dict(data1, "PatientSex", metadata)
        metadata = attr_to_dict(data1, "PatientAge", metadata)
        metadata = attr_to_dict(data1, "PatientID", metadata)
        metadata = attr_to_dict(data1, "PatientName", metadata)
        # metadata = attr_to_dict(data1, "AcquisitionTime", metadata)

        metadata['dcmfilelist'] = dcmlist
        return metadata
724431
def _metadata_from_video(self, video):
        ''''''
        long_desc = video['long_description']
        if long_desc is not None:
            long_desc = long_desc[:MAX_METADATA_STRING_LEN]

        tags = video.get('tags')

        metadata = {
            'name': default_to_empty_string(video.get('name')),
            'description': default_to_empty_string(video.get('description')),
            'long_description': default_to_empty_string(long_desc),
            'tags': tags if tags is not None else [],
            'updated_at': video.get('updated_at'),
            'created_at': video.get('created_at'),
            'state': video.get('state')
        }
        return metadata
1090391
def getmetadata(self, key=None):
        """"""
        if self.metadata:
            d =  self.doc.submetadata[self.metadata]
        elif self.parent:
            d =  self.parent.getmetadata()
        elif self.doc:
            d =  self.doc.metadata
        else:
            return None
        if key:
            return d[key]
        else:
            return d
409108
def get_metadata(self):
        
        if self._metadata is None:
            self._metadata = ContainerMetadata()
        inspect_to_container_metadata(self._metadata, self.inspect(refresh=True), self.image)
        return self._metadata
1313412
def get_metadata(self, refresh=True):
        
        if refresh or not self._metadata:
            ident = self._id or self.name
            if not ident:
                raise ConuException(
                    "This container does not have a valid identifier.")
            out = run_cmd(["machinectl", "--no-pager", "show", ident], return_output=True, ignore_status=True)
            if "Could not get path to machine" in out:
                self._metadata = {}
            else:
                self._metadata = convert_kv_to_dict(out)
        return self._metadata
1190159
def get_metadata(self, key, counter_id):
        
        with self._lock:
            metadata = self._metadata[key]
            try:
                return metadata[counter_id]
            except KeyError:
                raise MetadataNotFoundError("No metadata for counter id '{}' found in the cache.".format(counter_id))
1291013
def get_metadata(engine_name=None):
    
    dispatch.get(None, 'load_models')

    engine = engine_manager[engine_name]
    
    for tablename, m in engine.models.items():
        get_model(tablename, engine_name, signal=False)
        if hasattr(m, '__dynamic__') and getattr(m, '__dynamic__'):
            m.table.__mapping_only__ = True
    return engine.metadata
734911
def table_metadata(self, database, table):
        ""
        return (self.metadata("databases") or {}).get(database, {}).get(
            "tables", {}
        ).get(
            table, {}
        )
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
77114
def metadata(self):
        
        if self._metadata is None:
            try:
                with open(self.paths.metadata()) as metadata_fd:
                    self._metadata = json.load(metadata_fd)
            except IOError:
                self._metadata = {}
        return self._metadata
1207197
def _getNodeData(self, name, metadata, channel=None):
        
        nodeChannel = None
        if name in metadata:
            nodeChannelList = metadata[name]
            if len(nodeChannelList) > 1:
                nodeChannel = channel if channel is not None else nodeChannelList[0]
            elif len(nodeChannelList) == 1:
                nodeChannel = nodeChannelList[0]
            else:
                LOG.warning("HMDevice._getNodeData: %s not found in %s, empty nodeChannelList" % (name, metadata))
                return None
            if nodeChannel is not None and nodeChannel in self.CHANNELS:
                return self._hmchannels[nodeChannel].getValue(name)

        LOG.error("HMDevice._getNodeData: %s not found in %s" % (name, metadata))
        return None
1082671
def from_metadata(cls, metadata: Dict[str, Any]) -> 'LogFields':
        
        return cls(fields=json.loads(metadata.get(LOG_FIELDS_KEY_META, '{}')))