speasy.core.direct_archive_downloader.direct_archive_downloader module
- class speasy.core.direct_archive_downloader.direct_archive_downloader.RandomSplitDirectDownload[source]
Bases:
object
- static get_product(url_pattern: str, variable: str, start_time: str | ~datetime.datetime | ~numpy.float64 | float | ~numpy.datetime64, stop_time: str | ~datetime.datetime | ~numpy.float64 | float | ~numpy.datetime64, fname_regex: str, split_frequency: str = 'daily', date_format=None, file_reader: ~typing.Callable[[...], ~speasy.products.variable.SpeasyVariable | None] = <function _read_cdf>, **kwargs) SpeasyVariable | None [source]
- class speasy.core.direct_archive_downloader.direct_archive_downloader.RegularSplitDirectDownload[source]
Bases:
object
- static get_product(url_pattern: str, variable: str, start_time: str | ~datetime.datetime | ~numpy.float64 | float | ~numpy.datetime64, stop_time: str | ~datetime.datetime | ~numpy.float64 | float | ~numpy.datetime64, use_file_list: bool = False, split_frequency: str = 'daily', file_reader: ~typing.Callable[[...], ~speasy.products.variable.SpeasyVariable | None] = <function _read_cdf>, **kwargs) SpeasyVariable | None [source]
- speasy.core.direct_archive_downloader.direct_archive_downloader.apply_date_format(txt: str, date: datetime) str [source]
- speasy.core.direct_archive_downloader.direct_archive_downloader.get_product(url_pattern: str, split_rule: str, variable: str, start_time: str | ~datetime.datetime | ~numpy.float64 | float | ~numpy.datetime64, stop_time: str | ~datetime.datetime | ~numpy.float64 | float | ~numpy.datetime64, use_file_list: bool = False, file_reader: ~typing.Callable[[...], ~speasy.products.variable.SpeasyVariable | None] = <function _read_cdf>, codec: str | None = None, **kwargs) SpeasyVariable | None [source]
- speasy.core.direct_archive_downloader.direct_archive_downloader.spilt_range(split_frequency: str, start_time: str | datetime | float64 | float | datetime64, stop_time: str | datetime | float64 | float | datetime64)[source]
Given a split frequency (daily, yearly) and a time range, generate the list of start time of each fragment given a split frequency (daily, yearly) and a time range to split.
- Parameters:
- split_frequencystr
Fragments spilt frequency (daily, monthly, yearly)
- start_timeAnyDateTimeType
Time range start
- stop_timeAnyDateTimeType
Time range stop
- Returns:
- List[datetime]
Ordered list of start time of each fragment composing the given input range
Examples
>>> spilt_range('daily', "2018-01-02", "2018-01-03") [datetime.datetime(2018, 1, 2, 0, 0, tzinfo=datetime.timezone.utc), datetime.datetime(2018, 1, 3, 0, 0, tzinfo=datetime.timezone.utc)]