本文整理汇总了Python中sunpy.util.scraper.Scraper._extractDateURL方法的典型用法代码示例。如果您正苦于以下问题:Python Scraper._extractDateURL方法的具体用法?Python Scraper._extractDateURL怎么用?Python Scraper._extractDateURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sunpy.util.scraper.Scraper
的用法示例。
在下文中一共展示了Scraper._extractDateURL方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testExtractDates_usingPattern
# 需要导入模块: from sunpy.util.scraper import Scraper [as 别名]
# 或者: from sunpy.util.scraper.Scraper import _extractDateURL [as 别名]
def testExtractDates_usingPattern():
# Standard pattern
s = Scraper('data/%Y/%m/%d/fits/swap/swap_00174_fd_%Y%m%d_%H%M%S.fts.gz')
testURL = 'data/2014/05/14/fits/swap/swap_00174_fd_20140514_200135.fts.gz'
timeURL = parse_time((2014, 5, 14, 20, 1, 35))
assert s._extractDateURL(testURL) == timeURL
# Not-full repeated pattern
s = Scraper('data/%Y/fits/swap/swap_00174_fd_%Y%m%d_%H%M%S.fts.gz')
testURL = 'data/2014/fits/swap/swap_00174_fd_20140514_200135.fts.gz'
timeURL = parse_time((2014, 5, 14, 20, 1, 35))
assert s._extractDateURL(testURL) == timeURL
示例2: testExtractDates_notSeparators_andSimilar
# 需要导入模块: from sunpy.util.scraper import Scraper [as 别名]
# 或者: from sunpy.util.scraper.Scraper import _extractDateURL [as 别名]
def testExtractDates_notSeparators_andSimilar():
s = Scraper('data/%Y/Jun%b%d_%H%M%S')
testURL = 'data/2014/JunJun14_200135'
timeURL = parse_time((2014, 6, 14, 20, 1, 35))
assert s._extractDateURL(testURL) == timeURL
testURL = 'data/2014/JunMay14_200135'
timeURL = parse_time((2014, 5, 14, 20, 1, 35))
assert s._extractDateURL(testURL) == timeURL
# and testing with the month afterwards
s = Scraper('data/%Y/%dJun%b_%H%M%S')
testURL = 'data/2014/14JunJun_200135'
timeURL = parse_time((2014, 6, 14, 20, 1, 35))
assert s._extractDateURL(testURL) == timeURL
示例3: _get_time_for_url
# 需要导入模块: from sunpy.util.scraper import Scraper [as 别名]
# 或者: from sunpy.util.scraper.Scraper import _extractDateURL [as 别名]
def _get_time_for_url(self, urls):
eve = Scraper(BASEURL)
times = list()
for url in urls:
t0 = eve._extractDateURL(url)
# hard coded full day as that's the normal.
times.append(TimeRange(t0, t0 + datetime.timedelta(days=1)))
return times
示例4: _get_time_for_url
# 需要导入模块: from sunpy.util.scraper import Scraper [as 别名]
# 或者: from sunpy.util.scraper.Scraper import _extractDateURL [as 别名]
def _get_time_for_url(self, urls):
freq = urls[0].split('/')[-1][0:3] # extract the frequency label
crawler = Scraper(BASEURL, freq=freq)
times = list()
for url in urls:
t0 = crawler._extractDateURL(url)
# hard coded full day as that's the normal.
times.append(TimeRange(t0, t0 + TimeDelta(1*u.day)))
return times
示例5: testExtractDates_notSeparators
# 需要导入模块: from sunpy.util.scraper import Scraper [as 别名]
# 或者: from sunpy.util.scraper.Scraper import _extractDateURL [as 别名]
def testExtractDates_notSeparators():
s = Scraper('data/%Y/%m/swap%m%d_%H%M%S')
testURL = 'data/2014/05/swap0514_200135'
timeURL = parse_time((2014, 5, 14, 20, 1, 35))
assert s._extractDateURL(testURL) == timeURL