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
# environment_rioxarray.sh | |
conda create -n rioxarray --yes | |
conda activate rioxarray | |
conda install -c conda-forge geopandas --yes | |
conda install -c conda-forge rioxarray rasterio --yes | |
conda install -c conda-forge matplotlib tqdm jupyterlab ipython pip ruamel.yaml xarray descartes black mypy --yes | |
conda install -c anaconda spyder | |
# test it has worked | |
ipython -c "import geopandas; import rioxarray; import xarray" |
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 matplotlib.pyplot as plt | |
import seaborn as sns | |
preds = xr.open_dataset("test_predictions_E030.nc") | |
preds = preds.drop(["horizon", "easting", "northing"]) | |
f, ax = plt.subplots(figsize=(12, 4)) | |
preds.isel(pixel=0).sel(time="2007").obs.plot(ax=ax, color="k") | |
preds.isel(pixel=0).sel(time="2007").sim.plot(ax=ax) |
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
""" | |
append to bottom of `/home/pi/.bashrc` | |
nohup python3 /home/pi/REACH_tjx/scripts/run_camera.py | |
""" | |
from datetime import datetime | |
from time import sleep | |
from picamera import PiCamera | |
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
# metpy_env.sh | |
conda create -n metpy --yes | |
conda activate metpy | |
conda install -c conda-forge metpy --yes | |
conda install -c conda-forge matplotlib tqdm jupyterlab ipython pip ruamel.yaml xarray descartes black mypy --yes | |
# NOTE: can only install geopandas with conda if python=3.7 | |
# conda install -c conda-forge geopandas --yes | |
# pip install geopandas |
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
conda create -n py | |
conda activate py | |
conda install -c conda-forge matplotlib tqdm jupyterlab ipython pip ruamel.yaml xarray black mypy pandas --yes | |
# test | |
ipython -c "import xarray; import numpy; import pandas; import matplotlib; print('Everything Worked!')" |
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 pandas as pd | |
import matplotlib.pyplot as plt | |
from pathlib import Path | |
# make sure the data is loaded | |
data_dir = Path("/Users/tommylees/Downloads") | |
df = pd.read_csv(data_dir / "demo_sonde.csv", index_col=0) | |
# initialise plot | |
f, ax = plt.subplots() |
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 | |
from pathlib import Path | |
if __name__ == "__main__": | |
data_dir = Path("/Users/tommylees/github/spatio_temporal/data") | |
# list(data_dir.glob("*.nc")) | |
ds = xr.open_dataset(data_dir / "camels_static.nc") | |
df = ds.to_dataframe() |
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
"""[summary] | |
My Question Described: | |
https://stackoverflow.com/questions/67004787/pulp-linear-programming-scheduling-optimisation-constraint-on-consecutive-nigh | |
https://or.stackexchange.com/questions/6070/pulp-scheduling-optimisation-constraint-on-consecutive-shifts-consecutive-ni | |
Minimise: | |
The maximum difference in the numbers of shifts per person...? | |
The cost function defined by hand-coded weights in a data table...? | |
Objective Function |
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
package main | |
import ( | |
"fmt" | |
) | |
const INITIAL_Z = 1 | |
const DELTA = 1e-7 | |
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
package main | |
import ( | |
"fmt" | |
"time" | |
) | |
func main() { | |
today := time.Now().Weekday() | |
fmt.Printf("Today is: %v\n", today) |