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 statsmodels.api as sm | |
from patsy import dmatrices | |
import numpy as np | |
y, X = dmatrices("time_s ~ cloud + model + sensor", data=df) | |
# Note that offset is in 100s of square miles | |
offset = np.asarray(df["sq_mi"]) / 100 | |
m = sm.Poisson(y, X, offset=offset) |
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
palette = iter(sns.color_palette("tab10")) | |
# Plot points | |
g = sns.scatterplot(x=x, y=y, color=next(palette)) | |
g.grid(False) | |
# Plot regression line | |
m, b = np.polyfit(x, y, 1) | |
linecolor = next(palette) | |
xr = range(x.min(), x.max(), 1) |
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 rasterio as rio | |
ds = rio.open(img_file) | |
for lon, lat in points: | |
y, x = ds.index(lon, lat) | |
print(x, y) |
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
#!/bin/bash | |
for i in $(seq $(getconf _NPROCESSORS_ONLN)); do yes > /dev/null & done | |
echo "To stop, run:" | |
echo "killall yes" | |
echo | |
sleep 60 | |
killall yes |
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
#!/usr/bin/env bash | |
# Check we've got command line arguments | |
if [ -z "$*" ] ; then | |
echo "Need to specify ssh options" | |
exit 1 | |
fi | |
# Start trying and retrying | |
((count = 100)) |
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
""" | |
_jaccard.py : Jaccard metric for comparing set similarity. | |
""" | |
import numpy as np | |
def jaccard(im1, im2): | |
""" |
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
sudo yum install gcc make zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel tk-devel libffi-devel xz-devel | |
sudo yum remove openssl-devel.x86_64 | |
sudo yum autoremove | |
sudo yum install openssl11-devel |
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 base64 | |
import io | |
import json | |
import urllib.request | |
import zipfile | |
from pathlib import Path | |
from urllib.parse import urlparse | |
OlderNewer