I generated new data and save first as dataset (.to_dataset).
U_reg = U_reg.to_dataset(name = 'U')
V_reg = V_reg.to_dataset(name = 'V')
T_reg = T_reg.to_dataset(name = 'T')
Then I created attributes for each variable
U_reg.attrs['long_name'] = 'eastward_wind'
V_reg.attrs['long_name'] = 'northward_wind'
T_reg.attrs['long_name'] = 'Air Temperature'
Then merged the data as :
new_data= xr.merge([U_reg,V_reg,T_reg])
For finally save as a netCDF:
new_data.to_netCDF('new_data.netcdf')
Nevertheless when I open and look at each variable, the attributes are not available.
Is there other way to assign new attributes and have them I the new netCDF generated?
Thanks in advance.