Skip to content

suppress datetime conversion warning

Jenkins - WCR / Tests / Declarative: Post Actions failed Sep 27, 2024 in 0s

failed: 5, passed: 198

Send us feedback

Details

climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF.test_ecmwf_multimessage

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.
Stack trace
self = <climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF testMethod=test_ecmwf_multimessage>

    def test_ecmwf_multimessage(self):
        """Test ECMWF reader in multimessage format"""
        forecast = TCForecast()
>       forecast.fetch_ecmwf(files=TEST_BUFR_FILE_MULTIMESSAGE)

climada_petals/hazard/test/test_tc_tracks_forecast.py:91: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada_petals/hazard/tc_tracks_forecast.py:165: in fetch_ecmwf
    self.read_one_bufr_tc(file, id_no=i)
climada_petals/hazard/tc_tracks_forecast.py:415: in read_one_bufr_tc
    track = self._subset_to_track(
climada_petals/hazard/tc_tracks_forecast.py:517: in _subset_to_track
    track = xr.Dataset(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:713: in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:423: in merge_data_and_coords
    coords = create_coords_with_default_indexes(coords, data_vars)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/coordinates.py:1001: in create_coords_with_default_indexes
    variable = as_variable(obj, name=name, auto_convert=False)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:155: in as_variable
    data: T_DuckArray = as_compatible_data(obj)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:321: in as_compatible_data
    data = _possibly_convert_objects(data)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:235: in _possibly_convert_objects
    as_series = _as_nanosecond_precision(as_series)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:208: in _as_nanosecond_precision
    utils.emit_user_level_warning(NON_NANOSECOND_WARNING.format(case="datetime"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

message = 'Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed ... DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.'
category = None

    def emit_user_level_warning(message, category=None) -> None:
        """Emit a warning at the user level by inspecting the stack trace."""
        stacklevel = find_stack_level()
>       return warnings.warn(message, category=category, stacklevel=stacklevel)
E       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.

../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/utils.py:1105: UserWarning

climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF.test_ecmwf_multimessage_missing_timeperiod

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.
Stack trace
self = <climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF testMethod=test_ecmwf_multimessage_missing_timeperiod>

    def test_ecmwf_multimessage_missing_timeperiod(self):
        """Test ECMWF reader should continue reading messages if one track misses timePeriod"""
        with self.assertLogs('climada_petals.hazard.tc_tracks_forecast', level='INFO') as cm:
            forecast = TCForecast()
>           forecast.fetch_ecmwf(files=TEST_BUFR_FILE_MULTIMESSAGE_MISSING_TIMEPERIOD)

climada_petals/hazard/test/test_tc_tracks_forecast.py:111: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada_petals/hazard/tc_tracks_forecast.py:165: in fetch_ecmwf
    self.read_one_bufr_tc(file, id_no=i)
climada_petals/hazard/tc_tracks_forecast.py:415: in read_one_bufr_tc
    track = self._subset_to_track(
climada_petals/hazard/tc_tracks_forecast.py:517: in _subset_to_track
    track = xr.Dataset(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:713: in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:423: in merge_data_and_coords
    coords = create_coords_with_default_indexes(coords, data_vars)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/coordinates.py:1001: in create_coords_with_default_indexes
    variable = as_variable(obj, name=name, auto_convert=False)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:155: in as_variable
    data: T_DuckArray = as_compatible_data(obj)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:321: in as_compatible_data
    data = _possibly_convert_objects(data)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:235: in _possibly_convert_objects
    as_series = _as_nanosecond_precision(as_series)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:208: in _as_nanosecond_precision
    utils.emit_user_level_warning(NON_NANOSECOND_WARNING.format(case="datetime"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

message = 'Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed ... DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.'
category = None

    def emit_user_level_warning(message, category=None) -> None:
        """Emit a warning at the user level by inspecting the stack trace."""
        stacklevel = find_stack_level()
>       return warnings.warn(message, category=category, stacklevel=stacklevel)
E       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.

../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/utils.py:1105: UserWarning

climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF.test_equal_timestep

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.
Stack trace
self = <climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF testMethod=test_equal_timestep>

    def test_equal_timestep(self):
        """Test equal timestep"""
        forecast = TCForecast()
>       forecast.fetch_ecmwf(files=TEST_BUFR_FILES)

climada_petals/hazard/test/test_tc_tracks_forecast.py:127: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada_petals/hazard/tc_tracks_forecast.py:165: in fetch_ecmwf
    self.read_one_bufr_tc(file, id_no=i)
climada_petals/hazard/tc_tracks_forecast.py:415: in read_one_bufr_tc
    track = self._subset_to_track(
climada_petals/hazard/tc_tracks_forecast.py:517: in _subset_to_track
    track = xr.Dataset(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:713: in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:423: in merge_data_and_coords
    coords = create_coords_with_default_indexes(coords, data_vars)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/coordinates.py:1001: in create_coords_with_default_indexes
    variable = as_variable(obj, name=name, auto_convert=False)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:155: in as_variable
    data: T_DuckArray = as_compatible_data(obj)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:321: in as_compatible_data
    data = _possibly_convert_objects(data)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:235: in _possibly_convert_objects
    as_series = _as_nanosecond_precision(as_series)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:208: in _as_nanosecond_precision
    utils.emit_user_level_warning(NON_NANOSECOND_WARNING.format(case="datetime"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

message = 'Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed ... DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.'
category = None

    def emit_user_level_warning(message, category=None) -> None:
        """Emit a warning at the user level by inspecting the stack trace."""
        stacklevel = find_stack_level()
>       return warnings.warn(message, category=category, stacklevel=stacklevel)
E       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.

../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/utils.py:1105: UserWarning

climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF.test_fetch_ecmwf

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.
Stack trace
self = <climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF testMethod=test_fetch_ecmwf>

    def test_fetch_ecmwf(self):
        """Test ECMWF reader with static files"""
        forecast = TCForecast()
>       forecast.fetch_ecmwf(files=TEST_BUFR_FILES)

climada_petals/hazard/test/test_tc_tracks_forecast.py:62: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada_petals/hazard/tc_tracks_forecast.py:165: in fetch_ecmwf
    self.read_one_bufr_tc(file, id_no=i)
climada_petals/hazard/tc_tracks_forecast.py:415: in read_one_bufr_tc
    track = self._subset_to_track(
climada_petals/hazard/tc_tracks_forecast.py:517: in _subset_to_track
    track = xr.Dataset(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:713: in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:423: in merge_data_and_coords
    coords = create_coords_with_default_indexes(coords, data_vars)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/coordinates.py:1001: in create_coords_with_default_indexes
    variable = as_variable(obj, name=name, auto_convert=False)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:155: in as_variable
    data: T_DuckArray = as_compatible_data(obj)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:321: in as_compatible_data
    data = _possibly_convert_objects(data)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:235: in _possibly_convert_objects
    as_series = _as_nanosecond_precision(as_series)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:208: in _as_nanosecond_precision
    utils.emit_user_level_warning(NON_NANOSECOND_WARNING.format(case="datetime"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

message = 'Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed ... DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.'
category = None

    def emit_user_level_warning(message, category=None) -> None:
        """Emit a warning at the user level by inspecting the stack trace."""
        stacklevel = find_stack_level()
>       return warnings.warn(message, category=category, stacklevel=stacklevel)
E       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.

../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/utils.py:1105: UserWarning

climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF.test_hdf5_io

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.
Stack trace
self = <climada_petals.hazard.test.test_tc_tracks_forecast.TestECMWF testMethod=test_hdf5_io>

    def test_hdf5_io(self):
        """Test writing and reading hdf5 TCTracks instances"""
        tc_track = TCForecast()
>       tc_track.fetch_ecmwf(files=TEST_BUFR_FILES)

climada_petals/hazard/test/test_tc_tracks_forecast.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
climada_petals/hazard/tc_tracks_forecast.py:165: in fetch_ecmwf
    self.read_one_bufr_tc(file, id_no=i)
climada_petals/hazard/tc_tracks_forecast.py:415: in read_one_bufr_tc
    track = self._subset_to_track(
climada_petals/hazard/tc_tracks_forecast.py:517: in _subset_to_track
    track = xr.Dataset(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:713: in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/dataset.py:423: in merge_data_and_coords
    coords = create_coords_with_default_indexes(coords, data_vars)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/coordinates.py:1001: in create_coords_with_default_indexes
    variable = as_variable(obj, name=name, auto_convert=False)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:155: in as_variable
    data: T_DuckArray = as_compatible_data(obj)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:321: in as_compatible_data
    data = _possibly_convert_objects(data)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:235: in _possibly_convert_objects
    as_series = _as_nanosecond_precision(as_series)
../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/variable.py:208: in _as_nanosecond_precision
    utils.emit_user_level_warning(NON_NANOSECOND_WARNING.format(case="datetime"))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

message = 'Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed ... DataArray or Variable constructor; it can be silenced by converting the values to nanosecond precision ahead of time.'
category = None

    def emit_user_level_warning(message, category=None) -> None:
        """Emit a warning at the user level by inspecting the stack trace."""
        stacklevel = find_stack_level()
>       return warnings.warn(message, category=category, stacklevel=stacklevel)
E       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.

../../../../../miniforge3/envs/petals_env/lib/python3.9/site-packages/xarray/core/utils.py:1105: UserWarning