Skip to content

Errors retreiving spaceweather files using JB2008 #7

@OrbitalMechanic

Description

@OrbitalMechanic

I'm running PyAtmos ver. 1.2.4 under Python ver. 3.9.x under the Anaconda distribution on a Mac Pro (2019) that runs Mac OSX ver. 13.2.1 (Ventura). In running the following example:

from pyatmos import download_sw_jb2008,read_sw_jb2008
# Download or update the space weather file from https://sol.spacenvironment.net
swfile = download_sw_jb2008() 
# Read the space weather data
swdata = read_sw_jb2008(swfile) 

from pyatmos import jb2008
# Set a specific time and location
t = '2014-07-22 22:18:45' # time(UTC) 
lat,lon,alt = 25,102,600 # latitude, longitude in [degree], and altitude in [km]
jb08 = jb2008(t,(lat,lon,alt),data)
print(jb08.rho) # [kg/m^3]
print(jb08.T) # [K]

I get the following error messages.

================================================================================
Feb 18, 2023 at 04:53:42
~/Various_Python_Examples/JB2008_Example/JB2008_ex.py
--------------------------------------------------------------------------------
Downloading the Space Weather file 'SOLFSMY.TXT' from Space Environment Technologies(SET)
/Users/user/opt/anaconda3/lib/python3.9/site-packages/paramiko/transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Traceback (most recent call last):
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/Users/user/opt/anaconda3/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/Users/user/opt/anaconda3/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/Users/user/opt/anaconda3/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/Users/user/opt/anaconda3/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/Users/user/opt/anaconda3/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/Users/user/opt/anaconda3/lib/python3.9/http/client.py", line 1454, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/Users/user/opt/anaconda3/lib/python3.9/ssl.py", line 501, in wrap_socket
    return self.sslsocket_class._create(
  File "/Users/user/opt/anaconda3/lib/python3.9/ssl.py", line 1041, in _create
    self.do_handshake()
  File "/Users/user/opt/anaconda3/lib/python3.9/ssl.py", line 1310, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/Various_Python_Examples/JB2008_Example/JB2008_ex.py", line 5, in <module>
    swfile = download_sw_jb2008() 
  File "/Users/user/opt/anaconda3/lib/python3.9/site-packages/pyatmos/jb2008/spaceweather.py", line 42, in download_sw_jb2008
    wget_download(url1,swfile1,desc1)
  File "/Users/user/opt/anaconda3/lib/python3.9/site-packages/pyatmos/utils/try_download.py", line 17, in wget_download
    wget_out = wget.download(url,dir_file)
  File "/Users/user/opt/anaconda3/lib/python3.9/site-packages/wget.py", line 526, in download
    (tmpfile, headers) = ulib.urlretrieve(binurl, tmpfile, callback)
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 239, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 214, in urlopen
    return opener.open(url, data, timeout)
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 517, in open
    response = self._open(req, data)
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 534, in _open
    result = self._call_chain(self.handle_open, protocol, protocol +
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 1389, in https_open
    return self.do_open(http.client.HTTPSConnection, req,
  File "/Users/user/opt/anaconda3/lib/python3.9/urllib/request.py", line 1349, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)>

The problem appears to be associated with wget_download thru download_sw_jb2008() .

Any suggestions?

Sam Dupree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions