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
# Brian Blaylock | |
# January 5, 2017 It's snowing outside | |
""" | |
Simple Basemap examples | |
Example gallery: http://matplotlib.org/basemap/users/examples.html | |
Documentation: https://basemaptutorial.readthedocs.io/en/latest/ | |
""" |
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 sys,getopt | |
#from netCDF4 import Dataset # use scipy instead | |
from scipy.io import netcdf #### <--- This is the library to import. | |
import matplotlib | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import os | |
from datetime import datetime, timedelta | |
import coltbls as coltbls | |
from mpl_toolkits.basemap import Basemap |
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
#from netCDF4 import Dataset # use scipy instead | |
from scipy.io import netcdf #### <--- This is the library to import. | |
# Open file in a netCDF reader | |
directory = './' | |
wrf_file_name = directory+'filename' | |
nc = netcdf.netcdf_file(wrf_file_name,'r') | |
#Look at the variables available |
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 os | |
DIR = '/this/is/the/directory/name/' | |
if not os.path.exists(DIR): | |
os.makedirs(DIR) |
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
from datetime import datetime, timedelta | |
# create a list of dates from a starting date for a certian number of hours | |
base = datetime(2017, 5, 10) | |
hours = 36 | |
DATES = np.array([base + timedelta(hours=x) for x in range(0, hours)]) | |
# create a list of datetimes between two dates for each hour | |
sDATE = datetime(2017, 5, 10) | |
eDATE = datetime(2017, 5, 12) |
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
# Greek Letters | |
plt.title(r'$\theta$') | |
plt.title(r'$\alpha$') | |
plt.title(r'$\Delta$') | |
# Superscript (wind speed m/s) | |
plt.ylabel(r'Wind Speed (m s$\mathregular{^{-1}}$)') | |
# Subscript (CO_2, theta_surface) | |
plt.ylabel(r'CO$_2$ (ppm)') |
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
# More here: http://matplotlib.org/api/legend_api.html | |
# No boarder, transparent frame | |
legend = ax1.legend(frameon=True, framealpha=.5) | |
legend.get_frame().set_linewidth(0) | |
# Limit scatterpoints in legend | |
plt.legend(scatterpoints=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
# Brian Blaylock | |
# February 13, 2018 | |
# Updated December 10, 2018 for Python 3 | |
""" | |
Download archived HRRR files from MesoWest Pando S3 archive system. | |
Please register before downloading from our HRRR archive: | |
http://hrrr.chpc.utah.edu/hrrr_download_register.html |
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
# Brian Blaylock | |
# March 10, 2017 | |
# updated: July 26, 2017 | |
""" | |
Download a single variable from the HRRR archive using cURL | |
Steps: | |
1) Read the lines from the Metadata .idx file | |
2) Identify the byte range for the variable of interest |
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
# Brian Blaylock | |
# March 14, 2017 It's Pi Day!! (3.14) | |
""" | |
Get data from a HRRR grib2 file on the MesoWest HRRR S3 Archive | |
Requires cURL on your linux system | |
""" | |
import os |