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
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
# 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
""" | |
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
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
# 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
# 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 statsmodels scikit-learn black mypy --yes | |
# 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
""" | |
Mask xarray dataset using a shapefile [closed] | |
https://stackoverflow.com/a/64587946/9940782 | |
""" | |
from typing import Tuple | |
import geopandas as gpd | |
import xarray as xr | |
import rasterio as rio | |
from pathlib import Path | |
import numpy as np |
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
mono /home/pi/CumulusMX/CumulusMX.exe & |
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
# outF = open("run_cumulusMX.sh", "w") | |
# line = “mono /home/pi/CumulusMX/CumulusMX.exe &” | |
# outF.write(line) | |
# outF.close() | |
import os | |
os.system("mono /home/pi/CumulusMX/CumulusMX.exe &") |