Replace finite values with '1' in a 3 dimension xarray
You can use the xr.where function.
xr.where(data > 0, 1, data)
I am working on lake ice thickness in the northern hemisphere. My final data set is an xarray with dimensions [365,360,720] - (days,lat,lon) and a data varibale 'icethickness'. This data variable has 3 kinds of values. A finite value for ice thickness, zero for water and 'nan' for oceans.
I want to convert all the finite values of this xarray to 1 and keep the zeros and nan as they are.