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 | |
| base = datetime.today() | |
| numdays = 5 | |
| date_list = [base - timedelta(days=x) for x in range(0,numdays)] |
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
| DATES = np.array([]) | |
| for i in dates: | |
| DATES = np.append(DATES,datetime.strptime(i,'%m/%d/%Y %H%M')) |
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 numpy as np | |
| import datetime | |
| def datestr_to_datetime(x): | |
| return datetime.datetime.strptime(x,'%Y-%m-%dT%H:%M:%SZ') | |
| # where dates is some list of dates as a string... | |
| # vectorize the function | |
| converttime = np.vectorize(datestr_to_datetime) | |
| DATES = converttime(dates) |
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
| # where dates is a list or numpy array of epoch dates... | |
| DATE = [datetime.utcfromtimestamp(x) for x in dates] |
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
| # To untar just about everything | |
| tar -xzvf models.tar.gz 20160101/models/hrrr/ | |
| # To untar just the HRRR pressure fields for analysis hours | |
| tar -zxvf models.tar.gz --wildcards --no-anchored 'hrrr.t*z.wrfprsf00.grib2' | |
| $ to untar just the HRRR surface fields for analysis hours | |
| tar -zxvf models.tar.gz --wildcards --no-anchored 'hrrr.t*z.wrfsfcf00.grib2' |
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 | |
| # ATMOS 6910 Homework | |
| # 10 November 2016 | |
| # Look at the figures here: | |
| # http://kbkb-wx-python.blogspot.com/2016/11/verifying-gfs-dewpoint-data-with.html | |
| """ | |
| [X] Reads a GRiB forecast file from the GFS (15%) | |
| [X] Extracts Temperature and Relative Humidity from ingest (5%) |
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 | |
| OUTDIR = '/this/path/will/be/created/' | |
| if not os.path.exists(OUTDIR): | |
| os.makedirs(OUTDIR) |
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
| # Brian Blaylock | |
| # March 24, 2017 Yesterday Salt Lake had lots of rain | |
| """ | |
| Fast download of HRRR grib2 files with threading | |
| """ | |
| from queue import Queue | |
| from threading import Thread | |
| from datetime import datetime, timedelta |
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 |
OlderNewer