当前位置: 首页>>代码示例>>Python>>正文


Python walker.create函数代码示例

本文整理汇总了Python中sunpy.database.attrs.walker.create函数的典型用法代码示例。如果您正苦于以下问题:Python create函数的具体用法?Python create怎么用?Python create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了create函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_walker_create_vso_instrument

def test_walker_create_vso_instrument(vso_session):
    entries = walker.create(vso.attrs.Instrument("RHESSI"), vso_session)
    assert entries == [
        tables.DatabaseEntry(
            id=1,
            source=u"RHESSI",
            provider=u"LSSP",
            physobs=u"intensity",
            fileid=u"/hessidata/2011/09/20/hsi_20110920_010920",
            observation_time_start=datetime(2011, 9, 20, 1, 9, 20),
            observation_time_end=datetime(2011, 9, 20, 2, 27, 40),
            instrument=u"RHESSI",
            size=-1.0,
            wavemin=0.4132806430668068,
            wavemax=7.293187818826002e-05,
        ),
        tables.DatabaseEntry(
            id=2,
            source=u"RHESSI",
            provider=u"LSSP",
            physobs=u"intensity",
            fileid=u"/hessidata/2011/09/19/hsi_20110919_233340",
            observation_time_start=datetime(2011, 9, 19, 23, 33, 40),
            observation_time_end=datetime(2011, 9, 20, 1, 9, 20),
            instrument=u"RHESSI",
            size=-1.0,
            wavemin=0.4132806430668068,
            wavemax=7.293187818826002e-05,
        ),
    ]
开发者ID:ericmjonas,项目名称:sunpy,代码行数:30,代码来源:test_attrs.py

示例2: test_walker_create_vso_instrument

def test_walker_create_vso_instrument(vso_session):
    entries = walker.create(vso.attrs.Instrument('RHESSI'), vso_session)
    # TODO: Flaky
    expected = [
        tables.DatabaseEntry(id=1, source=u'RHESSI', provider=u'LSSP',
                             physobs=u'intensity',
                             fileid=u'/hessidata/2011/09/20/hsi_20110920_010920',
                             observation_time_start=datetime(2011, 9, 20, 1, 9, 20),
                             observation_time_end=datetime(2011, 9, 20, 2, 27, 40),
                             instrument=u'RHESSI', wavemin=0.4132806579880238,
                             wavemax=7.293188082141598e-05),
        tables.DatabaseEntry(id=2, source=u'RHESSI', provider=u'LSSP',
                             physobs=u'intensity',
                             fileid=u'/hessidata/2011/09/19/hsi_20110919_233340',
                             observation_time_start=datetime(2011, 9, 19, 23, 33, 40),
                             observation_time_end=datetime(2011, 9, 20, 1, 9, 20),
                             instrument=u'RHESSI', wavemin=0.4132806579880238,
                             wavemax=7.293188082141598e-05)]
    expected_2 = [
        tables.DatabaseEntry(id=1, source=u'RHESSI', provider=u'LSSP',
                             physobs=u'intensity',
                             fileid=u'/hessidata/2011/09/19/hsi_20110919_233340',
                             observation_time_start=datetime(2011, 9, 19, 23, 33, 40),
                             observation_time_end=datetime(2011, 9, 20, 1, 9, 20),
                             instrument=u'RHESSI', wavemin=0.4132806579880238,
                             wavemax=7.293188082141598e-05),
        tables.DatabaseEntry(id=2, source=u'RHESSI', provider=u'LSSP',
                             physobs=u'intensity',
                             fileid=u'/hessidata/2011/09/20/hsi_20110920_010920',
                             observation_time_start=datetime(2011, 9, 20, 1, 9, 20),
                             observation_time_end=datetime(2011, 9, 20, 2, 27, 40),
                             instrument=u'RHESSI', wavemin=0.4132806579880238,
                             wavemax=7.293188082141598e-05)]
    assert len(entries) == len(expected)
    assert entries in [expected, expected_2]
开发者ID:Cadair,项目名称:sunpy,代码行数:35,代码来源:test_attrs.py

示例3: test_walker_create_downloadtime_inverted

def test_walker_create_downloadtime_inverted(session):
    tag = tables.Tag('foo')
    tag.id = 1
    fits_header_entry = tables.FitsHeaderEntry('INSTRUME', 'EIT')
    fits_header_entry.id = 1
    download_time = ~DownloadTime(
        datetime(2005, 6, 15, 7), datetime(2005, 6, 15, 9))
    entries = walker.create(download_time, session)
    assert len(entries) == 7
    assert entries == [
        tables.DatabaseEntry(
            id=1, download_time=datetime(2005, 6, 15, 1)),
        tables.DatabaseEntry(
            id=2, starred=True, download_time=datetime(2005, 6, 15, 2)),
        tables.DatabaseEntry(
            id=3, path='/tmp', download_time=datetime(2005, 6, 15, 3)),
        tables.DatabaseEntry(
            id=4, starred=True, download_time=datetime(2005, 6, 15, 4)),
        tables.DatabaseEntry(
            id=5, tags=[tag], download_time=datetime(2005, 6, 15, 5)),
        tables.DatabaseEntry(
            id=6, starred=True, path='/tmp',
            download_time=datetime(2005, 6, 15, 6)),
        tables.DatabaseEntry(
            id=10, starred=True, tags=[tag],
            download_time=datetime(2005, 6, 15, 10),
            fits_header_entries=[fits_header_entry])]
开发者ID:Alex-Ian-Hamilton,项目名称:sunpy,代码行数:27,代码来源:test_attrs.py

示例4: test_walker_create_vso_instrument

def test_walker_create_vso_instrument(vso_session):
    entries = walker.create(vso.attrs.Instrument('AIA'), vso_session)
    assert entries == [
        tables.DatabaseEntry(id=1, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:193:1086652831',
            observation_time_start=datetime(2011, 6, 8, 23, 59, 55),
            observation_time_end=datetime(2011, 6, 8, 23, 59, 56),
            instrument='AIA', size=66200.0, wavemin=19.3, wavemax=19.3),
        tables.DatabaseEntry(id=2, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:94:1086652832',
            observation_time_start=datetime(2011, 6, 8, 23, 59, 56),
            observation_time_end=datetime(2011, 6, 8, 23, 59, 57),
            instrument='AIA', size=66200.0, wavemin=9.4, wavemax=9.4),
        tables.DatabaseEntry(id=3, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:131:1086652833',
            observation_time_start=datetime(2011, 6, 8, 23, 59, 57),
            observation_time_end=datetime(2011, 6, 8, 23, 59, 58),
            instrument='AIA', size=66200.0, wavemin=13.1, wavemax=13.1),
        tables.DatabaseEntry(id=4, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:171:1086652835',
            observation_time_start=datetime(2011, 6, 9, 0, 0),
            observation_time_end=datetime(2011, 6, 9, 0, 0, 1),
            instrument='AIA', size=66200.0, wavemin=17.1, wavemax=17.1),
        tables.DatabaseEntry(id=5, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:211:1086652836',
            observation_time_start=datetime(2011, 6, 9, 0, 0),
            observation_time_end=datetime(2011, 6, 9, 0, 0, 1),
            instrument='AIA', size=66200.0, wavemin=21.1, wavemax=21.1)]
开发者ID:examon,项目名称:sunpy,代码行数:28,代码来源:test_attrs.py

示例5: test_walker_create_downloadtime_exists

def test_walker_create_downloadtime_exists(session):
    download_time = DownloadTime(datetime(2005, 6, 15, 7), datetime(2005, 6, 15, 9))
    entries = walker.create(download_time, session)
    assert entries == [
        tables.DatabaseEntry(id=7, download_time=datetime(2005, 6, 15, 7)),
        tables.DatabaseEntry(id=8, starred=True, download_time=datetime(2005, 6, 15, 8)),
        tables.DatabaseEntry(id=9, path="/tmp", download_time=datetime(2005, 6, 15, 9)),
    ]
开发者ID:ericmjonas,项目名称:sunpy,代码行数:8,代码来源:test_attrs.py

示例6: query

    def query(self, *query, **kwargs):
        """
        query(*query[, sortby])
        Send the given query to the database and return a list of
        database entries that satisfy all of the given attributes.

        Apart from the attributes supported by the VSO interface, the following
        attributes are supported:

            - :class:`sunpy.database.attrs.Starred`

            - :class:`sunpy.database.attrs.Tag`

            - :class:`sunpy.database.attrs.Path`

            - :class:`sunpy.database.attrs.DownloadTime`

            - :class:`sunpy.database.attrs.FitsHeaderEntry`

        An important difference to the VSO attributes is that these attributes
        may also be used in negated form using the tilde ~ operator.

        Parameters
        ----------
        query : list
            A variable number of attributes that are chained together via the
            boolean AND operator. The | operator may be used between attributes
            to express the boolean OR operator.
        sortby : str, optional
            The column by which to sort the returned entries. The default is to
            sort by the start of the observation. See the attributes of
            :class:`sunpy.database.tables.DatabaseEntry` for a list of all
            possible values.

        Raises
        ------
        TypeError
            if no attribute is given or if some keyword argument other than
            'sortby' is given.

        Examples
        --------
        The query in the following example searches for all non-starred entries
        with the tag 'foo' or 'bar' (or both).

        >>> database.query(~attrs.Starred(), attrs.Tag('foo') | attrs.Tag('bar'))

        """
        if not query:
            raise TypeError('at least one attribute required')
        sortby = kwargs.pop('sortby', 'observation_time_start')
        if kwargs:
            k, v = kwargs.popitem()
            raise TypeError('unexpected keyword argument {0!r}'.format(k))
        return sorted(
            walker.create(and_(*query), self.session),
            key=operator.attrgetter(sortby))
开发者ID:Rapternmn,项目名称:sunpy,代码行数:57,代码来源:database.py

示例7: test_walker_create_path_attr_exists

def test_walker_create_path_attr_exists(session):
    entries = walker.create(Path('/tmp'), session)
    assert len(entries) == 3
    assert tables.DatabaseEntry(
        id=3, path='/tmp', download_time=datetime(2005, 6, 15, 3)) in entries
    assert tables.DatabaseEntry(
        id=6, path='/tmp', starred=True,
        download_time=datetime(2005, 6, 15, 6)) in entries
    assert tables.DatabaseEntry(
        id=9, path='/tmp', download_time=datetime(2005, 6, 15, 9)) in entries
开发者ID:Alex-Ian-Hamilton,项目名称:sunpy,代码行数:10,代码来源:test_attrs.py

示例8: test_walker_create_anded_query

def test_walker_create_anded_query(session):
    entries = walker.create(Tag('foo') & Starred(), session)
    assert len(entries) == 1
    tag = tables.Tag('foo')
    tag.id = 1
    fits_header_entry = tables.FitsHeaderEntry('INSTRUME', 'EIT')
    fits_header_entry.id = 1
    assert tables.DatabaseEntry(
        id=10, starred=True, tags=[tag],
        download_time=datetime(2005, 6, 15, 10),
        fits_header_entries=[fits_header_entry]) in entries
开发者ID:Alex-Ian-Hamilton,项目名称:sunpy,代码行数:11,代码来源:test_attrs.py

示例9: test_walker_create_fitsheader

def test_walker_create_fitsheader(session):
    tag = tables.Tag('foo')
    tag.id = 1
    entries = walker.create(FitsHeaderEntry('INSTRUME', 'EIT'), session)
    fits_header_entry = tables.FitsHeaderEntry('INSTRUME', 'EIT')
    fits_header_entry.id = 1
    assert len(entries) == 1
    assert entries == [tables.DatabaseEntry(
        id=10, starred=True, tags=[tag],
        download_time=datetime(2005, 6, 15, 10),
        fits_header_entries=[fits_header_entry])]
开发者ID:Alex-Ian-Hamilton,项目名称:sunpy,代码行数:11,代码来源:test_attrs.py

示例10: test_walker_create_starred_false

def test_walker_create_starred_false(session):
    entries = walker.create(~Starred(), session)
    tag = tables.Tag("foo")
    tag.id = 1
    assert len(entries) == 5
    assert entries == [
        tables.DatabaseEntry(id=1, download_time=datetime(2005, 6, 15, 1)),
        tables.DatabaseEntry(id=3, path="/tmp", download_time=datetime(2005, 6, 15, 3)),
        tables.DatabaseEntry(id=5, tags=[tag], download_time=datetime(2005, 6, 15, 5)),
        tables.DatabaseEntry(id=7, download_time=datetime(2005, 6, 15, 7)),
        tables.DatabaseEntry(id=9, path="/tmp", download_time=datetime(2005, 6, 15, 9)),
    ]
开发者ID:ericmjonas,项目名称:sunpy,代码行数:12,代码来源:test_attrs.py

示例11: test_walker_create_tag_negative

def test_walker_create_tag_negative(session):
    entries = walker.create(~Tag("foo"), session)
    assert len(entries) == 8
    assert entries == [
        tables.DatabaseEntry(id=1, download_time=datetime(2005, 6, 15, 1)),
        tables.DatabaseEntry(id=2, starred=True, download_time=datetime(2005, 6, 15, 2)),
        tables.DatabaseEntry(id=3, path="/tmp", download_time=datetime(2005, 6, 15, 3)),
        tables.DatabaseEntry(id=4, starred=True, download_time=datetime(2005, 6, 15, 4)),
        tables.DatabaseEntry(id=6, path="/tmp", starred=True, download_time=datetime(2005, 6, 15, 6)),
        tables.DatabaseEntry(id=7, download_time=datetime(2005, 6, 15, 7)),
        tables.DatabaseEntry(id=8, starred=True, download_time=datetime(2005, 6, 15, 8)),
        tables.DatabaseEntry(id=9, path="/tmp", download_time=datetime(2005, 6, 15, 9)),
    ]
开发者ID:ericmjonas,项目名称:sunpy,代码行数:13,代码来源:test_attrs.py

示例12: test_walker_create_time

def test_walker_create_time(vso_session):
    time = vso.attrs.Time(
        datetime(2011, 9, 17, 0, 0, 0), datetime(2011, 9, 20, 0, 0, 0))
    entries = walker.create(time, vso_session)
    assert len(entries) == 1
    assert entries == [
        tables.DatabaseEntry(id=2, source=u'RHESSI', provider=u'LSSP',
            physobs=u'intensity',
            fileid=u'/hessidata/2011/09/19/hsi_20110919_233340',
            observation_time_start=datetime(2011, 9, 19, 23, 33, 40),
            observation_time_end=datetime(2011, 9, 20, 1, 9, 20),
            instrument=u'RHESSI', size=-1.0, wavemin=0.4132806430668068,
            wavemax=7.293187818826002e-05)]
开发者ID:Alex-Ian-Hamilton,项目名称:sunpy,代码行数:13,代码来源:test_attrs.py

示例13: test_walker_create_wave

def test_walker_create_wave(vso_session):
    entries = walker.create(vso.attrs.Wave(100, 180), vso_session)
    assert len(entries) == 2
    assert entries == [
        tables.DatabaseEntry(id=3, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:131:1086652833',
            observation_time_start=datetime(2011, 6, 8, 23, 59, 57),
            observation_time_end=datetime(2011, 6, 8, 23, 59, 58),
            instrument='AIA', size=66200.0, wavemin=13.1, wavemax=13.1),
        tables.DatabaseEntry(id=4, source='SDO', provider='JSOC',
            physobs='intensity', fileid='aia__lev1:171:1086652835',
            observation_time_start=datetime(2011, 6, 9, 0, 0),
            observation_time_end=datetime(2011, 6, 9, 0, 0, 1),
            instrument='AIA', size=66200.0, wavemin=17.1, wavemax=17.1)]
开发者ID:examon,项目名称:sunpy,代码行数:14,代码来源:test_attrs.py

示例14: test_walker_create_fitsheader_inverted

def test_walker_create_fitsheader_inverted(session):
    tag = tables.Tag("foo")
    tag.id = 1
    entries = walker.create(~FitsHeaderEntry("INSTRUME", "EIT"), session)
    assert len(entries) == 9
    assert entries == [
        tables.DatabaseEntry(id=1, download_time=datetime(2005, 6, 15, 1)),
        tables.DatabaseEntry(id=2, starred=True, download_time=datetime(2005, 6, 15, 2)),
        tables.DatabaseEntry(id=3, path="/tmp", download_time=datetime(2005, 6, 15, 3)),
        tables.DatabaseEntry(id=4, starred=True, download_time=datetime(2005, 6, 15, 4)),
        tables.DatabaseEntry(id=5, tags=[tag], download_time=datetime(2005, 6, 15, 5)),
        tables.DatabaseEntry(id=6, starred=True, path="/tmp", download_time=datetime(2005, 6, 15, 6)),
        tables.DatabaseEntry(id=7, download_time=datetime(2005, 6, 15, 7)),
        tables.DatabaseEntry(id=8, starred=True, download_time=datetime(2005, 6, 15, 8)),
        tables.DatabaseEntry(id=9, path="/tmp", download_time=datetime(2005, 6, 15, 9)),
    ]
开发者ID:ericmjonas,项目名称:sunpy,代码行数:16,代码来源:test_attrs.py

示例15: test_walker_create_tag_positive

def test_walker_create_tag_positive(session):
    entries = walker.create(Tag("foo"), session)
    tag = tables.Tag("foo")
    tag.id = 1
    fits_header_entry = tables.FitsHeaderEntry("INSTRUME", "EIT")
    fits_header_entry.id = 1
    assert len(entries) == 2
    assert entries == [
        tables.DatabaseEntry(id=5, tags=[tag], download_time=datetime(2005, 6, 15, 5)),
        tables.DatabaseEntry(
            id=10,
            starred=True,
            tags=[tag],
            download_time=datetime(2005, 6, 15, 10),
            fits_header_entries=[fits_header_entry],
        ),
    ]
开发者ID:ericmjonas,项目名称:sunpy,代码行数:17,代码来源:test_attrs.py


注:本文中的sunpy.database.attrs.walker.create函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。