Code Monkey home page Code Monkey logo

wind-stats's People

Contributors

jules-ch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

etraiger

wind-stats's Issues

Enhance Documentation

User guides

  • How to use your data
  • How to predict roughness length of location

Explanation

  • How to predict energy output

API Reference

  • Documentation for modules & public API

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED], but requests works

Hi Jules,
I'm getting ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]
in GWAReader, test.py and logfile below. requests works though ?

Actually, instead of a request for lat/lon one at a time, you can download a .tif for a whole country
e.g. https://globalwindatlas.info/api/gis/country/FRA/wind-speed/100
and get data wherever you want with rasterio / rioxarray (I'm no expert, they're way too big.)
Thanks, cheers
-- denis

#!/usr/bin/env python3
# https://github.com/jules-ch/wind-stats
# wind_stats/gwa_reader.py
# 2021-08-19 aug [email protected]

import sys
import requests
from urllib.request import Request, urlopen, __version__

print( "python", sys.version.split()[0] )
print( "requests.__version__", requests.__version__ )
print( "urllib.request.__version__", __version__ )

lat, lon = 48.4569, 5.583  # -> 48.444, 5.583
url = f"https://globalwindatlas.info/api/gwa/custom/Lib/?lat={lat}&long={lon}"
print( "url:", url )

#...............................................................................
req = requests.get( url ).text
lines = req.splitlines()
print( "\nrequests.get( url ): %s lines \n%s \n..." % (
        len(lines), "\n".join( lines[:5] )))

print( "\nurllib.request.Request( url ) --" )
request = Request( url,
    headers={"Referer": "https://globalwindatlas.info"},
    )

print( "\nurllib.request.urlopen(request) --" )
with urlopen(request) as f:
    data = f.read()
    # data = GWAReader.loads( data )
# from: urllib-Request.py
# 19 Aug 2021 13:58z  py/wind/stats  Denis-iMac 10.10.5

python 3.7.9
requests.__version__ 2.26.0
urllib.request.__version__ 3.7
url: https://globalwindatlas.info/api/gwa/custom/Lib/?lat=48.4569&long=5.583

requests.get( url ): 59 lines 
Global Wind Atlas 3.0 (WRF 3-km)<coordinates>5.583,48.444,0.0</coordinates>
5 5 12
    0.000     0.030     0.100     0.400     1.500
     10.0      50.0     100.0     150.0     200.0
     3.72     5.19     9.26    10.05     4.14     4.14     7.34    10.89    16.65    14.81     8.23     5.59 
...

urllib.request.Request( url ) --

urllib.request.urlopen(request) --
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1350, in do_open
    encode_chunked=req.has_header('Transfer-encoding'))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1277, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1323, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1272, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1032, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 972, in send
    self.connect()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1447, in connect
    server_hostname=server_hostname)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 423, in wrap_socket
    session=session
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 870, in _create
    self.do_handshake()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1139, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1091)

During handling of the above exception, another exception occurred:
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.