albertotb / get-gfs

Downloading meteorological information from GFS
MIT License
51 stars 26 forks source link

How do I install and run? #2

Closed heyerbobby closed 4 years ago

heyerbobby commented 4 years ago

Hi, I've been trying to install and run this but haven't had any luck.

But after that I'm lost.

Any chance for a more detailed how to guide for beginners? would be much appreciated

heyerbobby commented 4 years ago

Figured out my problem, I had to type 'python' in the terminal before typing the get_gfs....

albertotb commented 4 years ago

Great, if you have any questions or features you would like to see implemented please let me know

Best regards, Alberto

On Thu, 21 Nov 2019 at 06:31, Bobby Heyer notifications@github.com wrote:

Figured out my problem, I had to type 'python' in the terminal before typing the get_gfs....

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/albertotb/get-gfs/issues/2?email_source=notifications&email_token=ABRWQARROWUI5LBQUZZWSGDQUYMMPA5CNFSM4JP4WHA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEZASWY#issuecomment-556927323, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABRWQAW52JKJ7JHBTHYHGKLQUYMMPANCNFSM4JP4WHAQ .

heyerbobby commented 4 years ago

Hi @albertotb Thanks for your quick reply, I do a quick question.

Sometimes when I run the script, or when I run the script for a second time, I'll get various timeout errors. (as below) do you know why this is happening?

Unexpected error: <class 'UnboundLocalError'>
local variable 'dataset' referenced before assignment
Traceback (most recent call last):
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\connectionpool.py", line 384, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse()
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\http\client.py", line 1344, in getresponse
    response.begin()
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\http\client.py", line 306, in begin
    version, status, reason = self._read_status()
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\http\client.py", line 267, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\contrib\pyopenssl.py", line 310, in recv_into
    raise timeout('The read operation timed out')
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\requests\adapters.py", line 449, in send
    timeout=timeout
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\util\retry.py", line 368, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\packages\six.py", line 686, in reraise
    raise value
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\urllib3\connectionpool.py", line 306, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='nomads.ncep.noaa.gov', port=9090): Read timed out. (read timeout=120)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\pydap\net.py", line 79, in create_request_from_session
    timeout=timeout)) as head:
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\requests\sessions.py", line 568, in head
    return self.request('HEAD', url, **kwargs)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\requests\sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\requests\sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\requests\adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='nomads.ncep.noaa.gov', port=9090): Read timed out. (read timeout=120)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "get_gfs.py", line 99, in get_file
    dataset = open_dods(request + ','.join(var_list))
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\pydap\client.py", line 112, in open_dods
    r = GET(url, application, session, timeout=timeout)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\pydap\net.py", line 27, in GET
    timeout=timeout)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\pydap\net.py", line 50, in follow_redirect
    req = create_request(url, session=session, timeout=timeout)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\pydap\net.py", line 72, in create_request
    timeout=timeout)
  File "C:\Users\bheyer\Continuum\anaconda3\envs\CondaEnv\lib\site-packages\pydap\net.py", line 101, in create_request_from_session
    raise HTTPError('Timeout')
webob.exc.HTTPError: Timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "get_gfs.py", line 240, in main
    verbose=args.verbose)
  File "get_gfs.py", line 169, in save_dataset
    data_e = get_file(request, param_e, var_conf, time, lat, lon_e, verbose=verbose)
  File "get_gfs.py", line 101, in get_file
    print(dataset)
UnboundLocalError: local variable 'dataset' referenced before assignment
albertotb commented 4 years ago

Please share the command you are running that sometimes throws the timeout errors

heyerbobby commented 4 years ago

Hi @albertotb I was running python get_gfs.py -s 1 -r 0.25 -t 0 120 -x 149.5 150.5 -y -24.5 -23.5 -p 0 2 -c example_conf.json 20191117 18 I think because i was requesting 120 hours it was timing out, I added 'timeout=300' and the problem was solved.