From eb080758de911571e452caba804da8fd62b3d964 Mon Sep 17 00:00:00 2001 From: "Michael Hirsch, Ph.D" Date: Fri, 6 Sep 2019 11:38:27 -0400 Subject: [PATCH] allow pandas >= 0.25 by converting datetime64[ns] This undoes the pandas < 0.25 set in 6993bedb3. 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 --- georinex/base.py | 3 +++ setup.cfg | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/georinex/base.py b/georinex/base.py index 36d43cc..0d58109 100644 --- a/georinex/base.py +++ b/georinex/base.py @@ -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 diff --git a/setup.cfg b/setup.cfg index 5e9cc6d..d3058a5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = georinex -version = 1.12.2 +version = 1.13.0 author = Michael Hirsch, Ph.D. author_email = scivision@users.noreply.github.com description = Python RINEX 2/3 NAV/OBS reader with speed and simplicity. @@ -38,7 +38,6 @@ install_requires = python-dateutil numpy xarray>=0.11 - pandas < 0.25.0 [options.entry_points] console_scripts =