Comments (5)
OK, so this hack worked for future reference:
# 1) Open the Metadata URL and read the lines
try:
# Hack to not certify (https://stackoverflow.com/questions/19268548/python-ignore-certicate-validation-urllib2/28048260#28048260)
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
idxpage = urllib2.urlopen(idxfile, context=ctx)
lines = idxpage.readlines()
except:
print "\n ERROR!!! Does the .idx file exist: %s \n" % idxfile
continue
from pybkb_v2.
Hi Nic,
I'm glad you are finding the HRRR archive useful.
I'm not sure why the HRRR_S3.py script hangings, and I think the URLError:
has to do with the version of urllib you are using. I re-wrote a download script that I hope will simplify things for you and others:
https://github.com/blaylockbk/pyBKB_v2/blob/master/demos/hrrr_variable_from_pando.py
All I did was reorganized the loops
I'd suggest reading all the comments so you can tailor the function parameters for your needs. Let me know if you still get the URLError
, and I'll try to find how I got around that earlier.
From what it sounds like you are trying to download, you might try running the main download function like this...
# Download multiple variables from date range
sDATE = date(2016, 1, 1) # Start date
eDATE = date(2017, 1, 1) # End date (exclusive)
days = (eDATE-sDATE).days
DATES = [sDATE + timedelta(days=d) for d in range(days)]
# Variable strings must be part of a line in the .idx file
variables = ['TMP:2 m', 'DPT:2 m', 'APCP:surface']
for variable in variables:
for DATE in DATES:
# This is the main download function. We are
# simply looping over all the days and variables
# we want to get.
download_HRRR_variable_from_pando(DATE, variable,
hours=[0, 6, 12, 18],
fxx=[8],
model='hrrr',
field='sfc',
outdir='./')
from pybkb_v2.
Thank you for the updated function! But when I run the example you provided I get multiple:
ERROR!!! Does the .idx file exist: https://api.mesowest.utah.edu/archive/HRRR/oper/sfc/20170310/hrrr.t18z.wrfsfcf00.grib2.idx
Which is strange, because the file does exist at that url.
Maybe its an issue with my urllib2?? I am using python 2.7.12.
EDIT: Yes the underlying issue is still a URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
Will try to figure out why.
from pybkb_v2.
Closing issue as it was urllib2 bug on my end.
from pybkb_v2.
ah, yes. That was the same solution I've used before. Good to hear you got it working. Let me know if you need any other help.
from pybkb_v2.
Related Issues (3)
- CONUS Water Vapor HOT 2
- ipynb file unavailable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybkb_v2.