MAVENSDC / cdflib

A python module for reading NASA's Common Data Format (cdf) files
MIT License
82 stars 45 forks source link

cdf_to_xarray warning about datetime precision conversion #236

Closed berniegsfc closed 4 months ago

berniegsfc commented 9 months ago

I get many of these warnings:

/srv/conda/envs/notebook/lib/python3.10/site-packages/cdflib/xarray/cdf_to_xarray.py:619: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values. This warning is caused by passing non-nanosecond np.datetime64 or np.timedelta64 values to the DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.
  created_vars[var_name] = xr.Variable(var_dims, var_data, attrs=var_atts)  # type: ignore[no-untyped-call]

Is it possible to eliminated this?

bryan-harter commented 4 months ago

I believe the newest version of cdflib handles this, but feel free to reopen this issue if you find anything else!