Skip to content

Commit

Permalink
allow pandas >= 0.25 by converting datetime64[ns]
Browse files Browse the repository at this point in the history
This undoes the pandas < 0.25 set in 6993bed.
The issue was that xarray.*.to_netcdf() needs datetime64[ns] but Pandas >= 0.25
started using dtype('O'). This changes converts to datetime64[ns] when using .to_netcdf()

vers
  • Loading branch information
scivision committed Sep 6, 2019
1 parent 2a7a614 commit eb08075
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions georinex/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ def rinexobs(fn: Union[TextIO, str, Path],
wmode = _groupexists(outfn, group)

enc = {k: ENC for k in obs.data_vars}
# Pandas >= 0.25.0 requires this, regardless of xarray version
if obs.time.dtype != 'datetime64[ns]':
obs["time"] = obs.time.astype("datetime64[ns]")
obs.to_netcdf(outfn, group=group, mode=wmode, encoding=enc)

return obs
Expand Down
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = georinex
version = 1.12.2
version = 1.13.0
author = Michael Hirsch, Ph.D.
author_email = [email protected]
description = Python RINEX 2/3 NAV/OBS reader with speed and simplicity.
Expand Down Expand Up @@ -38,7 +38,6 @@ install_requires =
python-dateutil
numpy
xarray>=0.11
pandas < 0.25.0

[options.entry_points]
console_scripts =
Expand Down

0 comments on commit eb08075

Please sign in to comment.