Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@romanc
Copy link
Collaborator

@romanc romanc commented May 28, 2025

Description

NDSL tests were logging the following deprecation warning for using use_cftime=True when opening a dataset (e.g. model state)

 tests/test_legacy_restart.py::test_read_state_non_scalar_time
  /__w/NDSL/NDSL/ndsl/io.py:72: DeprecationWarning: Usage of 'use_cftime' as a kwarg is deprecated. Please pass a 'CFDatetimeCoder' instance initialized with 'use_cftime' to the 'decode_times' kwarg instead.
  Example usage:
      time_coder = xr.coders.CFDatetimeCoder(use_cftime=True)
      ds = xr.open_dataset(decode_times=time_coder)
  
    ds = xr.open_dataset(f, use_cftime=True)

(as see in e.g. this run)

How Has This Been Tested?

By running tests and confirming that the warning isn't in the logs anymore.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas: N/A
  • I have made corresponding changes to the documentation: N/A
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules: N/A
  • New check tests, if applicable, are included: N/A

@romanc romanc changed the title Fix deprecation warning about use_cftime Fix deprecation warning when reading model state May 28, 2025
@romanc romanc marked this pull request as ready for review May 28, 2025 08:29
@FlorianDeconinck FlorianDeconinck merged commit dd320b6 into NOAA-GFDL:develop May 28, 2025
5 checks passed
@romanc romanc deleted the romanc/fix-deprecation-warning branch May 28, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants