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

support dataframes with localized timezones #272

Open
otzi5300 opened this issue Nov 9, 2023 · 6 comments
Open

support dataframes with localized timezones #272

otzi5300 opened this issue Nov 9, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@otzi5300
Copy link

otzi5300 commented Nov 9, 2023

Seems like it is not possible to create a comparer with dataframes with localized timezone.

Exception has occurred: TypeError
'.dt' accessor only available for DataArray with datetime64 timedelta64 dtype or for arrays containing cftime datetime objects.

@jsmariegaard
Copy link
Member

Uh, I guess we don't have any tests with that. I've never used localized time zones - for all the (marine) projects that I have done everything is UTC so we never worry about that. But we should make it work for sure - I easily see the relevance in the urban domain and other places.

@otzi5300 , could you start a PR on this? Maybe just adding a some small testdata and a failing test? Then we can take it from there...

@otzi5300
Copy link
Author

otzi5300 commented Nov 9, 2023

on it...

@otzi5300
Copy link
Author

otzi5300 commented Nov 9, 2023

meanwhile, a work around is simply removing the timezones from the dataframes:
df_mod.index = df_mod.index.tz_localize(None)
df_obs.index = df_obs.index.tz_localize(None)

@ecomodeller
Copy link
Member

Can you explain the relevance of supporting timezones, isn't it enough to to use naive datetime (without tz info) and assume that all data is in the same timezone, similar to how we ignore coordinate reference system?

@otzi5300
Copy link
Author

Only supporting native datetime is ok but then I think the error msg should be made clearer. However, I think it is relatively common that sensor data are in a specific tz and I think we at least could support localized data in the same timezone.

@jsmariegaard
Copy link
Member

🤔 both of your viewpoints seems fair. I guess it depends on the work needed to realize this. @ecomodeller is right, that we (for now) do not wish to support CRS (e.g. to allow some data in UTM-32 and other long-lat), but as @otzi5300 is pointing out, if it is commonly used, I think we should support tz-aware DatetimeIndex. At least if is not too much work

@jsmariegaard jsmariegaard added the enhancement New feature or request label Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants