ARM-DOE / pyart

The Python-ARM Radar Toolkit. A data model driven interactive toolkit for working with weather radar data.
https://arm-doe.github.io/pyart/
Other
513 stars 266 forks source link

Error getting datetime from NEXRAD level2 radar object with latest release #1189

Closed lauratomkins closed 2 years ago

lauratomkins commented 2 years ago

I created a new environment today and had issues with some code I have previously written due to some datetime problems. The new environment I created was using python=3.8 and arm_pyart=1.12.5 installed via conda-forge. I'm not sure if it's related to this fix #1185

Here is example code that produces the error

import pyart

file = 's3://noaa-nexrad-level2/2019/12/01/KDIX/KDIX20191201_170259_V06'
radar = pyart.io.read_nexrad_archive(file)

radar_date = pyart.util.datetime_from_radar(radar)

And this is the error that it produces

>>> radar_date = pyart.util.datetime_from_radar(radar)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\cftime_error\lib\site-packages\pyart\util\datetime_utils.py", line 21, in datetime_from_radar
    return num2date(radar.time['data'][0], radar.time['units'],
  File "src\cftime\_cftime.pyx", line 584, in cftime._cftime.num2date
  File "src\cftime\_cftime.pyx", line 382, in cftime._cftime.cast_to_int
TypeError: '<' not supported between instances of 'numpy.longdouble' and 'int'

I was able to replicate on another machine, can you replicate on your end? Seems like pyart version 1.12.4 doesn't have the same issue

zssherman commented 2 years ago

Hi @lauratomkins currently there is a bug in cftime, they are working on a release today. Can you trying installing cftime 1.5.1 in the meantime?

lauratomkins commented 2 years ago

Ah okay, thanks for the response