Skip to content

Commit

Permalink
rename network to NETWORK
Browse files Browse the repository at this point in the history
  • Loading branch information
seisman committed Mar 17, 2017
1 parent 98b511a commit 3d3c866
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 98 deletions.
1 change: 1 addition & 0 deletions Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Changelog
=========

0.3.3:
- change ``network`` to ``NETWORK`` in ``header.py``
- add wildcard support to ``win32.merge``
- change ``Client.check_module_release`` to ``Client.check_package_release``
- support output filename with deep directory
Expand Down
16 changes: 8 additions & 8 deletions HinetPy/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import requests

from HinetPy.win32 import merge
from HinetPy import __version__, __title__, __repo__
from HinetPy import header
from HinetPy.win32 import merge
from HinetPy.header import NETWORK

# Setup the logger
FORMAT = "[%(asctime)s] %(levelname)s: %(message)s"
Expand Down Expand Up @@ -273,7 +273,7 @@ def _parse_code(self, code):
>>> client._parse_code('010501')
('01', '05', '010501')
"""
if code not in header.network.keys():
if code not in NETWORK.keys():
msg = "{}: Incorrect network code.".format(code)
raise ValueError(msg)
elif code.startswith('0105') or code.startswith('0302'):
Expand Down Expand Up @@ -363,7 +363,7 @@ def get_waveform(self, code, starttime, span,

# 1. check starttime and endtime
# TODO: correct starttime and endtime if not in allowed range
time0 = header.network[code].starttime
time0 = NETWORK[code].starttime
# time1 = UTCTime + JST(GMT+0900) - 2 hour delay
time1 = datetime.utcnow() + timedelta(hours=9) + timedelta(hours=-2)
endtime = starttime + timedelta(minutes=span)
Expand Down Expand Up @@ -587,7 +587,7 @@ def get_allowed_span(self, code):
max_span: int
Maximum allowed span in mimutes.
"""
channels = header.network[code].channels
channels = NETWORK[code].channels
if code in ('0101', '0103', '0103A'):
stations = self.get_selected_stations(code)
if stations != 0:
Expand Down Expand Up @@ -751,16 +751,16 @@ def help(self, code=None):
Network code.
"""
if code:
net = header.network[code]
net = NETWORK[code]
info = "== Information of Network {} ==\n".format(code)
info += "Name: {}\n".format(net.name)
info += "Homepage: {}\n".format(net.url)
info += "Starttime: {}\n".format(net.starttime.strftime("%Y%m%d"))
info += "No. of channels: {}".format(net.channels)
print(info)
else:
for code in sorted(header.network.keys()):
print("{:7s}: {}".format(code, header.network[code].name))
for code in sorted(NETWORK.keys()):
print("{:7s}: {}".format(code, NETWORK[code].name))

def _get_win32tools(self):
"""Download win32 tools"""
Expand Down
Loading

0 comments on commit 3d3c866

Please sign in to comment.