YvZheng / pycwr

The China Weather Radar Toolkit, support most of China's radar formats(WSR98D, CINRAD/SA/SB/CB, CINRAD/CC/CCJ, CINRAD/SC/CD)
MIT License
213 stars 80 forks source link

cfradial.py: _FillValue attribute must be set when variable is created #13

Closed abanger closed 4 years ago

abanger commented 4 years ago

pycwr==0.2.11

pyart.io.write_cfradial("t.nc", radar)

File "C:\Anaconda3\envs\radar\lib\site-packages\pyart\io\cfradial.py", line 543, in write_cfradial _create_ncvar(dic, dataset, field, ('time', 'range')) File "C:\Anaconda3\envs\radar\lib\site-packages\pyart\io\cfradial.py", line 777, in _create_ncvar ncvar.setncattr('_FillValue', fv) File "netCDF4_netCDF4.pyx", line 4123, in netCDF4._netCDF4.Variable.setncattr AttributeError: _FillValue attribute must be set when variable is created (using fill_value keyword to createVariable)

注释773之后几行正常 """

remove _FillValue and replace to make it the third attribute.

if '_FillValue' in ncvar.ncattrs():
    fv = ncvar._FillValue
    ncvar.delncattr('_FillValue')
    ncvar.setncattr('_FillValue', fv)
"""
abanger commented 4 years ago

pycwr-0.2.13 正常。

alment-Li commented 1 year ago

image pycwr已经是0.3.6版本了,还是有报错?请问怎么解决