Skip to content

Instantly share code, notes, and snippets.

View aligilbert's full-sized avatar

Ali Gilbert aligilbert

View GitHub Profile
seas_mask = (elevation < sea_level).astype(int)
sea_labels = skimage.measure.label(seas_mask, connectivity=1) # try plotting this with matplotlib, useful
sea_nos, sea_sizes = np.unique(sea_labels, return_counts=True)
sea_nos, sea_sizes = sea_nos[1:], sea_sizes[1:] # remove land, which has label 0
seas = zip(sea_sizes, sea_nos)[::-1] # sort, largest size first
for sea_size, sea_no in seas:
print("Sea with label", sea_no, "has size", sea_size)
# do something to each sea, modify map, etc.
@aligilbert
aligilbert / gist:5a111b6df482b72c1cfd3c3e1efd6cff
Created July 3, 2024 06:23
Insert Figure: Unofficial Poster Template for University of Oxford
\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[
scale only axis,
no markers,
domain=0:2*pi,
samples=100,
axis lines=center,
axis line style={-},
@aligilbert
aligilbert / unit-3-networking-phases-of-criminal-networks.ipynb
Created July 3, 2024 02:49
Unit 3 networking phases of Criminal Networks.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aligilbert
aligilbert / gene-dimension-reduction-3-brain-cells.ipynb
Last active July 8, 2024 08:30
gene-dimension-reduction-3-brain-cells.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.