Open emanuel-schmid opened 1 year ago
Yes, it's a known issue in xarray (see https://github.com/pydata/xarray/pull/7098, and https://github.com/pydata/xarray/pull/7827). The warnings can be ignored. I use the following to deal with it:
import warnings
warnings.filterwarnings(
"ignore",
message="invalid value encountered in cast",
module="xarray",
category=RuntimeWarning,
)
Thanks a lot! 🙌 I'll do the same here.
I've made an attempt and suppressed the warnings in the parent classes' hdf5 methods. see https://github.com/CLIMADA-project/climada_python/pull/742 Not sure whether it's the perfect place. Perhaps we should suppress it once for all? but perhaps not? and if - how?
I get the same warning when loading any other NetCDF file, it's not only related to the new implementation of TCTracks.from_hdf5
. For example, when loading the IBTrACS NetCDF data:
>>> from climada.hazard import TCTracks
>>> TCTracks.from_ibtracs_netcdf(year_range=(2015, 2015))
$CONDA_PREFIX/lib/python3.9/site-packages/xarray/coding/times.py:254: RuntimeWarning: invalid value encountered in cast
flat_num_dates_ns_int = (flat_num_dates * _NS_PER_TIME_DELTA[delta]).astype(
$CONDA_PREFIX/lib/python3.9/site-packages/xarray/coding/times.py:254: RuntimeWarning: invalid value encountered in cast
flat_num_dates_ns_int = (flat_num_dates * _NS_PER_TIME_DELTA[delta]).astype(
So, I would consider suppressing the warnings at a central place during CLIMADA setup and maybe mention https://github.com/pydata/xarray/pull/7098 in the code so that future developers know where this comes from, and have an easy benchmark when to remove it.
climada_python PR #735 started a flood of Runtime Warnings in
tc_track_forecast.TCForecast.from_hdf5
.To reproduce, run:
The warnings are raised in
climada.hazard.tc_tracks.TCTracks.from_hdf5
:I have not really a clue whether we can safely ignore it or whether this points to a serious problem. 🤷