This file contains 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
# A list of handy colormaps used in my JGR paper | |
# Alexander Rey | |
: mail@alexanderrey.ca | |
# https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2020JC016489 | |
# Cmocean Colormaps | |
# https://matplotlib.org/cmocean/ | |
# MatPlotLib Colormaps | |
# https://www.mathworks.com/matlabcentral/fileexchange/51986-perceptually-uniform-colormaps |
This file contains 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 | |
import contextily as ctx | |
import matplotlib.pyplot as plt | |
#%% Import | |
mapbox = 'https://api.mapbox.com/styles/v1/alexander0042/ckemxgtk51fgp19nybfmdcb1e/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiYWxleGFuZGVyMDA0MiIsImEiOiJjazVmdG4zbncwMHY4M2VrcThwZGUzZDFhIn0.w6oDHoo1eCeRlSBpwzwVtw' | |
fig, axes = plt.subplots(nrows=1, ncols=1, figsize=(10, 6)) |
This file contains 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
abslat = np.abs(lats-stn_lat) | |
abslon= np.abs(lons-stn_lon) | |
c = np.maximum(abslon,abslat) | |
latlon_idx = np.argpartition(-c.flatten(), -4)[-4:] | |
x, y = np.unravel_index(latlon_idx,c.shape) | |
latlon_dist = c[x, y] | |
# Avoid divide by zero if exactly on point | |
latlon_dist=np.maximum(latlon_dist, 0.000001) |