I want to open a sounding data generated by myself
I successfully ran the metpy code
df = pd.read_fwf(get_test_data('nov11_sounding.txt', as_file_obj=False), skiprows=5, usecols=[0, 1, 2, 3, 6, 7], names=col_names)
df['u_wind'], df['v_wind'] = mpcalc.wind_components(df['speed'], np.deg2rad(df['direction']))
Now I want to open my file
F = open("ElAlto03012019.dat","r")
F['u_wind'], F['v_wind'] = mpcalc.wind_components(F['speed'], np.deg2rad(F['direction']))
I expect the program to accept the file, however what I get is:
Traceback (most recent call last):
File "", line 1, in
TypeError: 'file' object has no attribute 'getitem'