geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel_grammar module¶
A grammar to allow the user to define one or more time kernels. Because we use “,” as the main separator, groups must be enclosed in parans.
Example
>>> time_kernel = '-1y,-30d,-1d,0,1d,30d,1y'
>>> time_kernel = '(-1y,-30d,-1d,0,1d,30d,1y),(0),(-1,0,1)'
- class geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel_grammar.MultiTimeKernelTransformer(visit_tokens: bool = True)[source]¶
Bases:
Transformer
- geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel_grammar.parse_multi_time_kernel(time_kernel)[source]¶
Example
>>> from geowatch.tasks.fusion.datamodules.temporal_sampling.time_kernel_grammar import * # NOQA >>> time_kernel = '-3h,-1h,-1min,0,1min,1h,3h' >>> multi_kernel = parse_multi_time_kernel(time_kernel) >>> print('multi_kernel = {}'.format(ub.urepr(multi_kernel, nl=1))) multi_kernel = [ np.array([-10800., -3600., -60., 0., 60., 3600., 10800.], dtype=np.float64), ] >>> time_kernel = '(-1d,-3h,-1h,0,1h,3h,1d),(0),(-1,0,1)' >>> multi_kernel = parse_multi_time_kernel(time_kernel) >>> print('multi_kernel = {}'.format(ub.urepr(multi_kernel, nl=1))) multi_kernel = [ np.array([-86400., -10800., -3600., 0., 3600., 10800., 86400.], dtype=np.float64), np.array([0.], dtype=np.float64), np.array([-1., 0., 1.], dtype=np.float64), ]