Skip to content

Instantly share code, notes, and snippets.

@willrayeo
willrayeo / new_variable.py
Last active May 3, 2021 14:32
creating new variable
#convert VV DN to Decibels
vv_dn = s1_cube.VV
vv_db = 10 * (xr.ufuncs.log10(vv_dn))
vv_db = vv_db.where(xr.ufuncs.isfinite(vv_db), 0)
# attribute long name and units to new variable
vv_db.attrs['long_name']='VV_dB'
vv_db.attrs['units']='decibels'