Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local timezone can break regrid operation #2459

Closed
jlstevens opened this Issue Mar 19, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@jlstevens
Copy link
Contributor

jlstevens commented Mar 19, 2018

The following example works when the local timezone is GMT, but breaks if the local timezone is a different timezone (say US central time).

import pandas as pd
import holoviews as hv
from dateutil import parser
import datetime
import xarray as xr
import numpy as np
from holoviews.operation.datashader import regrid
hv.extension('bokeh')


time = [
 datetime.datetime(2018, 1, 9, 13, 35, 30),
 datetime.datetime(2018, 1, 9, 13, 36, 40),
 datetime.datetime(2018, 1, 9, 13, 37, 50),
 datetime.datetime(2018, 1, 9, 13, 39),
 datetime.datetime(2018, 1, 9, 13, 40, 10),
 datetime.datetime(2018, 1, 9, 13, 41, 20),
 datetime.datetime(2018, 1, 9, 13, 42, 30),
 datetime.datetime(2018, 1, 9, 13, 43, 40),
 datetime.datetime(2018, 1, 9, 13, 44, 50),
 datetime.datetime(2018, 1, 9, 13, 46),
 datetime.datetime(2018, 1, 9, 13, 47, 10),
 datetime.datetime(2018, 1, 9, 13, 48, 20),
 datetime.datetime(2018, 1, 9, 13, 49, 30),
 datetime.datetime(2018, 1, 9, 13, 50, 40),
 datetime.datetime(2018, 1, 9, 13, 51, 50)]

dim2 = np.arange(0,1000)    
values, _ = np.mgrid[0:1000, 0:15]
xarr = xr.DataArray(values,
                       coords={'time': time, 'dim2': dim2},
                       dims=['dim2', 'time'])

image = hv.Image(xarr,  ['time', 'dim2'], ['val'])
regrid(image,  aggregator='mean')

@philippjfr To reproduce, switch the timezone from GMT to central time and any zooming will cause the data to disappear (and other weird artifacts have been observed as well e.g partial data display)

@jbednar

This comment has been minimized.

Copy link
Contributor

jbednar commented Mar 19, 2018

I haven't tried debugging this version, but in a related case the data was disappearing because datashader was being given a negative plot_width or plot_height, perhaps because data with and without timezone information was being subtracted. I believe the code above works fine without regrid, so it's probably an issue in how datetimes are being handled in the hv datashader interface (given that datashader itself does not support datetimes).

@jlstevens

This comment has been minimized.

Copy link
Contributor Author

jlstevens commented Mar 19, 2018

Another weird error is that if you change the datetimes above from the first month to say the second month (so the first datetime is say datetime.datetime(2018, 2, 9, 13, 35, 30),) then you get an rtol exception error. I noticed this trying to change the month to other values too!

@jlstevens

This comment has been minimized.

Copy link
Contributor Author

jlstevens commented Mar 19, 2018

I believe the code above works fine without regrid

That is correct.

@philippjfr philippjfr added this to the v1.10 milestone Mar 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.