Cache¶
- class gwdatafind.io.Cache(items)¶
Bases:
listFormatted list of URIs.
- Parameters:
- Returns:
cache (
Cache) – A newCachewhere each element is aLalCacheEntryrepresenting a data source URI.
Attributes Summary
The list of URI base names (file name component only).
The list of URI names (full path without URI scheme or host).
The
igwn_segments.segmentlistof data covered by this cache.The list of URIs in this
Cache.Methods Summary
Attributes Documentation
- basenames¶
The list of URI base names (file name component only).
- names¶
The list of URI names (full path without URI scheme or host).
- segments¶
The
igwn_segments.segmentlistof data covered by this cache.
Methods Documentation
- write(output, format='lal')¶
Write this
Cachein the givenformat.- Parameters:
output (
str,pathlib.Path,file) – The target filename or path, or an open IO stream to write to.format (
str, optional) –The desired format of the cache file. Choose one of
"lal"The LIGO Algorithm Library format, with one line per file in the format:
<obs> <tag> <GPS-start> <duration> <url>
"omega"The Omega pipeline format, with one line per contiguous directory in the format
<obs> <tag> <dir-start> <dir-end> <file-duration> <directory>
"urls"A list of URLS, one per line.
"names"A list of paths (without a URL scheme), one per line.
"basenames"A list of file basenames (without any paths), one per line.
Examples
>>> urls = find_urls( ... "L", ... "L1_GWOSC_O2_4KHZ_R1", ... 1187008880, ... 1187008884, ... host="datafind.gwosc.org", ... urltype="osdf", ... ) >>> cache = Cache(urls) >>> cache.write(sys.stdout) L L1_GWOSC_O2_4KHZ_R1 1187008512 4096 osdf:///gwdata/O2/strain.4k/frame.v1/L1/1186988032/L-L1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf >>> cache.write(sys.stdout, format="basenames") L-L1_GWOSC_O2_4KHZ_R1-1187008512-4096.gwf