Note
Go to the end to download the full example code.
List all keywords for a HMI series#
This example shows how to display the keywords for a HMI series.
import drms
First we will create a drms.Client
, using the JSOC baseurl.
client = drms.Client()
Query series info
series_info = client.info("hmi.v_45s")
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/drms/checkouts/stable/examples/list_keywords.py", line 19, in <module>
series_info = client.info("hmi.v_45s")
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/checkouts/readthedocs.org/user_builds/drms/envs/stable/lib/python3.11/site-packages/drms/client.py", line 894, in info
d = self._json.series_struct(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/checkouts/readthedocs.org/user_builds/drms/envs/stable/lib/python3.11/site-packages/drms/json.py", line 165, in series_struct
req = self._json_request(self._server.url_jsoc_info + query)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/checkouts/readthedocs.org/user_builds/drms/envs/stable/lib/python3.11/site-packages/drms/json.py", line 92, in _json_request
return HttpJsonRequest(url, self._server.encoding)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/checkouts/readthedocs.org/user_builds/drms/envs/stable/lib/python3.11/site-packages/drms/json.py", line 43, in __init__
self._http = urlopen(url)
^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 525, in open
response = meth(req, response)
^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 634, in http_response
response = self.parent.error(
^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 557, in error
result = self._call_chain(*args)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 749, in http_error_302
return self.parent.open(new, timeout=req.timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 519, in open
response = self._open(req, data)
^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 496, in _call_chain
result = func(*args)
^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/docs/.asdf/installs/python/3.11.10/lib/python3.11/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno -2] Name or service not known>
Print keyword info
print(f"Listing keywords for {series_info.name}:\n")
for keyword in sorted(series_info.keywords.index):
keyword_info = series_info.keywords.loc[keyword]
print(keyword)
print(f" type ....... {keyword_info.type} ")
print(f" recscope ... {keyword_info.recscope} ")
print(f" defval ..... {keyword_info.defval} ")
print(f" units ...... {keyword_info.units} ")
print(f" note ....... {keyword_info.note} ")
Total running time of the script: (0 minutes 0.108 seconds)