This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import xarray as xr | |
| import numpy as np | |
| import dask | |
| import hdstats | |
| from odc.algo import randomize | |
| from odc.algo._dask import reshape_yxbt | |
| from odc.geo.xr import assign_crs | |
| def xr_geomad_dask(ds, **kw): | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import odc.algo | |
| #Extract boolean mask | |
| mask = odc.algo.enum_to_bool(ds.SCL, | |
| categories=['cloud shadows', 'cloud medium probability', | |
| 'cloud high probability', 'thin cirrus']) | |
| # Close mask to remove small holes in cloud, open mask to | |
| # remove narrow false positive cloud, then dilate | |
| mask = odc.algo.binary_closing(mask, 2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pylab import * | |
| import numpy as np | |
| n=17 | |
| cmap = cm.get_cmap('magma', n) | |
| for i,j in zip(range(cmap.N), np.arange(0,0.425,0.025)): | |
| rgba = cmap(i) | |
| # rgb2hex accepts rgb or rgba | |
| print("{'value': "+str(round(j,3))+", 'color': "+"'"+ matplotlib.colors.rgb2hex(rgba)+"'"+"},") |
OlderNewer