Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_micaps_4读取ec数据出错 #16

Open
liushengsheng1990 opened this issue Sep 13, 2021 · 4 comments
Open

read_micaps_4读取ec数据出错 #16

liushengsheng1990 opened this issue Sep 13, 2021 · 4 comments

Comments

@liushengsheng1990
Copy link

File "D:\lss_code\micaps\1.py", line 39, in
f = read_micaps_4(r'D:/lss_code/micaps/data27-19.2.28/ECMWF_HR/CAPE/19022708.000')

File "D:\Anaconda3\lib\site-packages\nmc_met_io\read_micaps.py", line 398, in read_micaps_4
data = (np.array(txt[22:])).astype(np.float)

ValueError: could not convert string to float: '1,124.25'

ec文件中有超过1000的值,其格式为*,*.,read_micaps_4无法正常读取

@flashlxy
Copy link

在 nmcdev/nmc_met_io/blob/master/nmc_met_io/read_micaps.py 文件中
第350行修改为 txt = f.read().replace(',','').replace('\n', ' ').split()

@liushengsheng1990
Copy link
Author

方法有用,谢谢你的回答。另外请教一下nmc_met_io库是否有micaps各类格式写入的功能,或者别的什么库具有该功能

@flashlxy
Copy link

方法有用,谢谢你的回答。另外请教一下nmc_met_io库是否有micaps各类格式写入的功能,或者别的什么库具有该功能

这个库里没有写操作,不过通过重新向新文件里按各自的格式写入这些读取函数的返回值即可实现写入功能。

@NMC-DAVE
Copy link
Member

NMC-DAVE commented Dec 9, 2021

谢谢flashlxy,已经更新程序,可以处理 '1,124.25' 类型的数据.

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

No branches or pull requests

3 participants