When we installed netCDF4, we got old version of cftime.
Creating this environment:
conda create -n junk python=3.9 netCDF4
# Name Version Build Channel
netcdf4 1.5.7 py39h3de5c98_1
# Name Version Build Channel
cftime 1.5.1.1 py39h080aedc_0
But cftime 1.6.2 exists,
If we do ‘conda update cftime’, it won’t update it.
But, ‘conda install cftime=1.6.2’ will upgrade cftime,
The following packages will be UPDATED:
cftime pkgs/main::cftime-1.5.1.1-py39h080aed~ --> conda-forge::cftime-1.6.2-py39hc266a54_1
vs2015_runtime pkgs/main::vs2015_runtime-14.27.29016~ --> conda-forge::vs2015_runtime-14.32.31332-h1d6e394_9
, and netcdf4 and cftime all work together with the new version.
Note the combination of netcdf4 and cftime is broken.
The following line of code doesn’t work:
time_2 = cftime.num2date(7020., 'minutes since 1999-11-25 00:00:00')
print('time_2XXXXX: ', time_2)
the error message is shown below:
Traceback (most recent call last):
File "C:\Users\leo.geng\learning_notes\PyGNOME_error_test\test.py", line 12, in <module>
time_2 = cftime.num2date(7020., 'minutes since 1999-11-25 00:00:00')
File "src\cftime\_cftime.pyx", line 535, in cftime._cftime.num2date
File "src\cftime\_cftime.pyx", line 379, in cftime._cftime.cast_to_int
TypeError: '<' not supported between instances of 'numpy.longdouble' and 'int'
This code will work if we update cftime to 1.6.2 version.