repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
koordinates/python-client | koordinates/sets.py | SetManager.set_metadata | def set_metadata(self, set_id, fp):
"""
Set the XML metadata on a set.
:param file fp: file-like object to read the XML metadata from.
"""
base_url = self.client.get_url('SET', 'GET', 'single', {'id': set_id})
self._metadata.set(base_url, fp) | python | def set_metadata(self, set_id, fp):
"""
Set the XML metadata on a set.
:param file fp: file-like object to read the XML metadata from.
"""
base_url = self.client.get_url('SET', 'GET', 'single', {'id': set_id})
self._metadata.set(base_url, fp) | [
"def",
"set_metadata",
"(",
"self",
",",
"set_id",
",",
"fp",
")",
":",
"base_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'SET'",
",",
"'GET'",
",",
"'single'",
",",
"{",
"'id'",
":",
"set_id",
"}",
")",
"self",
".",
"_metadata",
".",
"... | Set the XML metadata on a set.
:param file fp: file-like object to read the XML metadata from. | [
"Set",
"the",
"XML",
"metadata",
"on",
"a",
"set",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/sets.py#L45-L52 |
koordinates/python-client | koordinates/sets.py | Set.set_metadata | def set_metadata(self, fp):
"""
Set the XML metadata on a set.
:param file fp: file-like object to read the XML metadata from.
"""
base_url = self._client.get_url('SET', 'GET', 'single', {'id': self.id})
self._manager._metadata.set(base_url, fp)
# reload myself
... | python | def set_metadata(self, fp):
"""
Set the XML metadata on a set.
:param file fp: file-like object to read the XML metadata from.
"""
base_url = self._client.get_url('SET', 'GET', 'single', {'id': self.id})
self._manager._metadata.set(base_url, fp)
# reload myself
... | [
"def",
"set_metadata",
"(",
"self",
",",
"fp",
")",
":",
"base_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'SET'",
",",
"'GET'",
",",
"'single'",
",",
"{",
"'id'",
":",
"self",
".",
"id",
"}",
")",
"self",
".",
"_manager",
".",
"_metad... | Set the XML metadata on a set.
:param file fp: file-like object to read the XML metadata from. | [
"Set",
"the",
"XML",
"metadata",
"on",
"a",
"set",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/sets.py#L80-L91 |
koordinates/python-client | koordinates/metadata.py | MetadataManager.set | def set(self, parent_url, fp):
"""
If the parent object already has XML metadata, it will be overwritten.
Accepts XML metadata in any of the three supported formats.
The format will be detected from the XML content.
The Metadata object becomes invalid after setting
:pa... | python | def set(self, parent_url, fp):
"""
If the parent object already has XML metadata, it will be overwritten.
Accepts XML metadata in any of the three supported formats.
The format will be detected from the XML content.
The Metadata object becomes invalid after setting
:pa... | [
"def",
"set",
"(",
"self",
",",
"parent_url",
",",
"fp",
")",
":",
"url",
"=",
"parent_url",
"+",
"self",
".",
"client",
".",
"get_url_path",
"(",
"'METADATA'",
",",
"'POST'",
",",
"'set'",
",",
"{",
"}",
")",
"r",
"=",
"self",
".",
"client",
".",
... | If the parent object already has XML metadata, it will be overwritten.
Accepts XML metadata in any of the three supported formats.
The format will be detected from the XML content.
The Metadata object becomes invalid after setting
:param file fp: A reference to an open file-like objec... | [
"If",
"the",
"parent",
"object",
"already",
"has",
"XML",
"metadata",
"it",
"will",
"be",
"overwritten",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/metadata.py#L21-L35 |
koordinates/python-client | koordinates/metadata.py | Metadata.get_xml | def get_xml(self, fp, format=FORMAT_NATIVE):
"""
Returns the XML metadata for this source, converted to the requested format.
Converted metadata may not contain all the same information as the native format.
:param file fp: A path, or an open file-like object which the content should be... | python | def get_xml(self, fp, format=FORMAT_NATIVE):
"""
Returns the XML metadata for this source, converted to the requested format.
Converted metadata may not contain all the same information as the native format.
:param file fp: A path, or an open file-like object which the content should be... | [
"def",
"get_xml",
"(",
"self",
",",
"fp",
",",
"format",
"=",
"FORMAT_NATIVE",
")",
":",
"r",
"=",
"self",
".",
"_client",
".",
"request",
"(",
"'GET'",
",",
"getattr",
"(",
"self",
",",
"format",
")",
",",
"stream",
"=",
"True",
")",
"filename",
"... | Returns the XML metadata for this source, converted to the requested format.
Converted metadata may not contain all the same information as the native format.
:param file fp: A path, or an open file-like object which the content should be written to.
:param str format: desired format for the ou... | [
"Returns",
"the",
"XML",
"metadata",
"for",
"this",
"source",
"converted",
"to",
"the",
"requested",
"format",
".",
"Converted",
"metadata",
"may",
"not",
"contain",
"all",
"the",
"same",
"information",
"as",
"the",
"native",
"format",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/metadata.py#L47-L61 |
koordinates/python-client | koordinates/metadata.py | Metadata.get_formats | def get_formats(self):
""" Return the available format names for this metadata """
formats = []
for key in (self.FORMAT_DC, self.FORMAT_FGDC, self.FORMAT_ISO):
if hasattr(self, key):
formats.append(key)
return formats | python | def get_formats(self):
""" Return the available format names for this metadata """
formats = []
for key in (self.FORMAT_DC, self.FORMAT_FGDC, self.FORMAT_ISO):
if hasattr(self, key):
formats.append(key)
return formats | [
"def",
"get_formats",
"(",
"self",
")",
":",
"formats",
"=",
"[",
"]",
"for",
"key",
"in",
"(",
"self",
".",
"FORMAT_DC",
",",
"self",
".",
"FORMAT_FGDC",
",",
"self",
".",
"FORMAT_ISO",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"key",
")",
":",... | Return the available format names for this metadata | [
"Return",
"the",
"available",
"format",
"names",
"for",
"this",
"metadata"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/metadata.py#L63-L69 |
koordinates/python-client | koordinates/utils.py | is_bound | def is_bound(method):
"""
Decorator that asserts the model instance is bound.
Requires:
1. an ``id`` attribute
2. a ``url`` attribute
2. a manager set
"""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
if not self._is_bound:
raise ValueError("%r mus... | python | def is_bound(method):
"""
Decorator that asserts the model instance is bound.
Requires:
1. an ``id`` attribute
2. a ``url`` attribute
2. a manager set
"""
@functools.wraps(method)
def wrapper(self, *args, **kwargs):
if not self._is_bound:
raise ValueError("%r mus... | [
"def",
"is_bound",
"(",
"method",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"method",
")",
"def",
"wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"_is_bound",
":",
"raise",
"ValueError",
"... | Decorator that asserts the model instance is bound.
Requires:
1. an ``id`` attribute
2. a ``url`` attribute
2. a manager set | [
"Decorator",
"that",
"asserts",
"the",
"model",
"instance",
"is",
"bound",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/utils.py#L16-L30 |
michaelaye/pyciss | pyciss/opusapi.py | OPUS.query_image_id | def query_image_id(self, image_id):
"""Query OPUS via the image_id.
This is a query using the 'primaryfilespec' field of the OPUS database.
It returns a list of URLS into the `obsids` attribute.
This example queries for an image of Titan:
>>> opus = opusapi.OPUS()
>>> ... | python | def query_image_id(self, image_id):
"""Query OPUS via the image_id.
This is a query using the 'primaryfilespec' field of the OPUS database.
It returns a list of URLS into the `obsids` attribute.
This example queries for an image of Titan:
>>> opus = opusapi.OPUS()
>>> ... | [
"def",
"query_image_id",
"(",
"self",
",",
"image_id",
")",
":",
"myquery",
"=",
"{",
"\"primaryfilespec\"",
":",
"image_id",
"}",
"self",
".",
"create_files_request",
"(",
"myquery",
",",
"fmt",
"=",
"\"json\"",
")",
"self",
".",
"unpack_json_response",
"(",
... | Query OPUS via the image_id.
This is a query using the 'primaryfilespec' field of the OPUS database.
It returns a list of URLS into the `obsids` attribute.
This example queries for an image of Titan:
>>> opus = opusapi.OPUS()
>>> opus.query_image_id('N1695760475_1')
A... | [
"Query",
"OPUS",
"via",
"the",
"image_id",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L161-L179 |
michaelaye/pyciss | pyciss/opusapi.py | OPUS.create_request_with_query | def create_request_with_query(self, kind, query, size="thumb", fmt="json"):
"""api/data.[fmt], api/images/[size].[fmt] api/files.[fmt]
kind = ['data', 'images', 'files']
"""
if kind == "data" or kind == "files":
url = "{}/{}.{}".format(base_url, kind, fmt)
elif kin... | python | def create_request_with_query(self, kind, query, size="thumb", fmt="json"):
"""api/data.[fmt], api/images/[size].[fmt] api/files.[fmt]
kind = ['data', 'images', 'files']
"""
if kind == "data" or kind == "files":
url = "{}/{}.{}".format(base_url, kind, fmt)
elif kin... | [
"def",
"create_request_with_query",
"(",
"self",
",",
"kind",
",",
"query",
",",
"size",
"=",
"\"thumb\"",
",",
"fmt",
"=",
"\"json\"",
")",
":",
"if",
"kind",
"==",
"\"data\"",
"or",
"kind",
"==",
"\"files\"",
":",
"url",
"=",
"\"{}/{}.{}\"",
".",
"form... | api/data.[fmt], api/images/[size].[fmt] api/files.[fmt]
kind = ['data', 'images', 'files'] | [
"api",
"/",
"data",
".",
"[",
"fmt",
"]",
"api",
"/",
"images",
"/",
"[",
"size",
"]",
".",
"[",
"fmt",
"]",
"api",
"/",
"files",
".",
"[",
"fmt",
"]"
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L184-L196 |
michaelaye/pyciss | pyciss/opusapi.py | OPUS.get_between_times | def get_between_times(self, t1, t2, target=None):
"""
Query for OPUS data between times t1 and t2.
Parameters
----------
t1, t2 : datetime.datetime, strings
Start and end time for the query. If type is datetime, will be
converted to isoformat string. If t... | python | def get_between_times(self, t1, t2, target=None):
"""
Query for OPUS data between times t1 and t2.
Parameters
----------
t1, t2 : datetime.datetime, strings
Start and end time for the query. If type is datetime, will be
converted to isoformat string. If t... | [
"def",
"get_between_times",
"(",
"self",
",",
"t1",
",",
"t2",
",",
"target",
"=",
"None",
")",
":",
"try",
":",
"# checking if times have isoformat() method (datetimes have)",
"t1",
"=",
"t1",
".",
"isoformat",
"(",
")",
"t2",
"=",
"t2",
".",
"isoformat",
"... | Query for OPUS data between times t1 and t2.
Parameters
----------
t1, t2 : datetime.datetime, strings
Start and end time for the query. If type is datetime, will be
converted to isoformat string. If type is string already, it needs
to be in an accepted inter... | [
"Query",
"for",
"OPUS",
"data",
"between",
"times",
"t1",
"and",
"t2",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L251-L281 |
michaelaye/pyciss | pyciss/opusapi.py | OPUS.show_images | def show_images(self, size="small"):
"""Shows preview images using the Jupyter notebook HTML display.
Parameters
==========
size : {'small', 'med', 'thumb', 'full'}
Determines the size of the preview image to be shown.
"""
d = dict(small=256, med=512, thumb=1... | python | def show_images(self, size="small"):
"""Shows preview images using the Jupyter notebook HTML display.
Parameters
==========
size : {'small', 'med', 'thumb', 'full'}
Determines the size of the preview image to be shown.
"""
d = dict(small=256, med=512, thumb=1... | [
"def",
"show_images",
"(",
"self",
",",
"size",
"=",
"\"small\"",
")",
":",
"d",
"=",
"dict",
"(",
"small",
"=",
"256",
",",
"med",
"=",
"512",
",",
"thumb",
"=",
"100",
",",
"full",
"=",
"1024",
")",
"try",
":",
"width",
"=",
"d",
"[",
"size",... | Shows preview images using the Jupyter notebook HTML display.
Parameters
==========
size : {'small', 'med', 'thumb', 'full'}
Determines the size of the preview image to be shown. | [
"Shows",
"preview",
"images",
"using",
"the",
"Jupyter",
"notebook",
"HTML",
"display",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L288-L311 |
michaelaye/pyciss | pyciss/opusapi.py | OPUS.download_results | def download_results(self, savedir=None, raw=True, calib=False, index=None):
"""Download the previously found and stored Opus obsids.
Parameters
==========
savedir: str or pathlib.Path, optional
If the database root folder as defined by the config.ini should not be used,
... | python | def download_results(self, savedir=None, raw=True, calib=False, index=None):
"""Download the previously found and stored Opus obsids.
Parameters
==========
savedir: str or pathlib.Path, optional
If the database root folder as defined by the config.ini should not be used,
... | [
"def",
"download_results",
"(",
"self",
",",
"savedir",
"=",
"None",
",",
"raw",
"=",
"True",
",",
"calib",
"=",
"False",
",",
"index",
"=",
"None",
")",
":",
"obsids",
"=",
"self",
".",
"obsids",
"if",
"index",
"is",
"None",
"else",
"[",
"self",
"... | Download the previously found and stored Opus obsids.
Parameters
==========
savedir: str or pathlib.Path, optional
If the database root folder as defined by the config.ini should not be used,
provide a different savedir here. It will be handed to PathManager. | [
"Download",
"the",
"previously",
"found",
"and",
"stored",
"Opus",
"obsids",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L313-L339 |
michaelaye/pyciss | pyciss/opusapi.py | OPUS.download_previews | def download_previews(self, savedir=None):
"""Download preview files for the previously found and stored Opus obsids.
Parameters
==========
savedir: str or pathlib.Path, optional
If the database root folder as defined by the config.ini should not be used,
provide... | python | def download_previews(self, savedir=None):
"""Download preview files for the previously found and stored Opus obsids.
Parameters
==========
savedir: str or pathlib.Path, optional
If the database root folder as defined by the config.ini should not be used,
provide... | [
"def",
"download_previews",
"(",
"self",
",",
"savedir",
"=",
"None",
")",
":",
"for",
"obsid",
"in",
"self",
".",
"obsids",
":",
"pm",
"=",
"io",
".",
"PathManager",
"(",
"obsid",
".",
"img_id",
",",
"savedir",
"=",
"savedir",
")",
"pm",
".",
"basep... | Download preview files for the previously found and stored Opus obsids.
Parameters
==========
savedir: str or pathlib.Path, optional
If the database root folder as defined by the config.ini should not be used,
provide a different savedir here. It will be handed to PathMa... | [
"Download",
"preview",
"files",
"for",
"the",
"previously",
"found",
"and",
"stored",
"Opus",
"obsids",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/opusapi.py#L341-L355 |
michaelaye/pyciss | pyciss/_utils.py | which_epi_janus_resonance | def which_epi_janus_resonance(name, time):
"""Find which swap situtation we are in by time.
Starting from 2006-01-21 where a Janus-Epimetheus swap occured, and
defining the next 4 years until the next swap as `scenario1, and the 4
years after that `scenario2`.
Calculate in units of 4 years, in whic... | python | def which_epi_janus_resonance(name, time):
"""Find which swap situtation we are in by time.
Starting from 2006-01-21 where a Janus-Epimetheus swap occured, and
defining the next 4 years until the next swap as `scenario1, and the 4
years after that `scenario2`.
Calculate in units of 4 years, in whic... | [
"def",
"which_epi_janus_resonance",
"(",
"name",
",",
"time",
")",
":",
"t1",
"=",
"Time",
"(",
"'2002-01-21'",
")",
".",
"to_datetime",
"(",
")",
"delta",
"=",
"Time",
"(",
"time",
")",
".",
"to_datetime",
"(",
")",
"-",
"t1",
"yearfraction",
"=",
"de... | Find which swap situtation we are in by time.
Starting from 2006-01-21 where a Janus-Epimetheus swap occured, and
defining the next 4 years until the next swap as `scenario1, and the 4
years after that `scenario2`.
Calculate in units of 4 years, in which scenario the given time falls.
Parameters
... | [
"Find",
"which",
"swap",
"situtation",
"we",
"are",
"in",
"by",
"time",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/_utils.py#L4-L29 |
koordinates/python-client | koordinates/layers.py | LayerManager.list_drafts | def list_drafts(self):
"""
A filterable list views of layers, returning the draft version of each layer.
If the most recent version of a layer or table has been published already,
it won’t be returned here.
"""
target_url = self.client.get_url('LAYER', 'GET', 'multidraft'... | python | def list_drafts(self):
"""
A filterable list views of layers, returning the draft version of each layer.
If the most recent version of a layer or table has been published already,
it won’t be returned here.
"""
target_url = self.client.get_url('LAYER', 'GET', 'multidraft'... | [
"def",
"list_drafts",
"(",
"self",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'LAYER'",
",",
"'GET'",
",",
"'multidraft'",
")",
"return",
"base",
".",
"Query",
"(",
"self",
",",
"target_url",
")"
] | A filterable list views of layers, returning the draft version of each layer.
If the most recent version of a layer or table has been published already,
it won’t be returned here. | [
"A",
"filterable",
"list",
"views",
"of",
"layers",
"returning",
"the",
"draft",
"version",
"of",
"each",
"layer",
".",
"If",
"the",
"most",
"recent",
"version",
"of",
"a",
"layer",
"or",
"table",
"has",
"been",
"published",
"already",
"it",
"won’t",
"be",... | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L42-L49 |
koordinates/python-client | koordinates/layers.py | LayerManager.list_versions | def list_versions(self, layer_id):
"""
Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
``.filter(data__source__revision=value)``. Specific values depend on the source type.
... | python | def list_versions(self, layer_id):
"""
Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
``.filter(data__source__revision=value)``. Specific values depend on the source type.
... | [
"def",
"list_versions",
"(",
"self",
",",
"layer_id",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'multi'",
",",
"{",
"'layer_id'",
":",
"layer_id",
"}",
")",
"return",
"base",
".",
"Query",
... | Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
``.filter(data__source__revision=value)``. Specific values depend on the source type.
Use ``data__source_revision__lt`` or ``data__source_re... | [
"Filterable",
"list",
"of",
"versions",
"of",
"a",
"layer",
"always",
"ordered",
"newest",
"to",
"oldest",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L61-L71 |
koordinates/python-client | koordinates/layers.py | LayerManager.get_version | def get_version(self, layer_id, version_id, expand=[]):
"""
Get a specific version of a layer.
"""
target_url = self.client.get_url('VERSION', 'GET', 'single', {'layer_id': layer_id, 'version_id': version_id})
return self._get(target_url, expand=expand) | python | def get_version(self, layer_id, version_id, expand=[]):
"""
Get a specific version of a layer.
"""
target_url = self.client.get_url('VERSION', 'GET', 'single', {'layer_id': layer_id, 'version_id': version_id})
return self._get(target_url, expand=expand) | [
"def",
"get_version",
"(",
"self",
",",
"layer_id",
",",
"version_id",
",",
"expand",
"=",
"[",
"]",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'single'",
",",
"{",
"'layer_id'",
":",
"laye... | Get a specific version of a layer. | [
"Get",
"a",
"specific",
"version",
"of",
"a",
"layer",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L73-L78 |
koordinates/python-client | koordinates/layers.py | LayerManager.get_draft | def get_draft(self, layer_id, expand=[]):
"""
Get the current draft version of a layer.
:raises NotFound: if there is no draft version.
"""
target_url = self.client.get_url('VERSION', 'GET', 'draft', {'layer_id': layer_id})
return self._get(target_url, expand=expand) | python | def get_draft(self, layer_id, expand=[]):
"""
Get the current draft version of a layer.
:raises NotFound: if there is no draft version.
"""
target_url = self.client.get_url('VERSION', 'GET', 'draft', {'layer_id': layer_id})
return self._get(target_url, expand=expand) | [
"def",
"get_draft",
"(",
"self",
",",
"layer_id",
",",
"expand",
"=",
"[",
"]",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'draft'",
",",
"{",
"'layer_id'",
":",
"layer_id",
"}",
")",
"re... | Get the current draft version of a layer.
:raises NotFound: if there is no draft version. | [
"Get",
"the",
"current",
"draft",
"version",
"of",
"a",
"layer",
".",
":",
"raises",
"NotFound",
":",
"if",
"there",
"is",
"no",
"draft",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L80-L86 |
koordinates/python-client | koordinates/layers.py | LayerManager.get_published | def get_published(self, layer_id, expand=[]):
"""
Get the latest published version of this layer.
:raises NotFound: if there is no published version.
"""
target_url = self.client.get_url('VERSION', 'GET', 'published', {'layer_id': layer_id})
return self._get(target_url, e... | python | def get_published(self, layer_id, expand=[]):
"""
Get the latest published version of this layer.
:raises NotFound: if there is no published version.
"""
target_url = self.client.get_url('VERSION', 'GET', 'published', {'layer_id': layer_id})
return self._get(target_url, e... | [
"def",
"get_published",
"(",
"self",
",",
"layer_id",
",",
"expand",
"=",
"[",
"]",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'published'",
",",
"{",
"'layer_id'",
":",
"layer_id",
"}",
")... | Get the latest published version of this layer.
:raises NotFound: if there is no published version. | [
"Get",
"the",
"latest",
"published",
"version",
"of",
"this",
"layer",
".",
":",
"raises",
"NotFound",
":",
"if",
"there",
"is",
"no",
"published",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L88-L94 |
koordinates/python-client | koordinates/layers.py | LayerManager.create_draft | def create_draft(self, layer_id):
"""
Creates a new draft version.
If anything in the data object has changed then an import will begin immediately.
Otherwise to force a re-import from the previous sources call :py:meth:`koordinates.layers.LayerManager.start_import`.
:rtype: La... | python | def create_draft(self, layer_id):
"""
Creates a new draft version.
If anything in the data object has changed then an import will begin immediately.
Otherwise to force a re-import from the previous sources call :py:meth:`koordinates.layers.LayerManager.start_import`.
:rtype: La... | [
"def",
"create_draft",
"(",
"self",
",",
"layer_id",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'POST'",
",",
"'create'",
",",
"{",
"'layer_id'",
":",
"layer_id",
"}",
")",
"r",
"=",
"self",
".",
"client... | Creates a new draft version.
If anything in the data object has changed then an import will begin immediately.
Otherwise to force a re-import from the previous sources call :py:meth:`koordinates.layers.LayerManager.start_import`.
:rtype: Layer
:return: the new version
:raises C... | [
"Creates",
"a",
"new",
"draft",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L96-L109 |
koordinates/python-client | koordinates/layers.py | LayerManager.start_import | def start_import(self, layer_id, version_id):
"""
Starts importing the specified draft version (cancelling any running import),
even if the data object hasn’t changed from the previous version.
"""
target_url = self.client.get_url('VERSION', 'POST', 'import', {'layer_id': layer_i... | python | def start_import(self, layer_id, version_id):
"""
Starts importing the specified draft version (cancelling any running import),
even if the data object hasn’t changed from the previous version.
"""
target_url = self.client.get_url('VERSION', 'POST', 'import', {'layer_id': layer_i... | [
"def",
"start_import",
"(",
"self",
",",
"layer_id",
",",
"version_id",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'POST'",
",",
"'import'",
",",
"{",
"'layer_id'",
":",
"layer_id",
",",
"'version_id'",
":",... | Starts importing the specified draft version (cancelling any running import),
even if the data object hasn’t changed from the previous version. | [
"Starts",
"importing",
"the",
"specified",
"draft",
"version",
"(",
"cancelling",
"any",
"running",
"import",
")",
"even",
"if",
"the",
"data",
"object",
"hasn’t",
"changed",
"from",
"the",
"previous",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L111-L118 |
koordinates/python-client | koordinates/layers.py | LayerManager.start_update | def start_update(self, layer_id):
"""
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`koordinates.layers.LayerManager.create_draft` followed by :py:meth:`koordinates.layers.LayerManager.start_import`.
"""
target_url = self.client.get_u... | python | def start_update(self, layer_id):
"""
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`koordinates.layers.LayerManager.create_draft` followed by :py:meth:`koordinates.layers.LayerManager.start_import`.
"""
target_url = self.client.get_u... | [
"def",
"start_update",
"(",
"self",
",",
"layer_id",
")",
":",
"target_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'LAYER'",
",",
"'POST'",
",",
"'update'",
",",
"{",
"'layer_id'",
":",
"layer_id",
"}",
")",
"r",
"=",
"self",
".",
"client",... | A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`koordinates.layers.LayerManager.create_draft` followed by :py:meth:`koordinates.layers.LayerManager.start_import`. | [
"A",
"shortcut",
"to",
"create",
"a",
"new",
"version",
"and",
"start",
"importing",
"it",
".",
"Effectively",
"the",
"same",
"as",
":",
"py",
":",
"meth",
":",
"koordinates",
".",
"layers",
".",
"LayerManager",
".",
"create_draft",
"followed",
"by",
":",
... | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L120-L127 |
koordinates/python-client | koordinates/layers.py | LayerManager.set_metadata | def set_metadata(self, layer_id, version_id, fp):
"""
Set the XML metadata on a layer draft version.
:param file fp: file-like object to read the XML metadata from.
:raises NotAllowed: if the version is already published.
"""
base_url = self.client.get_url('VERSION', 'GE... | python | def set_metadata(self, layer_id, version_id, fp):
"""
Set the XML metadata on a layer draft version.
:param file fp: file-like object to read the XML metadata from.
:raises NotAllowed: if the version is already published.
"""
base_url = self.client.get_url('VERSION', 'GE... | [
"def",
"set_metadata",
"(",
"self",
",",
"layer_id",
",",
"version_id",
",",
"fp",
")",
":",
"base_url",
"=",
"self",
".",
"client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'single'",
",",
"{",
"'layer_id'",
":",
"layer_id",
",",
"'version_... | Set the XML metadata on a layer draft version.
:param file fp: file-like object to read the XML metadata from.
:raises NotAllowed: if the version is already published. | [
"Set",
"the",
"XML",
"metadata",
"on",
"a",
"layer",
"draft",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L129-L137 |
koordinates/python-client | koordinates/layers.py | Layer.is_published_version | def is_published_version(self):
""" Return if this version is the published version of a layer """
pub_ver = getattr(self, 'published_version', None)
this_ver = getattr(self, 'this_version', None)
return this_ver and pub_ver and (this_ver == pub_ver) | python | def is_published_version(self):
""" Return if this version is the published version of a layer """
pub_ver = getattr(self, 'published_version', None)
this_ver = getattr(self, 'this_version', None)
return this_ver and pub_ver and (this_ver == pub_ver) | [
"def",
"is_published_version",
"(",
"self",
")",
":",
"pub_ver",
"=",
"getattr",
"(",
"self",
",",
"'published_version'",
",",
"None",
")",
"this_ver",
"=",
"getattr",
"(",
"self",
",",
"'this_version'",
",",
"None",
")",
"return",
"this_ver",
"and",
"pub_ve... | Return if this version is the published version of a layer | [
"Return",
"if",
"this",
"version",
"is",
"the",
"published",
"version",
"of",
"a",
"layer"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L172-L176 |
koordinates/python-client | koordinates/layers.py | Layer.is_draft_version | def is_draft_version(self):
""" Return if this version is the draft version of a layer """
pub_ver = getattr(self, 'published_version', None)
latest_ver = getattr(self, 'latest_version', None)
this_ver = getattr(self, 'this_version', None)
return this_ver and latest_ver and (this... | python | def is_draft_version(self):
""" Return if this version is the draft version of a layer """
pub_ver = getattr(self, 'published_version', None)
latest_ver = getattr(self, 'latest_version', None)
this_ver = getattr(self, 'this_version', None)
return this_ver and latest_ver and (this... | [
"def",
"is_draft_version",
"(",
"self",
")",
":",
"pub_ver",
"=",
"getattr",
"(",
"self",
",",
"'published_version'",
",",
"None",
")",
"latest_ver",
"=",
"getattr",
"(",
"self",
",",
"'latest_version'",
",",
"None",
")",
"this_ver",
"=",
"getattr",
"(",
"... | Return if this version is the draft version of a layer | [
"Return",
"if",
"this",
"version",
"is",
"the",
"draft",
"version",
"of",
"a",
"layer"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L179-L184 |
koordinates/python-client | koordinates/layers.py | Layer.list_versions | def list_versions(self):
"""
Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
``.filter(data__source__revision=value)``. Specific values depend on the source type.
Use ``dat... | python | def list_versions(self):
"""
Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
``.filter(data__source__revision=value)``. Specific values depend on the source type.
Use ``dat... | [
"def",
"list_versions",
"(",
"self",
")",
":",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'multi'",
",",
"{",
"'layer_id'",
":",
"self",
".",
"id",
"}",
")",
"return",
"base",
".",
"Query",
"(",
"... | Filterable list of versions of a layer, always ordered newest to oldest.
If the version’s source supports revisions, you can get a specific revision using
``.filter(data__source__revision=value)``. Specific values depend on the source type.
Use ``data__source_revision__lt`` or ``data__source_re... | [
"Filterable",
"list",
"of",
"versions",
"of",
"a",
"layer",
"always",
"ordered",
"newest",
"to",
"oldest",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L187-L197 |
koordinates/python-client | koordinates/layers.py | Layer.get_version | def get_version(self, version_id, expand=[]):
"""
Get a specific version of this layer
"""
target_url = self._client.get_url('VERSION', 'GET', 'single', {'layer_id': self.id, 'version_id': version_id})
return self._manager._get(target_url, expand=expand) | python | def get_version(self, version_id, expand=[]):
"""
Get a specific version of this layer
"""
target_url = self._client.get_url('VERSION', 'GET', 'single', {'layer_id': self.id, 'version_id': version_id})
return self._manager._get(target_url, expand=expand) | [
"def",
"get_version",
"(",
"self",
",",
"version_id",
",",
"expand",
"=",
"[",
"]",
")",
":",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'single'",
",",
"{",
"'layer_id'",
":",
"self",
".",
"id",
... | Get a specific version of this layer | [
"Get",
"a",
"specific",
"version",
"of",
"this",
"layer"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L200-L205 |
koordinates/python-client | koordinates/layers.py | Layer.get_draft_version | def get_draft_version(self, expand=[]):
"""
Get the current draft version of this layer.
:raises NotFound: if there is no draft version.
"""
target_url = self._client.get_url('VERSION', 'GET', 'draft', {'layer_id': self.id})
return self._manager._get(target_url, expand=ex... | python | def get_draft_version(self, expand=[]):
"""
Get the current draft version of this layer.
:raises NotFound: if there is no draft version.
"""
target_url = self._client.get_url('VERSION', 'GET', 'draft', {'layer_id': self.id})
return self._manager._get(target_url, expand=ex... | [
"def",
"get_draft_version",
"(",
"self",
",",
"expand",
"=",
"[",
"]",
")",
":",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'GET'",
",",
"'draft'",
",",
"{",
"'layer_id'",
":",
"self",
".",
"id",
"}",
")",
"ret... | Get the current draft version of this layer.
:raises NotFound: if there is no draft version. | [
"Get",
"the",
"current",
"draft",
"version",
"of",
"this",
"layer",
".",
":",
"raises",
"NotFound",
":",
"if",
"there",
"is",
"no",
"draft",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L208-L214 |
koordinates/python-client | koordinates/layers.py | Layer.start_import | def start_import(self, version_id=None):
"""
Starts importing this draft layerversion (cancelling any running import), even
if the data object hasn’t changed from the previous version.
:raises Conflict: if this version is already published.
"""
if not version_id:
... | python | def start_import(self, version_id=None):
"""
Starts importing this draft layerversion (cancelling any running import), even
if the data object hasn’t changed from the previous version.
:raises Conflict: if this version is already published.
"""
if not version_id:
... | [
"def",
"start_import",
"(",
"self",
",",
"version_id",
"=",
"None",
")",
":",
"if",
"not",
"version_id",
":",
"version_id",
"=",
"self",
".",
"version",
".",
"id",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'POST'"... | Starts importing this draft layerversion (cancelling any running import), even
if the data object hasn’t changed from the previous version.
:raises Conflict: if this version is already published. | [
"Starts",
"importing",
"this",
"draft",
"layerversion",
"(",
"cancelling",
"any",
"running",
"import",
")",
"even",
"if",
"the",
"data",
"object",
"hasn’t",
"changed",
"from",
"the",
"previous",
"version",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L242-L254 |
koordinates/python-client | koordinates/layers.py | Layer.start_update | def start_update(self):
"""
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`.create_draft_version` followed by :py:meth:`koordinates.layers.Layer.start_import`.
:rtype: Layer
:return: the new version
:raises Conflict: if there... | python | def start_update(self):
"""
A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`.create_draft_version` followed by :py:meth:`koordinates.layers.Layer.start_import`.
:rtype: Layer
:return: the new version
:raises Conflict: if there... | [
"def",
"start_update",
"(",
"self",
")",
":",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'LAYER'",
",",
"'POST'",
",",
"'update'",
",",
"{",
"'layer_id'",
":",
"self",
".",
"id",
"}",
")",
"r",
"=",
"self",
".",
"_client",
".",
... | A shortcut to create a new version and start importing it.
Effectively the same as :py:meth:`.create_draft_version` followed by :py:meth:`koordinates.layers.Layer.start_import`.
:rtype: Layer
:return: the new version
:raises Conflict: if there is already a draft version for this layer. | [
"A",
"shortcut",
"to",
"create",
"a",
"new",
"version",
"and",
"start",
"importing",
"it",
".",
"Effectively",
"the",
"same",
"as",
":",
"py",
":",
"meth",
":",
".",
"create_draft_version",
"followed",
"by",
":",
"py",
":",
"meth",
":",
"koordinates",
".... | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L257-L268 |
koordinates/python-client | koordinates/layers.py | Layer.publish | def publish(self, version_id=None):
"""
Creates a publish task just for this version, which publishes as soon as any import is complete.
:return: the publish task
:rtype: Publish
:raises Conflict: If the version is already published, or already has a publish job.
"""
... | python | def publish(self, version_id=None):
"""
Creates a publish task just for this version, which publishes as soon as any import is complete.
:return: the publish task
:rtype: Publish
:raises Conflict: If the version is already published, or already has a publish job.
"""
... | [
"def",
"publish",
"(",
"self",
",",
"version_id",
"=",
"None",
")",
":",
"if",
"not",
"version_id",
":",
"version_id",
"=",
"self",
".",
"version",
".",
"id",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'POST'",
"... | Creates a publish task just for this version, which publishes as soon as any import is complete.
:return: the publish task
:rtype: Publish
:raises Conflict: If the version is already published, or already has a publish job. | [
"Creates",
"a",
"publish",
"task",
"just",
"for",
"this",
"version",
"which",
"publishes",
"as",
"soon",
"as",
"any",
"import",
"is",
"complete",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L271-L284 |
koordinates/python-client | koordinates/layers.py | Layer.save | def save(self, with_data=False):
"""
Edits this draft layerversion.
# If anything in the data object has changed, cancel any existing import and start a new one.
:param bool with_data: if ``True``, send the data object, which will start a new import and cancel
any existing o... | python | def save(self, with_data=False):
"""
Edits this draft layerversion.
# If anything in the data object has changed, cancel any existing import and start a new one.
:param bool with_data: if ``True``, send the data object, which will start a new import and cancel
any existing o... | [
"def",
"save",
"(",
"self",
",",
"with_data",
"=",
"False",
")",
":",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'PUT'",
",",
"'edit'",
",",
"{",
"'layer_id'",
":",
"self",
".",
"id",
",",
"'version_id'",
":",
... | Edits this draft layerversion.
# If anything in the data object has changed, cancel any existing import and start a new one.
:param bool with_data: if ``True``, send the data object, which will start a new import and cancel
any existing one. If ``False``, the data object will *not* be sent,... | [
"Edits",
"this",
"draft",
"layerversion",
".",
"#",
"If",
"anything",
"in",
"the",
"data",
"object",
"has",
"changed",
"cancel",
"any",
"existing",
"import",
"and",
"start",
"a",
"new",
"one",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L287-L298 |
koordinates/python-client | koordinates/layers.py | Layer.delete_version | def delete_version(self, version_id=None):
"""
Deletes this draft version (revert to published)
:raises NotAllowed: if this version is already published.
:raises Conflict: if this version is already deleted.
"""
if not version_id:
version_id = self.version.id... | python | def delete_version(self, version_id=None):
"""
Deletes this draft version (revert to published)
:raises NotAllowed: if this version is already published.
:raises Conflict: if this version is already deleted.
"""
if not version_id:
version_id = self.version.id... | [
"def",
"delete_version",
"(",
"self",
",",
"version_id",
"=",
"None",
")",
":",
"if",
"not",
"version_id",
":",
"version_id",
"=",
"self",
".",
"version",
".",
"id",
"target_url",
"=",
"self",
".",
"_client",
".",
"get_url",
"(",
"'VERSION'",
",",
"'DELE... | Deletes this draft version (revert to published)
:raises NotAllowed: if this version is already published.
:raises Conflict: if this version is already deleted. | [
"Deletes",
"this",
"draft",
"version",
"(",
"revert",
"to",
"published",
")"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/layers.py#L301-L313 |
koordinates/python-client | koordinates/catalog.py | CatalogManager._get_item_class | def _get_item_class(self, url):
""" Return the model class matching a URL """
if '/layers/' in url:
return Layer
elif '/tables/' in url:
return Table
elif '/sets/' in url:
return Set
# elif '/documents/' in url:
# return Document
... | python | def _get_item_class(self, url):
""" Return the model class matching a URL """
if '/layers/' in url:
return Layer
elif '/tables/' in url:
return Table
elif '/sets/' in url:
return Set
# elif '/documents/' in url:
# return Document
... | [
"def",
"_get_item_class",
"(",
"self",
",",
"url",
")",
":",
"if",
"'/layers/'",
"in",
"url",
":",
"return",
"Layer",
"elif",
"'/tables/'",
"in",
"url",
":",
"return",
"Table",
"elif",
"'/sets/'",
"in",
"url",
":",
"return",
"Set",
"# elif '/documents/' in u... | Return the model class matching a URL | [
"Return",
"the",
"model",
"class",
"matching",
"a",
"URL"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/catalog.py#L40-L51 |
michaelaye/pyciss | pyciss/solitons.py | get_year_since_resonance | def get_year_since_resonance(ringcube):
"Calculate the fraction of the year since moon swap."
t0 = dt(2006, 1, 21)
td = ringcube.imagetime - t0
return td.days / 365.25 | python | def get_year_since_resonance(ringcube):
"Calculate the fraction of the year since moon swap."
t0 = dt(2006, 1, 21)
td = ringcube.imagetime - t0
return td.days / 365.25 | [
"def",
"get_year_since_resonance",
"(",
"ringcube",
")",
":",
"t0",
"=",
"dt",
"(",
"2006",
",",
"1",
",",
"21",
")",
"td",
"=",
"ringcube",
".",
"imagetime",
"-",
"t0",
"return",
"td",
".",
"days",
"/",
"365.25"
] | Calculate the fraction of the year since moon swap. | [
"Calculate",
"the",
"fraction",
"of",
"the",
"year",
"since",
"moon",
"swap",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/solitons.py#L12-L16 |
michaelaye/pyciss | pyciss/solitons.py | create_polynoms | def create_polynoms():
"""Create and return poly1d objects.
Uses the parameters from Morgan to create poly1d objects for
calculations.
"""
fname = pr.resource_filename('pyciss', 'data/soliton_prediction_parameters.csv')
res_df = pd.read_csv(fname)
polys = {}
for resorder, row in zip('65... | python | def create_polynoms():
"""Create and return poly1d objects.
Uses the parameters from Morgan to create poly1d objects for
calculations.
"""
fname = pr.resource_filename('pyciss', 'data/soliton_prediction_parameters.csv')
res_df = pd.read_csv(fname)
polys = {}
for resorder, row in zip('65... | [
"def",
"create_polynoms",
"(",
")",
":",
"fname",
"=",
"pr",
".",
"resource_filename",
"(",
"'pyciss'",
",",
"'data/soliton_prediction_parameters.csv'",
")",
"res_df",
"=",
"pd",
".",
"read_csv",
"(",
"fname",
")",
"polys",
"=",
"{",
"}",
"for",
"resorder",
... | Create and return poly1d objects.
Uses the parameters from Morgan to create poly1d objects for
calculations. | [
"Create",
"and",
"return",
"poly1d",
"objects",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/solitons.py#L19-L32 |
michaelaye/pyciss | pyciss/solitons.py | check_for_soliton | def check_for_soliton(img_id):
"""Workhorse function.
Creates the polynom.
Calculates radius constraints from attributes in `ringcube` object.
Parameters
----------
ringcube : pyciss.ringcube.RingCube
A containter class for a ring-projected ISS image file.
Returns
-------
... | python | def check_for_soliton(img_id):
"""Workhorse function.
Creates the polynom.
Calculates radius constraints from attributes in `ringcube` object.
Parameters
----------
ringcube : pyciss.ringcube.RingCube
A containter class for a ring-projected ISS image file.
Returns
-------
... | [
"def",
"check_for_soliton",
"(",
"img_id",
")",
":",
"pm",
"=",
"io",
".",
"PathManager",
"(",
"img_id",
")",
"try",
":",
"ringcube",
"=",
"RingCube",
"(",
"pm",
".",
"cubepath",
")",
"except",
"FileNotFoundError",
":",
"ringcube",
"=",
"RingCube",
"(",
... | Workhorse function.
Creates the polynom.
Calculates radius constraints from attributes in `ringcube` object.
Parameters
----------
ringcube : pyciss.ringcube.RingCube
A containter class for a ring-projected ISS image file.
Returns
-------
dict
Dictionary with all solit... | [
"Workhorse",
"function",
"."
] | train | https://github.com/michaelaye/pyciss/blob/019256424466060babead7edab86736c881b0831/pyciss/solitons.py#L35-L66 |
koordinates/python-client | koordinates/client.py | Client.get_manager | def get_manager(self, model):
"""
Return the active manager for the given model.
:param model: Model class to look up the manager instance for.
:return: Manager instance for the model associated with this client.
"""
if isinstance(model, six.string_types):
# u... | python | def get_manager(self, model):
"""
Return the active manager for the given model.
:param model: Model class to look up the manager instance for.
:return: Manager instance for the model associated with this client.
"""
if isinstance(model, six.string_types):
# u... | [
"def",
"get_manager",
"(",
"self",
",",
"model",
")",
":",
"if",
"isinstance",
"(",
"model",
",",
"six",
".",
"string_types",
")",
":",
"# undocumented string lookup",
"for",
"k",
",",
"m",
"in",
"self",
".",
"_manager_map",
".",
"items",
"(",
")",
":",
... | Return the active manager for the given model.
:param model: Model class to look up the manager instance for.
:return: Manager instance for the model associated with this client. | [
"Return",
"the",
"active",
"manager",
"for",
"the",
"given",
"model",
".",
":",
"param",
"model",
":",
"Model",
"class",
"to",
"look",
"up",
"the",
"manager",
"instance",
"for",
".",
":",
"return",
":",
"Manager",
"instance",
"for",
"the",
"model",
"asso... | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/client.py#L102-L116 |
koordinates/python-client | koordinates/client.py | Client._assemble_headers | def _assemble_headers(self, method, user_headers=None):
"""
Takes the supplied headers and adds in any which
are defined at a client level and then returns
the result.
:param user_headers: a `dict` containing headers defined at the
request level, opt... | python | def _assemble_headers(self, method, user_headers=None):
"""
Takes the supplied headers and adds in any which
are defined at a client level and then returns
the result.
:param user_headers: a `dict` containing headers defined at the
request level, opt... | [
"def",
"_assemble_headers",
"(",
"self",
",",
"method",
",",
"user_headers",
"=",
"None",
")",
":",
"headers",
"=",
"copy",
".",
"deepcopy",
"(",
"user_headers",
"or",
"{",
"}",
")",
"if",
"method",
"not",
"in",
"(",
"'GET'",
",",
"'HEAD'",
")",
":",
... | Takes the supplied headers and adds in any which
are defined at a client level and then returns
the result.
:param user_headers: a `dict` containing headers defined at the
request level, optional.
:return: a `dict` instance | [
"Takes",
"the",
"supplied",
"headers",
"and",
"adds",
"in",
"any",
"which",
"are",
"defined",
"at",
"a",
"client",
"level",
"and",
"then",
"returns",
"the",
"result",
"."
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/client.py#L119-L136 |
koordinates/python-client | koordinates/client.py | Client.reverse_url | def reverse_url(self, datatype, url, verb='GET', urltype='single', api_version=None):
"""
Extracts parameters from a populated URL
:param datatype: a string identifying the data the url accesses.
:param url: the fully-qualified URL to extract parameters from.
:param verb: the HT... | python | def reverse_url(self, datatype, url, verb='GET', urltype='single', api_version=None):
"""
Extracts parameters from a populated URL
:param datatype: a string identifying the data the url accesses.
:param url: the fully-qualified URL to extract parameters from.
:param verb: the HT... | [
"def",
"reverse_url",
"(",
"self",
",",
"datatype",
",",
"url",
",",
"verb",
"=",
"'GET'",
",",
"urltype",
"=",
"'single'",
",",
"api_version",
"=",
"None",
")",
":",
"api_version",
"=",
"api_version",
"or",
"'v1'",
"templates",
"=",
"getattr",
"(",
"sel... | Extracts parameters from a populated URL
:param datatype: a string identifying the data the url accesses.
:param url: the fully-qualified URL to extract parameters from.
:param verb: the HTTP verb needed for use with the url.
:param urltype: an adjective used to the nature of the reques... | [
"Extracts",
"parameters",
"from",
"a",
"populated",
"URL"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/client.py#L185-L210 |
koordinates/python-client | koordinates/client.py | Client.get_url | def get_url(self, datatype, verb, urltype, params={}, api_host=None, api_version=None):
"""Returns a fully formed url
:param datatype: a string identifying the data the url will access.
:param verb: the HTTP verb needed for use with the url.
:param urltype: an adjective used to the natu... | python | def get_url(self, datatype, verb, urltype, params={}, api_host=None, api_version=None):
"""Returns a fully formed url
:param datatype: a string identifying the data the url will access.
:param verb: the HTTP verb needed for use with the url.
:param urltype: an adjective used to the natu... | [
"def",
"get_url",
"(",
"self",
",",
"datatype",
",",
"verb",
",",
"urltype",
",",
"params",
"=",
"{",
"}",
",",
"api_host",
"=",
"None",
",",
"api_version",
"=",
"None",
")",
":",
"api_version",
"=",
"api_version",
"or",
"'v1'",
"api_host",
"=",
"api_h... | Returns a fully formed url
:param datatype: a string identifying the data the url will access.
:param verb: the HTTP verb needed for use with the url.
:param urltype: an adjective used to the nature of the request.
:param \*\*params: substitution variables for the URL.
:return: ... | [
"Returns",
"a",
"fully",
"formed",
"url"
] | train | https://github.com/koordinates/python-client/blob/f3dc7cd164f5a9499b2454cd1d4516e9d4b3c252/koordinates/client.py#L212-L231 |
Unidata/siphon | siphon/cdmr/xarray_support.py | CDMRemoteStore.open_store_variable | def open_store_variable(self, name, var):
"""Turn CDMRemote variable into something like a numpy.ndarray."""
data = indexing.LazilyOuterIndexedArray(CDMArrayWrapper(name, self))
return Variable(var.dimensions, data, {a: getattr(var, a) for a in var.ncattrs()}) | python | def open_store_variable(self, name, var):
"""Turn CDMRemote variable into something like a numpy.ndarray."""
data = indexing.LazilyOuterIndexedArray(CDMArrayWrapper(name, self))
return Variable(var.dimensions, data, {a: getattr(var, a) for a in var.ncattrs()}) | [
"def",
"open_store_variable",
"(",
"self",
",",
"name",
",",
"var",
")",
":",
"data",
"=",
"indexing",
".",
"LazilyOuterIndexedArray",
"(",
"CDMArrayWrapper",
"(",
"name",
",",
"self",
")",
")",
"return",
"Variable",
"(",
"var",
".",
"dimensions",
",",
"da... | Turn CDMRemote variable into something like a numpy.ndarray. | [
"Turn",
"CDMRemote",
"variable",
"into",
"something",
"like",
"a",
"numpy",
".",
"ndarray",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/xarray_support.py#L52-L55 |
Unidata/siphon | siphon/cdmr/xarray_support.py | CDMRemoteStore.get_attrs | def get_attrs(self):
"""Get the global attributes from underlying data set."""
return FrozenOrderedDict((a, getattr(self.ds, a)) for a in self.ds.ncattrs()) | python | def get_attrs(self):
"""Get the global attributes from underlying data set."""
return FrozenOrderedDict((a, getattr(self.ds, a)) for a in self.ds.ncattrs()) | [
"def",
"get_attrs",
"(",
"self",
")",
":",
"return",
"FrozenOrderedDict",
"(",
"(",
"a",
",",
"getattr",
"(",
"self",
".",
"ds",
",",
"a",
")",
")",
"for",
"a",
"in",
"self",
".",
"ds",
".",
"ncattrs",
"(",
")",
")"
] | Get the global attributes from underlying data set. | [
"Get",
"the",
"global",
"attributes",
"from",
"underlying",
"data",
"set",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/xarray_support.py#L62-L64 |
Unidata/siphon | siphon/cdmr/xarray_support.py | CDMRemoteStore.get_dimensions | def get_dimensions(self):
"""Get the dimensions from underlying data set."""
return FrozenOrderedDict((k, len(v)) for k, v in self.ds.dimensions.items()) | python | def get_dimensions(self):
"""Get the dimensions from underlying data set."""
return FrozenOrderedDict((k, len(v)) for k, v in self.ds.dimensions.items()) | [
"def",
"get_dimensions",
"(",
"self",
")",
":",
"return",
"FrozenOrderedDict",
"(",
"(",
"k",
",",
"len",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
"ds",
".",
"dimensions",
".",
"items",
"(",
")",
")"
] | Get the dimensions from underlying data set. | [
"Get",
"the",
"dimensions",
"from",
"underlying",
"data",
"set",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/xarray_support.py#L66-L68 |
Unidata/siphon | siphon/catalog.py | _find_base_tds_url | def _find_base_tds_url(catalog_url):
"""Identify the base URL of the THREDDS server from the catalog URL.
Will retain URL scheme, host, port and username/password when present.
"""
url_components = urlparse(catalog_url)
if url_components.path:
return catalog_url.split(url_components.path)[0... | python | def _find_base_tds_url(catalog_url):
"""Identify the base URL of the THREDDS server from the catalog URL.
Will retain URL scheme, host, port and username/password when present.
"""
url_components = urlparse(catalog_url)
if url_components.path:
return catalog_url.split(url_components.path)[0... | [
"def",
"_find_base_tds_url",
"(",
"catalog_url",
")",
":",
"url_components",
"=",
"urlparse",
"(",
"catalog_url",
")",
"if",
"url_components",
".",
"path",
":",
"return",
"catalog_url",
".",
"split",
"(",
"url_components",
".",
"path",
")",
"[",
"0",
"]",
"e... | Identify the base URL of the THREDDS server from the catalog URL.
Will retain URL scheme, host, port and username/password when present. | [
"Identify",
"the",
"base",
"URL",
"of",
"the",
"THREDDS",
"server",
"from",
"the",
"catalog",
"URL",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L790-L799 |
Unidata/siphon | siphon/catalog.py | DatasetCollection.filter_time_nearest | def filter_time_nearest(self, time, regex=None):
"""Filter keys for an item closest to the desired time.
Loops over all keys in the collection and uses `regex` to extract and build
`datetime`s. The collection of `datetime`s is compared to `start` and the value that
has a `datetime` clos... | python | def filter_time_nearest(self, time, regex=None):
"""Filter keys for an item closest to the desired time.
Loops over all keys in the collection and uses `regex` to extract and build
`datetime`s. The collection of `datetime`s is compared to `start` and the value that
has a `datetime` clos... | [
"def",
"filter_time_nearest",
"(",
"self",
",",
"time",
",",
"regex",
"=",
"None",
")",
":",
"return",
"min",
"(",
"self",
".",
"_get_datasets_with_times",
"(",
"regex",
")",
",",
"key",
"=",
"lambda",
"i",
":",
"abs",
"(",
"(",
"i",
"[",
"0",
"]",
... | Filter keys for an item closest to the desired time.
Loops over all keys in the collection and uses `regex` to extract and build
`datetime`s. The collection of `datetime`s is compared to `start` and the value that
has a `datetime` closest to that requested is returned.If none of the keys in the... | [
"Filter",
"keys",
"for",
"an",
"item",
"closest",
"to",
"the",
"desired",
"time",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L74-L100 |
Unidata/siphon | siphon/catalog.py | DatasetCollection.filter_time_range | def filter_time_range(self, start, end, regex=None):
"""Filter keys for all items within the desired time range.
Loops over all keys in the collection and uses `regex` to extract and build
`datetime`s. From the collection of `datetime`s, all values within `start` and `end`
(inclusive) a... | python | def filter_time_range(self, start, end, regex=None):
"""Filter keys for all items within the desired time range.
Loops over all keys in the collection and uses `regex` to extract and build
`datetime`s. From the collection of `datetime`s, all values within `start` and `end`
(inclusive) a... | [
"def",
"filter_time_range",
"(",
"self",
",",
"start",
",",
"end",
",",
"regex",
"=",
"None",
")",
":",
"return",
"[",
"item",
"[",
"-",
"1",
"]",
"for",
"item",
"in",
"self",
".",
"_get_datasets_with_times",
"(",
"regex",
")",
"if",
"start",
"<=",
"... | Filter keys for all items within the desired time range.
Loops over all keys in the collection and uses `regex` to extract and build
`datetime`s. From the collection of `datetime`s, all values within `start` and `end`
(inclusive) are returned. If none of the keys in the collection match the reg... | [
"Filter",
"keys",
"for",
"all",
"items",
"within",
"the",
"desired",
"time",
"range",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L102-L129 |
Unidata/siphon | siphon/catalog.py | CaseInsensitiveDict.pop | def pop(self, key, *args, **kwargs):
"""Remove and return the value associated with case-insensitive ``key``."""
return super(CaseInsensitiveDict, self).pop(CaseInsensitiveStr(key)) | python | def pop(self, key, *args, **kwargs):
"""Remove and return the value associated with case-insensitive ``key``."""
return super(CaseInsensitiveDict, self).pop(CaseInsensitiveStr(key)) | [
"def",
"pop",
"(",
"self",
",",
"key",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"CaseInsensitiveDict",
",",
"self",
")",
".",
"pop",
"(",
"CaseInsensitiveStr",
"(",
"key",
")",
")"
] | Remove and return the value associated with case-insensitive ``key``. | [
"Remove",
"and",
"return",
"the",
"value",
"associated",
"with",
"case",
"-",
"insensitive",
"key",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L210-L212 |
Unidata/siphon | siphon/catalog.py | CaseInsensitiveDict._keys_to_lower | def _keys_to_lower(self):
"""Convert key set to lowercase."""
for k in list(self.keys()):
val = super(CaseInsensitiveDict, self).__getitem__(k)
super(CaseInsensitiveDict, self).__delitem__(k)
self.__setitem__(CaseInsensitiveStr(k), val) | python | def _keys_to_lower(self):
"""Convert key set to lowercase."""
for k in list(self.keys()):
val = super(CaseInsensitiveDict, self).__getitem__(k)
super(CaseInsensitiveDict, self).__delitem__(k)
self.__setitem__(CaseInsensitiveStr(k), val) | [
"def",
"_keys_to_lower",
"(",
"self",
")",
":",
"for",
"k",
"in",
"list",
"(",
"self",
".",
"keys",
"(",
")",
")",
":",
"val",
"=",
"super",
"(",
"CaseInsensitiveDict",
",",
"self",
")",
".",
"__getitem__",
"(",
"k",
")",
"super",
"(",
"CaseInsensiti... | Convert key set to lowercase. | [
"Convert",
"key",
"set",
"to",
"lowercase",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L214-L219 |
Unidata/siphon | siphon/catalog.py | Dataset.resolve_url | def resolve_url(self, catalog_url):
"""Resolve the url of the dataset when reading latest.xml.
Parameters
----------
catalog_url : str
The catalog url to be resolved
"""
if catalog_url != '':
resolver_base = catalog_url.split('catalog.xml')[0]
... | python | def resolve_url(self, catalog_url):
"""Resolve the url of the dataset when reading latest.xml.
Parameters
----------
catalog_url : str
The catalog url to be resolved
"""
if catalog_url != '':
resolver_base = catalog_url.split('catalog.xml')[0]
... | [
"def",
"resolve_url",
"(",
"self",
",",
"catalog_url",
")",
":",
"if",
"catalog_url",
"!=",
"''",
":",
"resolver_base",
"=",
"catalog_url",
".",
"split",
"(",
"'catalog.xml'",
")",
"[",
"0",
"]",
"resolver_url",
"=",
"resolver_base",
"+",
"self",
".",
"url... | Resolve the url of the dataset when reading latest.xml.
Parameters
----------
catalog_url : str
The catalog url to be resolved | [
"Resolve",
"the",
"url",
"of",
"the",
"dataset",
"when",
"reading",
"latest",
".",
"xml",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L477-L509 |
Unidata/siphon | siphon/catalog.py | Dataset.make_access_urls | def make_access_urls(self, catalog_url, all_services, metadata=None):
"""Make fully qualified urls for the access methods enabled on the dataset.
Parameters
----------
catalog_url : str
The top level server url
all_services : List[SimpleService]
list of :... | python | def make_access_urls(self, catalog_url, all_services, metadata=None):
"""Make fully qualified urls for the access methods enabled on the dataset.
Parameters
----------
catalog_url : str
The top level server url
all_services : List[SimpleService]
list of :... | [
"def",
"make_access_urls",
"(",
"self",
",",
"catalog_url",
",",
"all_services",
",",
"metadata",
"=",
"None",
")",
":",
"all_service_dict",
"=",
"CaseInsensitiveDict",
"(",
"{",
"}",
")",
"for",
"service",
"in",
"all_services",
":",
"all_service_dict",
"[",
"... | Make fully qualified urls for the access methods enabled on the dataset.
Parameters
----------
catalog_url : str
The top level server url
all_services : List[SimpleService]
list of :class:`SimpleService` objects associated with the dataset
metadata : dict... | [
"Make",
"fully",
"qualified",
"urls",
"for",
"the",
"access",
"methods",
"enabled",
"on",
"the",
"dataset",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L511-L560 |
Unidata/siphon | siphon/catalog.py | Dataset.add_access_element_info | def add_access_element_info(self, access_element):
"""Create an access method from a catalog element."""
service_name = access_element.attrib['serviceName']
url_path = access_element.attrib['urlPath']
self.access_element_info[service_name] = url_path | python | def add_access_element_info(self, access_element):
"""Create an access method from a catalog element."""
service_name = access_element.attrib['serviceName']
url_path = access_element.attrib['urlPath']
self.access_element_info[service_name] = url_path | [
"def",
"add_access_element_info",
"(",
"self",
",",
"access_element",
")",
":",
"service_name",
"=",
"access_element",
".",
"attrib",
"[",
"'serviceName'",
"]",
"url_path",
"=",
"access_element",
".",
"attrib",
"[",
"'urlPath'",
"]",
"self",
".",
"access_element_i... | Create an access method from a catalog element. | [
"Create",
"an",
"access",
"method",
"from",
"a",
"catalog",
"element",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L562-L566 |
Unidata/siphon | siphon/catalog.py | Dataset.download | def download(self, filename=None):
"""Download the dataset to a local file.
Parameters
----------
filename : str, optional
The full path to which the dataset will be saved
"""
if filename is None:
filename = self.name
with self.remote_ope... | python | def download(self, filename=None):
"""Download the dataset to a local file.
Parameters
----------
filename : str, optional
The full path to which the dataset will be saved
"""
if filename is None:
filename = self.name
with self.remote_ope... | [
"def",
"download",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"self",
".",
"name",
"with",
"self",
".",
"remote_open",
"(",
")",
"as",
"infile",
":",
"with",
"open",
"(",
"filename",
","... | Download the dataset to a local file.
Parameters
----------
filename : str, optional
The full path to which the dataset will be saved | [
"Download",
"the",
"dataset",
"to",
"a",
"local",
"file",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L568-L581 |
Unidata/siphon | siphon/catalog.py | Dataset.remote_access | def remote_access(self, service=None, use_xarray=None):
"""Access the remote dataset.
Open the remote dataset and get a netCDF4-compatible `Dataset` object providing
index-based subsetting capabilities.
Parameters
----------
service : str, optional
The name ... | python | def remote_access(self, service=None, use_xarray=None):
"""Access the remote dataset.
Open the remote dataset and get a netCDF4-compatible `Dataset` object providing
index-based subsetting capabilities.
Parameters
----------
service : str, optional
The name ... | [
"def",
"remote_access",
"(",
"self",
",",
"service",
"=",
"None",
",",
"use_xarray",
"=",
"None",
")",
":",
"if",
"service",
"is",
"None",
":",
"service",
"=",
"'CdmRemote'",
"if",
"'CdmRemote'",
"in",
"self",
".",
"access_urls",
"else",
"'OPENDAP'",
"if",... | Access the remote dataset.
Open the remote dataset and get a netCDF4-compatible `Dataset` object providing
index-based subsetting capabilities.
Parameters
----------
service : str, optional
The name of the service to use for access to the dataset, either
... | [
"Access",
"the",
"remote",
"dataset",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L596-L620 |
Unidata/siphon | siphon/catalog.py | Dataset.subset | def subset(self, service=None):
"""Subset the dataset.
Open the remote dataset and get a client for talking to ``service``.
Parameters
----------
service : str, optional
The name of the service for subsetting the dataset. Defaults to 'NetcdfSubset'
or 'N... | python | def subset(self, service=None):
"""Subset the dataset.
Open the remote dataset and get a client for talking to ``service``.
Parameters
----------
service : str, optional
The name of the service for subsetting the dataset. Defaults to 'NetcdfSubset'
or 'N... | [
"def",
"subset",
"(",
"self",
",",
"service",
"=",
"None",
")",
":",
"if",
"service",
"is",
"None",
":",
"for",
"serviceName",
"in",
"self",
".",
"ncssServiceNames",
":",
"if",
"serviceName",
"in",
"self",
".",
"access_urls",
":",
"service",
"=",
"servic... | Subset the dataset.
Open the remote dataset and get a client for talking to ``service``.
Parameters
----------
service : str, optional
The name of the service for subsetting the dataset. Defaults to 'NetcdfSubset'
or 'NetcdfServer', in that order, depending on t... | [
"Subset",
"the",
"dataset",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L622-L650 |
Unidata/siphon | siphon/catalog.py | Dataset.access_with_service | def access_with_service(self, service, use_xarray=None):
"""Access the dataset using a particular service.
Return an Python object capable of communicating with the server using the particular
service. For instance, for 'HTTPServer' this is a file-like object capable of
HTTP communicati... | python | def access_with_service(self, service, use_xarray=None):
"""Access the dataset using a particular service.
Return an Python object capable of communicating with the server using the particular
service. For instance, for 'HTTPServer' this is a file-like object capable of
HTTP communicati... | [
"def",
"access_with_service",
"(",
"self",
",",
"service",
",",
"use_xarray",
"=",
"None",
")",
":",
"service",
"=",
"CaseInsensitiveStr",
"(",
"service",
")",
"if",
"service",
"==",
"'CdmRemote'",
":",
"if",
"use_xarray",
":",
"from",
".",
"cdmr",
".",
"x... | Access the dataset using a particular service.
Return an Python object capable of communicating with the server using the particular
service. For instance, for 'HTTPServer' this is a file-like object capable of
HTTP communication; for OPENDAP this is a netCDF4 dataset.
Parameters
... | [
"Access",
"the",
"dataset",
"using",
"a",
"particular",
"service",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/catalog.py#L652-L705 |
Unidata/siphon | siphon/_tools.py | get_wind_components | def get_wind_components(speed, wdir):
r"""Calculate the U, V wind vector components from the speed and direction.
Parameters
----------
speed : array_like
The wind speed (magnitude)
wdir : array_like
The wind direction, specified as the direction from which the wind is
blowi... | python | def get_wind_components(speed, wdir):
r"""Calculate the U, V wind vector components from the speed and direction.
Parameters
----------
speed : array_like
The wind speed (magnitude)
wdir : array_like
The wind direction, specified as the direction from which the wind is
blowi... | [
"def",
"get_wind_components",
"(",
"speed",
",",
"wdir",
")",
":",
"u",
"=",
"-",
"speed",
"*",
"np",
".",
"sin",
"(",
"wdir",
")",
"v",
"=",
"-",
"speed",
"*",
"np",
".",
"cos",
"(",
"wdir",
")",
"return",
"u",
",",
"v"
] | r"""Calculate the U, V wind vector components from the speed and direction.
Parameters
----------
speed : array_like
The wind speed (magnitude)
wdir : array_like
The wind direction, specified as the direction from which the wind is
blowing, with 0 being North.
Returns
-... | [
"r",
"Calculate",
"the",
"U",
"V",
"wind",
"vector",
"components",
"from",
"the",
"speed",
"and",
"direction",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/_tools.py#L9-L29 |
Unidata/siphon | siphon/cdmr/cdmremotefeature.py | CDMRemoteFeature._get_metadata | def _get_metadata(self):
"""Get header information and store as metadata for the endpoint."""
self.metadata = self.fetch_header()
self.variables = {g.name for g in self.metadata.grids} | python | def _get_metadata(self):
"""Get header information and store as metadata for the endpoint."""
self.metadata = self.fetch_header()
self.variables = {g.name for g in self.metadata.grids} | [
"def",
"_get_metadata",
"(",
"self",
")",
":",
"self",
".",
"metadata",
"=",
"self",
".",
"fetch_header",
"(",
")",
"self",
".",
"variables",
"=",
"{",
"g",
".",
"name",
"for",
"g",
"in",
"self",
".",
"metadata",
".",
"grids",
"}"
] | Get header information and store as metadata for the endpoint. | [
"Get",
"header",
"information",
"and",
"store",
"as",
"metadata",
"for",
"the",
"endpoint",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/cdmremotefeature.py#L20-L23 |
Unidata/siphon | siphon/cdmr/cdmremotefeature.py | CDMRemoteFeature.fetch_header | def fetch_header(self):
"""Make a header request to the endpoint."""
query = self.query().add_query_parameter(req='header')
return self._parse_messages(self.get_query(query).content)[0] | python | def fetch_header(self):
"""Make a header request to the endpoint."""
query = self.query().add_query_parameter(req='header')
return self._parse_messages(self.get_query(query).content)[0] | [
"def",
"fetch_header",
"(",
"self",
")",
":",
"query",
"=",
"self",
".",
"query",
"(",
")",
".",
"add_query_parameter",
"(",
"req",
"=",
"'header'",
")",
"return",
"self",
".",
"_parse_messages",
"(",
"self",
".",
"get_query",
"(",
"query",
")",
".",
"... | Make a header request to the endpoint. | [
"Make",
"a",
"header",
"request",
"to",
"the",
"endpoint",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/cdmremotefeature.py#L25-L28 |
Unidata/siphon | siphon/cdmr/cdmremotefeature.py | CDMRemoteFeature.fetch_feature_type | def fetch_feature_type(self):
"""Request the featureType from the endpoint."""
query = self.query().add_query_parameter(req='featureType')
return self.get_query(query).content | python | def fetch_feature_type(self):
"""Request the featureType from the endpoint."""
query = self.query().add_query_parameter(req='featureType')
return self.get_query(query).content | [
"def",
"fetch_feature_type",
"(",
"self",
")",
":",
"query",
"=",
"self",
".",
"query",
"(",
")",
".",
"add_query_parameter",
"(",
"req",
"=",
"'featureType'",
")",
"return",
"self",
".",
"get_query",
"(",
"query",
")",
".",
"content"
] | Request the featureType from the endpoint. | [
"Request",
"the",
"featureType",
"from",
"the",
"endpoint",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/cdmremotefeature.py#L30-L33 |
Unidata/siphon | siphon/cdmr/cdmremotefeature.py | CDMRemoteFeature.fetch_coords | def fetch_coords(self, query):
"""Pull down coordinate data from the endpoint."""
q = query.add_query_parameter(req='coord')
return self._parse_messages(self.get_query(q).content) | python | def fetch_coords(self, query):
"""Pull down coordinate data from the endpoint."""
q = query.add_query_parameter(req='coord')
return self._parse_messages(self.get_query(q).content) | [
"def",
"fetch_coords",
"(",
"self",
",",
"query",
")",
":",
"q",
"=",
"query",
".",
"add_query_parameter",
"(",
"req",
"=",
"'coord'",
")",
"return",
"self",
".",
"_parse_messages",
"(",
"self",
".",
"get_query",
"(",
"q",
")",
".",
"content",
")"
] | Pull down coordinate data from the endpoint. | [
"Pull",
"down",
"coordinate",
"data",
"from",
"the",
"endpoint",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/cdmremotefeature.py#L35-L38 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir.request_data | def request_data(cls, time, site_id, derived=False):
"""Retreive IGRA version 2 data for one station.
Parameters
--------
site_id : str
11-character IGRA2 station identifier.
time : datetime
The date and time of the desired observation. If list of two tim... | python | def request_data(cls, time, site_id, derived=False):
"""Retreive IGRA version 2 data for one station.
Parameters
--------
site_id : str
11-character IGRA2 station identifier.
time : datetime
The date and time of the desired observation. If list of two tim... | [
"def",
"request_data",
"(",
"cls",
",",
"time",
",",
"site_id",
",",
"derived",
"=",
"False",
")",
":",
"igra2",
"=",
"cls",
"(",
")",
"# Set parameters for data query",
"if",
"derived",
":",
"igra2",
".",
"ftpsite",
"=",
"igra2",
".",
"ftpsite",
"+",
"'... | Retreive IGRA version 2 data for one station.
Parameters
--------
site_id : str
11-character IGRA2 station identifier.
time : datetime
The date and time of the desired observation. If list of two times is given,
dataframes for all dates within the two ... | [
"Retreive",
"IGRA",
"version",
"2",
"data",
"for",
"one",
"station",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L35-L72 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir._get_data | def _get_data(self):
"""Process the IGRA2 text file for observations at site_id matching time.
Return:
-------
:class: `pandas.DataFrame` containing the body data.
:class: `pandas.DataFrame` containing the header data.
"""
# Split the list of times into b... | python | def _get_data(self):
"""Process the IGRA2 text file for observations at site_id matching time.
Return:
-------
:class: `pandas.DataFrame` containing the body data.
:class: `pandas.DataFrame` containing the header data.
"""
# Split the list of times into b... | [
"def",
"_get_data",
"(",
"self",
")",
":",
"# Split the list of times into begin and end dates. If only",
"# one date is supplied, set both begin and end dates equal to that date.",
"body",
",",
"header",
",",
"dates_long",
",",
"dates",
"=",
"self",
".",
"_get_data_raw",
"(",
... | Process the IGRA2 text file for observations at site_id matching time.
Return:
-------
:class: `pandas.DataFrame` containing the body data.
:class: `pandas.DataFrame` containing the header data. | [
"Process",
"the",
"IGRA2",
"text",
"file",
"for",
"observations",
"at",
"site_id",
"matching",
"time",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L74-L97 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir._get_data_raw | def _get_data_raw(self):
"""Download observations matching the time range.
Returns a tuple with a string for the body, string for the headers,
and a list of dates.
"""
# Import need to be here so we can monkeypatch urlopen for testing and avoid
# downloading live data fo... | python | def _get_data_raw(self):
"""Download observations matching the time range.
Returns a tuple with a string for the body, string for the headers,
and a list of dates.
"""
# Import need to be here so we can monkeypatch urlopen for testing and avoid
# downloading live data fo... | [
"def",
"_get_data_raw",
"(",
"self",
")",
":",
"# Import need to be here so we can monkeypatch urlopen for testing and avoid",
"# downloading live data for testing",
"try",
":",
"from",
"urllib",
".",
"request",
"import",
"urlopen",
"except",
"ImportError",
":",
"from",
"urll... | Download observations matching the time range.
Returns a tuple with a string for the body, string for the headers,
and a list of dates. | [
"Download",
"observations",
"matching",
"the",
"time",
"range",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L99-L119 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir._select_date_range | def _select_date_range(self, lines):
"""Identify lines containing headers within the range begin_date to end_date.
Parameters
-----
lines: list
list of lines from the IGRA2 data file.
"""
headers = []
num_lev = []
dates = []
# Get in... | python | def _select_date_range(self, lines):
"""Identify lines containing headers within the range begin_date to end_date.
Parameters
-----
lines: list
list of lines from the IGRA2 data file.
"""
headers = []
num_lev = []
dates = []
# Get in... | [
"def",
"_select_date_range",
"(",
"self",
",",
"lines",
")",
":",
"headers",
"=",
"[",
"]",
"num_lev",
"=",
"[",
"]",
"dates",
"=",
"[",
"]",
"# Get indices of headers, and make a list of dates and num_lev",
"for",
"idx",
",",
"line",
"in",
"enumerate",
"(",
"... | Identify lines containing headers within the range begin_date to end_date.
Parameters
-----
lines: list
list of lines from the IGRA2 data file. | [
"Identify",
"lines",
"containing",
"headers",
"within",
"the",
"range",
"begin_date",
"to",
"end_date",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L121-L174 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir._get_fwf_params | def _get_fwf_params(self):
"""Produce a dictionary with names, colspecs, and dtype for IGRA2 data.
Returns a dict with entries 'body' and 'header'.
"""
def _cdec(power=1):
"""Make a function to convert string 'value*10^power' to float."""
def _cdec_power(val):
... | python | def _get_fwf_params(self):
"""Produce a dictionary with names, colspecs, and dtype for IGRA2 data.
Returns a dict with entries 'body' and 'header'.
"""
def _cdec(power=1):
"""Make a function to convert string 'value*10^power' to float."""
def _cdec_power(val):
... | [
"def",
"_get_fwf_params",
"(",
"self",
")",
":",
"def",
"_cdec",
"(",
"power",
"=",
"1",
")",
":",
"\"\"\"Make a function to convert string 'value*10^power' to float.\"\"\"",
"def",
"_cdec_power",
"(",
"val",
")",
":",
"if",
"val",
"in",
"[",
"'-9999'",
",",
"'-... | Produce a dictionary with names, colspecs, and dtype for IGRA2 data.
Returns a dict with entries 'body' and 'header'. | [
"Produce",
"a",
"dictionary",
"with",
"names",
"colspecs",
"and",
"dtype",
"for",
"IGRA2",
"data",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L176-L356 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir._clean_body_df | def _clean_body_df(self, df):
"""Format the dataframe, remove empty rows, and add units attribute."""
if self.suffix == '-drvd.txt':
df = df.dropna(subset=('temperature', 'reported_relative_humidity',
'u_wind', 'v_wind'), how='all').reset_index(drop=True)
... | python | def _clean_body_df(self, df):
"""Format the dataframe, remove empty rows, and add units attribute."""
if self.suffix == '-drvd.txt':
df = df.dropna(subset=('temperature', 'reported_relative_humidity',
'u_wind', 'v_wind'), how='all').reset_index(drop=True)
... | [
"def",
"_clean_body_df",
"(",
"self",
",",
"df",
")",
":",
"if",
"self",
".",
"suffix",
"==",
"'-drvd.txt'",
":",
"df",
"=",
"df",
".",
"dropna",
"(",
"subset",
"=",
"(",
"'temperature'",
",",
"'reported_relative_humidity'",
",",
"'u_wind'",
",",
"'v_wind'... | Format the dataframe, remove empty rows, and add units attribute. | [
"Format",
"the",
"dataframe",
"remove",
"empty",
"rows",
"and",
"add",
"units",
"attribute",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L358-L407 |
Unidata/siphon | siphon/simplewebservice/igra2.py | IGRAUpperAir._clean_header_df | def _clean_header_df(self, df):
"""Format the header dataframe and add units."""
if self.suffix == '-drvd.txt':
df.units = {'release_time': 'second',
'precipitable_water': 'millimeter',
'inv_pressure': 'hPa',
'inv_height... | python | def _clean_header_df(self, df):
"""Format the header dataframe and add units."""
if self.suffix == '-drvd.txt':
df.units = {'release_time': 'second',
'precipitable_water': 'millimeter',
'inv_pressure': 'hPa',
'inv_height... | [
"def",
"_clean_header_df",
"(",
"self",
",",
"df",
")",
":",
"if",
"self",
".",
"suffix",
"==",
"'-drvd.txt'",
":",
"df",
".",
"units",
"=",
"{",
"'release_time'",
":",
"'second'",
",",
"'precipitable_water'",
":",
"'millimeter'",
",",
"'inv_pressure'",
":",... | Format the header dataframe and add units. | [
"Format",
"the",
"header",
"dataframe",
"and",
"add",
"units",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/igra2.py#L409-L439 |
Unidata/siphon | siphon/simplewebservice/ndbc.py | NDBC.realtime_observations | def realtime_observations(cls, buoy, data_type='txt'):
"""Retrieve the realtime buoy data from NDBC.
Parameters
----------
buoy : str
Name of buoy
data_type : str
Type of data requested, must be one of
'txt' standard meteorological data
... | python | def realtime_observations(cls, buoy, data_type='txt'):
"""Retrieve the realtime buoy data from NDBC.
Parameters
----------
buoy : str
Name of buoy
data_type : str
Type of data requested, must be one of
'txt' standard meteorological data
... | [
"def",
"realtime_observations",
"(",
"cls",
",",
"buoy",
",",
"data_type",
"=",
"'txt'",
")",
":",
"endpoint",
"=",
"cls",
"(",
")",
"parsers",
"=",
"{",
"'txt'",
":",
"endpoint",
".",
"_parse_met",
",",
"'drift'",
":",
"endpoint",
".",
"_parse_drift",
"... | Retrieve the realtime buoy data from NDBC.
Parameters
----------
buoy : str
Name of buoy
data_type : str
Type of data requested, must be one of
'txt' standard meteorological data
'drift' meteorological data from drifting buoys and limited ... | [
"Retrieve",
"the",
"realtime",
"buoy",
"data",
"from",
"NDBC",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/ndbc.py#L26-L67 |
Unidata/siphon | siphon/simplewebservice/ndbc.py | NDBC._parse_met | def _parse_met(content):
"""Parse standard meteorological data from NDBC buoys.
Parameters
----------
content : str
Data to parse
Returns
-------
:class:`pandas.DataFrame` containing the data
"""
col_names = ['year', 'month', 'da... | python | def _parse_met(content):
"""Parse standard meteorological data from NDBC buoys.
Parameters
----------
content : str
Data to parse
Returns
-------
:class:`pandas.DataFrame` containing the data
"""
col_names = ['year', 'month', 'da... | [
"def",
"_parse_met",
"(",
"content",
")",
":",
"col_names",
"=",
"[",
"'year'",
",",
"'month'",
",",
"'day'",
",",
"'hour'",
",",
"'minute'",
",",
"'wind_direction'",
",",
"'wind_speed'",
",",
"'wind_gust'",
",",
"'wave_height'",
",",
"'dominant_wave_period'",
... | Parse standard meteorological data from NDBC buoys.
Parameters
----------
content : str
Data to parse
Returns
-------
:class:`pandas.DataFrame` containing the data | [
"Parse",
"standard",
"meteorological",
"data",
"from",
"NDBC",
"buoys",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/ndbc.py#L70-L111 |
Unidata/siphon | siphon/simplewebservice/ndbc.py | NDBC._parse_supl | def _parse_supl(content):
"""Parse supplemental measurements data.
Parameters
----------
content : str
Data to parse
Returns
-------
:class:`pandas.DataFrame` containing the data
"""
col_names = ['year', 'month', 'day', 'hour', '... | python | def _parse_supl(content):
"""Parse supplemental measurements data.
Parameters
----------
content : str
Data to parse
Returns
-------
:class:`pandas.DataFrame` containing the data
"""
col_names = ['year', 'month', 'day', 'hour', '... | [
"def",
"_parse_supl",
"(",
"content",
")",
":",
"col_names",
"=",
"[",
"'year'",
",",
"'month'",
",",
"'day'",
",",
"'hour'",
",",
"'minute'",
",",
"'hourly_low_pressure'",
",",
"'hourly_low_pressure_time'",
",",
"'hourly_high_wind'",
",",
"'hourly_high_wind_directi... | Parse supplemental measurements data.
Parameters
----------
content : str
Data to parse
Returns
-------
:class:`pandas.DataFrame` containing the data | [
"Parse",
"supplemental",
"measurements",
"data",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/ndbc.py#L369-L414 |
Unidata/siphon | siphon/simplewebservice/ndbc.py | NDBC._check_if_url_valid | def _check_if_url_valid(url):
"""Check if a url is valid (returns 200) or not.
Parameters
----------
url : str
URL to check
Returns
-------
bool if url is valid
"""
r = requests.head(url)
if r.status_code == 200:
... | python | def _check_if_url_valid(url):
"""Check if a url is valid (returns 200) or not.
Parameters
----------
url : str
URL to check
Returns
-------
bool if url is valid
"""
r = requests.head(url)
if r.status_code == 200:
... | [
"def",
"_check_if_url_valid",
"(",
"url",
")",
":",
"r",
"=",
"requests",
".",
"head",
"(",
"url",
")",
"if",
"r",
".",
"status_code",
"==",
"200",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | Check if a url is valid (returns 200) or not.
Parameters
----------
url : str
URL to check
Returns
-------
bool if url is valid | [
"Check",
"if",
"a",
"url",
"is",
"valid",
"(",
"returns",
"200",
")",
"or",
"not",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/ndbc.py#L462-L479 |
Unidata/siphon | siphon/simplewebservice/ndbc.py | NDBC.buoy_data_types | def buoy_data_types(cls, buoy):
"""Determine which types of data are available for a given buoy.
Parameters
----------
buoy : str
Buoy name
Returns
-------
dict of valid file extensions and their descriptions
"""
endpoint = cls()... | python | def buoy_data_types(cls, buoy):
"""Determine which types of data are available for a given buoy.
Parameters
----------
buoy : str
Buoy name
Returns
-------
dict of valid file extensions and their descriptions
"""
endpoint = cls()... | [
"def",
"buoy_data_types",
"(",
"cls",
",",
"buoy",
")",
":",
"endpoint",
"=",
"cls",
"(",
")",
"file_types",
"=",
"{",
"'txt'",
":",
"'standard meteorological data'",
",",
"'drift'",
":",
"'meteorological data from drifting buoys and limited moored'",
"'buoy data mainly... | Determine which types of data are available for a given buoy.
Parameters
----------
buoy : str
Buoy name
Returns
-------
dict of valid file extensions and their descriptions | [
"Determine",
"which",
"types",
"of",
"data",
"are",
"available",
"for",
"a",
"given",
"buoy",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/ndbc.py#L482-L518 |
Unidata/siphon | siphon/simplewebservice/ndbc.py | NDBC.raw_buoy_data | def raw_buoy_data(cls, buoy, data_type='txt'):
"""Retrieve the raw buoy data contents from NDBC.
Parameters
----------
buoy : str
Name of buoy
data_type : str
Type of data requested, must be one of
'txt' standard meteorological data
... | python | def raw_buoy_data(cls, buoy, data_type='txt'):
"""Retrieve the raw buoy data contents from NDBC.
Parameters
----------
buoy : str
Name of buoy
data_type : str
Type of data requested, must be one of
'txt' standard meteorological data
... | [
"def",
"raw_buoy_data",
"(",
"cls",
",",
"buoy",
",",
"data_type",
"=",
"'txt'",
")",
":",
"endpoint",
"=",
"cls",
"(",
")",
"resp",
"=",
"endpoint",
".",
"get_path",
"(",
"'data/realtime2/{}.{}'",
".",
"format",
"(",
"buoy",
",",
"data_type",
")",
")",
... | Retrieve the raw buoy data contents from NDBC.
Parameters
----------
buoy : str
Name of buoy
data_type : str
Type of data requested, must be one of
'txt' standard meteorological data
'drift' meteorological data from drifting buoys and lim... | [
"Retrieve",
"the",
"raw",
"buoy",
"data",
"contents",
"from",
"NDBC",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/ndbc.py#L521-L556 |
Unidata/siphon | siphon/http_util.py | HTTPSessionManager.create_session | def create_session(self):
"""Create a new HTTP session with our user-agent set.
Returns
-------
session : requests.Session
The created session
See Also
--------
urlopen, set_session_options
"""
ret = requests.Session()
ret.he... | python | def create_session(self):
"""Create a new HTTP session with our user-agent set.
Returns
-------
session : requests.Session
The created session
See Also
--------
urlopen, set_session_options
"""
ret = requests.Session()
ret.he... | [
"def",
"create_session",
"(",
"self",
")",
":",
"ret",
"=",
"requests",
".",
"Session",
"(",
")",
"ret",
".",
"headers",
"[",
"'User-Agent'",
"]",
"=",
"self",
".",
"user_agent",
"for",
"k",
",",
"v",
"in",
"self",
".",
"options",
".",
"items",
"(",
... | Create a new HTTP session with our user-agent set.
Returns
-------
session : requests.Session
The created session
See Also
--------
urlopen, set_session_options | [
"Create",
"a",
"new",
"HTTP",
"session",
"with",
"our",
"user",
"-",
"agent",
"set",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L71-L88 |
Unidata/siphon | siphon/http_util.py | HTTPSessionManager.urlopen | def urlopen(self, url, **kwargs):
"""GET a file-like object for a URL using HTTP.
This is a thin wrapper around :meth:`requests.Session.get` that returns a file-like
object wrapped around the resulting content.
Parameters
----------
url : str
The URL to requ... | python | def urlopen(self, url, **kwargs):
"""GET a file-like object for a URL using HTTP.
This is a thin wrapper around :meth:`requests.Session.get` that returns a file-like
object wrapped around the resulting content.
Parameters
----------
url : str
The URL to requ... | [
"def",
"urlopen",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"BytesIO",
"(",
"self",
".",
"create_session",
"(",
")",
".",
"get",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
".",
"content",
")"
] | GET a file-like object for a URL using HTTP.
This is a thin wrapper around :meth:`requests.Session.get` that returns a file-like
object wrapped around the resulting content.
Parameters
----------
url : str
The URL to request
kwargs : arbitrary keyword argum... | [
"GET",
"a",
"file",
"-",
"like",
"object",
"for",
"a",
"URL",
"using",
"HTTP",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L90-L114 |
Unidata/siphon | siphon/http_util.py | DataQuery.lonlat_box | def lonlat_box(self, west, east, south, north):
"""Add a latitude/longitude bounding box to the query.
This adds a request for a spatial bounding box, bounded by ('north', 'south')
for latitude and ('east', 'west') for the longitude. This modifies the query
in-place, but returns `self` ... | python | def lonlat_box(self, west, east, south, north):
"""Add a latitude/longitude bounding box to the query.
This adds a request for a spatial bounding box, bounded by ('north', 'south')
for latitude and ('east', 'west') for the longitude. This modifies the query
in-place, but returns `self` ... | [
"def",
"lonlat_box",
"(",
"self",
",",
"west",
",",
"east",
",",
"south",
",",
"north",
")",
":",
"self",
".",
"_set_query",
"(",
"self",
".",
"spatial_query",
",",
"west",
"=",
"west",
",",
"east",
"=",
"east",
",",
"south",
"=",
"south",
",",
"no... | Add a latitude/longitude bounding box to the query.
This adds a request for a spatial bounding box, bounded by ('north', 'south')
for latitude and ('east', 'west') for the longitude. This modifies the query
in-place, but returns `self` so that multiple queries can be chained together
on... | [
"Add",
"a",
"latitude",
"/",
"longitude",
"bounding",
"box",
"to",
"the",
"query",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L197-L226 |
Unidata/siphon | siphon/http_util.py | DataQuery.lonlat_point | def lonlat_point(self, lon, lat):
"""Add a latitude/longitude point to the query.
This adds a request for a (`lon`, `lat`) point. This modifies the query
in-place, but returns `self` so that multiple queries can be chained together on
one line.
This replaces any existing spatia... | python | def lonlat_point(self, lon, lat):
"""Add a latitude/longitude point to the query.
This adds a request for a (`lon`, `lat`) point. This modifies the query
in-place, but returns `self` so that multiple queries can be chained together on
one line.
This replaces any existing spatia... | [
"def",
"lonlat_point",
"(",
"self",
",",
"lon",
",",
"lat",
")",
":",
"self",
".",
"_set_query",
"(",
"self",
".",
"spatial_query",
",",
"longitude",
"=",
"lon",
",",
"latitude",
"=",
"lat",
")",
"return",
"self"
] | Add a latitude/longitude point to the query.
This adds a request for a (`lon`, `lat`) point. This modifies the query
in-place, but returns `self` so that multiple queries can be chained together on
one line.
This replaces any existing spatial queries that have been set.
Parame... | [
"Add",
"a",
"latitude",
"/",
"longitude",
"point",
"to",
"the",
"query",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L228-L251 |
Unidata/siphon | siphon/http_util.py | DataQuery.time | def time(self, time):
"""Add a request for a specific time to the query.
This modifies the query in-place, but returns `self` so that multiple queries
can be chained together on one line.
This replaces any existing temporal queries that have been set.
Parameters
------... | python | def time(self, time):
"""Add a request for a specific time to the query.
This modifies the query in-place, but returns `self` so that multiple queries
can be chained together on one line.
This replaces any existing temporal queries that have been set.
Parameters
------... | [
"def",
"time",
"(",
"self",
",",
"time",
")",
":",
"self",
".",
"_set_query",
"(",
"self",
".",
"time_query",
",",
"time",
"=",
"self",
".",
"_format_time",
"(",
"time",
")",
")",
"return",
"self"
] | Add a request for a specific time to the query.
This modifies the query in-place, but returns `self` so that multiple queries
can be chained together on one line.
This replaces any existing temporal queries that have been set.
Parameters
----------
time : datetime.date... | [
"Add",
"a",
"request",
"for",
"a",
"specific",
"time",
"to",
"the",
"query",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L277-L297 |
Unidata/siphon | siphon/http_util.py | DataQuery.time_range | def time_range(self, start, end):
"""Add a request for a time range to the query.
This modifies the query in-place, but returns `self` so that multiple queries
can be chained together on one line.
This replaces any existing temporal queries that have been set.
Parameters
... | python | def time_range(self, start, end):
"""Add a request for a time range to the query.
This modifies the query in-place, but returns `self` so that multiple queries
can be chained together on one line.
This replaces any existing temporal queries that have been set.
Parameters
... | [
"def",
"time_range",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"self",
".",
"_set_query",
"(",
"self",
".",
"time_query",
",",
"time_start",
"=",
"self",
".",
"_format_time",
"(",
"start",
")",
",",
"time_end",
"=",
"self",
".",
"_format_time",
... | Add a request for a time range to the query.
This modifies the query in-place, but returns `self` so that multiple queries
can be chained together on one line.
This replaces any existing temporal queries that have been set.
Parameters
----------
start : datetime.dateti... | [
"Add",
"a",
"request",
"for",
"a",
"time",
"range",
"to",
"the",
"query",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L299-L322 |
Unidata/siphon | siphon/http_util.py | HTTPEndPoint.get_query | def get_query(self, query):
"""Make a GET request, including a query, to the endpoint.
The path of the request is to the base URL assigned to the endpoint.
Parameters
----------
query : DataQuery
The query to pass when making the request
Returns
---... | python | def get_query(self, query):
"""Make a GET request, including a query, to the endpoint.
The path of the request is to the base URL assigned to the endpoint.
Parameters
----------
query : DataQuery
The query to pass when making the request
Returns
---... | [
"def",
"get_query",
"(",
"self",
",",
"query",
")",
":",
"url",
"=",
"self",
".",
"_base",
"[",
":",
"-",
"1",
"]",
"if",
"self",
".",
"_base",
"[",
"-",
"1",
"]",
"==",
"'/'",
"else",
"self",
".",
"_base",
"return",
"self",
".",
"get",
"(",
... | Make a GET request, including a query, to the endpoint.
The path of the request is to the base URL assigned to the endpoint.
Parameters
----------
query : DataQuery
The query to pass when making the request
Returns
-------
resp : requests.Response
... | [
"Make",
"a",
"GET",
"request",
"including",
"a",
"query",
"to",
"the",
"endpoint",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L381-L402 |
Unidata/siphon | siphon/http_util.py | HTTPEndPoint.get_path | def get_path(self, path, query=None):
"""Make a GET request, optionally including a query, to a relative path.
The path of the request includes a path on top of the base URL
assigned to the endpoint.
Parameters
----------
path : str
The path to request, rela... | python | def get_path(self, path, query=None):
"""Make a GET request, optionally including a query, to a relative path.
The path of the request includes a path on top of the base URL
assigned to the endpoint.
Parameters
----------
path : str
The path to request, rela... | [
"def",
"get_path",
"(",
"self",
",",
"path",
",",
"query",
"=",
"None",
")",
":",
"return",
"self",
".",
"get",
"(",
"self",
".",
"url_path",
"(",
"path",
")",
",",
"query",
")"
] | Make a GET request, optionally including a query, to a relative path.
The path of the request includes a path on top of the base URL
assigned to the endpoint.
Parameters
----------
path : str
The path to request, relative to the endpoint
query : DataQuery, o... | [
"Make",
"a",
"GET",
"request",
"optionally",
"including",
"a",
"query",
"to",
"a",
"relative",
"path",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L426-L449 |
Unidata/siphon | siphon/http_util.py | HTTPEndPoint.get | def get(self, path, params=None):
"""Make a GET request, optionally including a parameters, to a path.
The path of the request is the full URL.
Parameters
----------
path : str
The URL to request
params : DataQuery, optional
The query to pass whe... | python | def get(self, path, params=None):
"""Make a GET request, optionally including a parameters, to a path.
The path of the request is the full URL.
Parameters
----------
path : str
The URL to request
params : DataQuery, optional
The query to pass whe... | [
"def",
"get",
"(",
"self",
",",
"path",
",",
"params",
"=",
"None",
")",
":",
"resp",
"=",
"self",
".",
"_session",
".",
"get",
"(",
"path",
",",
"params",
"=",
"params",
")",
"if",
"resp",
".",
"status_code",
"!=",
"200",
":",
"if",
"resp",
".",... | Make a GET request, optionally including a parameters, to a path.
The path of the request is the full URL.
Parameters
----------
path : str
The URL to request
params : DataQuery, optional
The query to pass when making the request
Returns
... | [
"Make",
"a",
"GET",
"request",
"optionally",
"including",
"a",
"parameters",
"to",
"a",
"path",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/http_util.py#L451-L488 |
Unidata/siphon | siphon/cdmr/dataset.py | Group.path | def path(self):
"""Return the full path to the Group, including any parent Groups."""
# If root, return '/'
if self.dataset is self:
return ''
else: # Otherwise recurse
return self.dataset.path + '/' + self.name | python | def path(self):
"""Return the full path to the Group, including any parent Groups."""
# If root, return '/'
if self.dataset is self:
return ''
else: # Otherwise recurse
return self.dataset.path + '/' + self.name | [
"def",
"path",
"(",
"self",
")",
":",
"# If root, return '/'",
"if",
"self",
".",
"dataset",
"is",
"self",
":",
"return",
"''",
"else",
":",
"# Otherwise recurse",
"return",
"self",
".",
"dataset",
".",
"path",
"+",
"'/'",
"+",
"self",
".",
"name"
] | Return the full path to the Group, including any parent Groups. | [
"Return",
"the",
"full",
"path",
"to",
"the",
"Group",
"including",
"any",
"parent",
"Groups",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/dataset.py#L53-L59 |
Unidata/siphon | siphon/cdmr/dataset.py | Group.load_from_stream | def load_from_stream(self, group):
"""Load a Group from an NCStream object."""
self._unpack_attrs(group.atts)
self.name = group.name
for dim in group.dims:
new_dim = Dimension(self, dim.name)
self.dimensions[dim.name] = new_dim
new_dim.load_from_strea... | python | def load_from_stream(self, group):
"""Load a Group from an NCStream object."""
self._unpack_attrs(group.atts)
self.name = group.name
for dim in group.dims:
new_dim = Dimension(self, dim.name)
self.dimensions[dim.name] = new_dim
new_dim.load_from_strea... | [
"def",
"load_from_stream",
"(",
"self",
",",
"group",
")",
":",
"self",
".",
"_unpack_attrs",
"(",
"group",
".",
"atts",
")",
"self",
".",
"name",
"=",
"group",
".",
"name",
"for",
"dim",
"in",
"group",
".",
"dims",
":",
"new_dim",
"=",
"Dimension",
... | Load a Group from an NCStream object. | [
"Load",
"a",
"Group",
"from",
"an",
"NCStream",
"object",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/dataset.py#L61-L89 |
Unidata/siphon | siphon/cdmr/dataset.py | Variable.load_from_stream | def load_from_stream(self, var):
"""Populate the Variable from an NCStream object."""
dims = []
for d in var.shape:
dim = Dimension(None, d.name)
dim.load_from_stream(d)
dims.append(dim)
self.dimensions = tuple(dim.name for dim in dims)
self.s... | python | def load_from_stream(self, var):
"""Populate the Variable from an NCStream object."""
dims = []
for d in var.shape:
dim = Dimension(None, d.name)
dim.load_from_stream(d)
dims.append(dim)
self.dimensions = tuple(dim.name for dim in dims)
self.s... | [
"def",
"load_from_stream",
"(",
"self",
",",
"var",
")",
":",
"dims",
"=",
"[",
"]",
"for",
"d",
"in",
"var",
".",
"shape",
":",
"dim",
"=",
"Dimension",
"(",
"None",
",",
"d",
".",
"name",
")",
"dim",
".",
"load_from_stream",
"(",
"d",
")",
"dim... | Populate the Variable from an NCStream object. | [
"Populate",
"the",
"Variable",
"from",
"an",
"NCStream",
"object",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/dataset.py#L288-L310 |
Unidata/siphon | siphon/cdmr/dataset.py | Dimension.load_from_stream | def load_from_stream(self, dim):
"""Load from an NCStream object."""
self.unlimited = dim.isUnlimited
self.private = dim.isPrivate
self.vlen = dim.isVlen
if not self.vlen:
self.size = dim.length | python | def load_from_stream(self, dim):
"""Load from an NCStream object."""
self.unlimited = dim.isUnlimited
self.private = dim.isPrivate
self.vlen = dim.isVlen
if not self.vlen:
self.size = dim.length | [
"def",
"load_from_stream",
"(",
"self",
",",
"dim",
")",
":",
"self",
".",
"unlimited",
"=",
"dim",
".",
"isUnlimited",
"self",
".",
"private",
"=",
"dim",
".",
"isPrivate",
"self",
".",
"vlen",
"=",
"dim",
".",
"isVlen",
"if",
"not",
"self",
".",
"v... | Load from an NCStream object. | [
"Load",
"from",
"an",
"NCStream",
"object",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/dataset.py#L349-L355 |
Unidata/siphon | siphon/cdmr/coveragedataset.py | CoverageDataset._read_header | def _read_header(self):
"""Get the needed header information to initialize dataset."""
self._header = self.cdmrf.fetch_header()
self.load_from_stream(self._header) | python | def _read_header(self):
"""Get the needed header information to initialize dataset."""
self._header = self.cdmrf.fetch_header()
self.load_from_stream(self._header) | [
"def",
"_read_header",
"(",
"self",
")",
":",
"self",
".",
"_header",
"=",
"self",
".",
"cdmrf",
".",
"fetch_header",
"(",
")",
"self",
".",
"load_from_stream",
"(",
"self",
".",
"_header",
")"
] | Get the needed header information to initialize dataset. | [
"Get",
"the",
"needed",
"header",
"information",
"to",
"initialize",
"dataset",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/coveragedataset.py#L45-L48 |
Unidata/siphon | siphon/cdmr/coveragedataset.py | CoverageDataset.load_from_stream | def load_from_stream(self, header):
"""Populate the CoverageDataset from the protobuf information."""
self._unpack_attrs(header.atts)
self.name = header.name
self.lon_lat_domain = header.latlonRect
self.proj_domain = header.projRect
self.date_range = header.dateRange
... | python | def load_from_stream(self, header):
"""Populate the CoverageDataset from the protobuf information."""
self._unpack_attrs(header.atts)
self.name = header.name
self.lon_lat_domain = header.latlonRect
self.proj_domain = header.projRect
self.date_range = header.dateRange
... | [
"def",
"load_from_stream",
"(",
"self",
",",
"header",
")",
":",
"self",
".",
"_unpack_attrs",
"(",
"header",
".",
"atts",
")",
"self",
".",
"name",
"=",
"header",
".",
"name",
"self",
".",
"lon_lat_domain",
"=",
"header",
".",
"latlonRect",
"self",
".",... | Populate the CoverageDataset from the protobuf information. | [
"Populate",
"the",
"CoverageDataset",
"from",
"the",
"protobuf",
"information",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/cdmr/coveragedataset.py#L50-L69 |
Unidata/siphon | siphon/simplewebservice/iastate.py | IAStateUpperAir.request_data | def request_data(cls, time, site_id, **kwargs):
"""Retrieve upper air observations from Iowa State's archive for a single station.
Parameters
----------
time : datetime
The date and time of the desired observation.
site_id : str
The three letter ICAO ide... | python | def request_data(cls, time, site_id, **kwargs):
"""Retrieve upper air observations from Iowa State's archive for a single station.
Parameters
----------
time : datetime
The date and time of the desired observation.
site_id : str
The three letter ICAO ide... | [
"def",
"request_data",
"(",
"cls",
",",
"time",
",",
"site_id",
",",
"*",
"*",
"kwargs",
")",
":",
"endpoint",
"=",
"cls",
"(",
")",
"df",
"=",
"endpoint",
".",
"_get_data",
"(",
"time",
",",
"site_id",
",",
"None",
",",
"*",
"*",
"kwargs",
")",
... | Retrieve upper air observations from Iowa State's archive for a single station.
Parameters
----------
time : datetime
The date and time of the desired observation.
site_id : str
The three letter ICAO identifier of the station for which data should be
... | [
"Retrieve",
"upper",
"air",
"observations",
"from",
"Iowa",
"State",
"s",
"archive",
"for",
"a",
"single",
"station",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/iastate.py#L28-L50 |
Unidata/siphon | siphon/simplewebservice/iastate.py | IAStateUpperAir.request_all_data | def request_all_data(cls, time, pressure=None, **kwargs):
"""Retrieve upper air observations from Iowa State's archive for all stations.
Parameters
----------
time : datetime
The date and time of the desired observation.
pressure : float, optional
The ma... | python | def request_all_data(cls, time, pressure=None, **kwargs):
"""Retrieve upper air observations from Iowa State's archive for all stations.
Parameters
----------
time : datetime
The date and time of the desired observation.
pressure : float, optional
The ma... | [
"def",
"request_all_data",
"(",
"cls",
",",
"time",
",",
"pressure",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"endpoint",
"=",
"cls",
"(",
")",
"df",
"=",
"endpoint",
".",
"_get_data",
"(",
"time",
",",
"None",
",",
"pressure",
",",
"*",
"*"... | Retrieve upper air observations from Iowa State's archive for all stations.
Parameters
----------
time : datetime
The date and time of the desired observation.
pressure : float, optional
The mandatory pressure level at which to request data (in hPa). If none is ... | [
"Retrieve",
"upper",
"air",
"observations",
"from",
"Iowa",
"State",
"s",
"archive",
"for",
"all",
"stations",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/iastate.py#L53-L75 |
Unidata/siphon | siphon/simplewebservice/iastate.py | IAStateUpperAir._get_data | def _get_data(self, time, site_id, pressure=None):
"""Download data from Iowa State's upper air archive.
Parameters
----------
time : datetime
Date and time for which data should be downloaded
site_id : str
Site id for which data should be downloaded
... | python | def _get_data(self, time, site_id, pressure=None):
"""Download data from Iowa State's upper air archive.
Parameters
----------
time : datetime
Date and time for which data should be downloaded
site_id : str
Site id for which data should be downloaded
... | [
"def",
"_get_data",
"(",
"self",
",",
"time",
",",
"site_id",
",",
"pressure",
"=",
"None",
")",
":",
"json_data",
"=",
"self",
".",
"_get_data_raw",
"(",
"time",
",",
"site_id",
",",
"pressure",
")",
"data",
"=",
"{",
"}",
"for",
"profile",
"in",
"j... | Download data from Iowa State's upper air archive.
Parameters
----------
time : datetime
Date and time for which data should be downloaded
site_id : str
Site id for which data should be downloaded
pressure : float, optional
Mandatory pressure ... | [
"Download",
"data",
"from",
"Iowa",
"State",
"s",
"upper",
"air",
"archive",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/iastate.py#L77-L139 |
Unidata/siphon | siphon/simplewebservice/iastate.py | IAStateUpperAir._get_data_raw | def _get_data_raw(self, time, site_id, pressure=None):
r"""Download data from the Iowa State's upper air archive.
Parameters
----------
time : datetime
Date and time for which data should be downloaded
site_id : str
Site id for which data should be downlo... | python | def _get_data_raw(self, time, site_id, pressure=None):
r"""Download data from the Iowa State's upper air archive.
Parameters
----------
time : datetime
Date and time for which data should be downloaded
site_id : str
Site id for which data should be downlo... | [
"def",
"_get_data_raw",
"(",
"self",
",",
"time",
",",
"site_id",
",",
"pressure",
"=",
"None",
")",
":",
"query",
"=",
"{",
"'ts'",
":",
"time",
".",
"strftime",
"(",
"'%Y%m%d%H00'",
")",
"}",
"if",
"site_id",
"is",
"not",
"None",
":",
"query",
"[",... | r"""Download data from the Iowa State's upper air archive.
Parameters
----------
time : datetime
Date and time for which data should be downloaded
site_id : str
Site id for which data should be downloaded
pressure : float, optional
Mandatory p... | [
"r",
"Download",
"data",
"from",
"the",
"Iowa",
"State",
"s",
"upper",
"air",
"archive",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/iastate.py#L141-L178 |
Unidata/siphon | siphon/radarserver.py | parse_station_table | def parse_station_table(root):
"""Parse station list XML file."""
stations = [parse_xml_station(elem) for elem in root.findall('station')]
return {st.id: st for st in stations} | python | def parse_station_table(root):
"""Parse station list XML file."""
stations = [parse_xml_station(elem) for elem in root.findall('station')]
return {st.id: st for st in stations} | [
"def",
"parse_station_table",
"(",
"root",
")",
":",
"stations",
"=",
"[",
"parse_xml_station",
"(",
"elem",
")",
"for",
"elem",
"in",
"root",
".",
"findall",
"(",
"'station'",
")",
"]",
"return",
"{",
"st",
".",
"id",
":",
"st",
"for",
"st",
"in",
"... | Parse station list XML file. | [
"Parse",
"station",
"list",
"XML",
"file",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/radarserver.py#L217-L220 |
Unidata/siphon | siphon/radarserver.py | parse_xml_station | def parse_xml_station(elem):
"""Create a :class:`Station` instance from an XML tag."""
stid = elem.attrib['id']
name = elem.find('name').text
lat = float(elem.find('latitude').text)
lon = float(elem.find('longitude').text)
elev = float(elem.find('elevation').text)
return Station(id=stid, ele... | python | def parse_xml_station(elem):
"""Create a :class:`Station` instance from an XML tag."""
stid = elem.attrib['id']
name = elem.find('name').text
lat = float(elem.find('latitude').text)
lon = float(elem.find('longitude').text)
elev = float(elem.find('elevation').text)
return Station(id=stid, ele... | [
"def",
"parse_xml_station",
"(",
"elem",
")",
":",
"stid",
"=",
"elem",
".",
"attrib",
"[",
"'id'",
"]",
"name",
"=",
"elem",
".",
"find",
"(",
"'name'",
")",
".",
"text",
"lat",
"=",
"float",
"(",
"elem",
".",
"find",
"(",
"'latitude'",
")",
".",
... | Create a :class:`Station` instance from an XML tag. | [
"Create",
"a",
":",
"class",
":",
"Station",
"instance",
"from",
"an",
"XML",
"tag",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/radarserver.py#L223-L230 |
Unidata/siphon | siphon/radarserver.py | RadarQuery.stations | def stations(self, *stns):
"""Specify one or more stations for the query.
This modifies the query in-place, but returns `self` so that multiple
queries can be chained together on one line.
This replaces any existing spatial queries that have been set.
Parameters
------... | python | def stations(self, *stns):
"""Specify one or more stations for the query.
This modifies the query in-place, but returns `self` so that multiple
queries can be chained together on one line.
This replaces any existing spatial queries that have been set.
Parameters
------... | [
"def",
"stations",
"(",
"self",
",",
"*",
"stns",
")",
":",
"self",
".",
"_set_query",
"(",
"self",
".",
"spatial_query",
",",
"stn",
"=",
"stns",
")",
"return",
"self"
] | Specify one or more stations for the query.
This modifies the query in-place, but returns `self` so that multiple
queries can be chained together on one line.
This replaces any existing spatial queries that have been set.
Parameters
----------
stns : one or more string... | [
"Specify",
"one",
"or",
"more",
"stations",
"for",
"the",
"query",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/radarserver.py#L23-L43 |
Unidata/siphon | siphon/radarserver.py | RadarServer.validate_query | def validate_query(self, query):
"""Validate a query.
Determines whether `query` is well-formed. This includes checking for all
required parameters, as well as checking parameters for valid values.
Parameters
----------
query : RadarQuery
The query to valida... | python | def validate_query(self, query):
"""Validate a query.
Determines whether `query` is well-formed. This includes checking for all
required parameters, as well as checking parameters for valid values.
Parameters
----------
query : RadarQuery
The query to valida... | [
"def",
"validate_query",
"(",
"self",
",",
"query",
")",
":",
"valid",
"=",
"True",
"# Make sure all stations are in the table",
"if",
"'stn'",
"in",
"query",
".",
"spatial_query",
":",
"valid",
"=",
"valid",
"and",
"all",
"(",
"stid",
"in",
"self",
".",
"st... | Validate a query.
Determines whether `query` is well-formed. This includes checking for all
required parameters, as well as checking parameters for valid values.
Parameters
----------
query : RadarQuery
The query to validate
Returns
-------
... | [
"Validate",
"a",
"query",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/radarserver.py#L101-L127 |
Unidata/siphon | siphon/radarserver.py | RadarServer.get_catalog | def get_catalog(self, query):
"""Fetch a parsed THREDDS catalog from the radar server.
Requests a catalog of radar data files data from the radar server given the
parameters in `query` and returns a :class:`~siphon.catalog.TDSCatalog` instance.
Parameters
----------
que... | python | def get_catalog(self, query):
"""Fetch a parsed THREDDS catalog from the radar server.
Requests a catalog of radar data files data from the radar server given the
parameters in `query` and returns a :class:`~siphon.catalog.TDSCatalog` instance.
Parameters
----------
que... | [
"def",
"get_catalog",
"(",
"self",
",",
"query",
")",
":",
"# TODO: Refactor TDSCatalog so we don't need two requests, or to do URL munging",
"try",
":",
"url",
"=",
"self",
".",
"_base",
"[",
":",
"-",
"1",
"]",
"if",
"self",
".",
"_base",
"[",
"-",
"1",
"]",... | Fetch a parsed THREDDS catalog from the radar server.
Requests a catalog of radar data files data from the radar server given the
parameters in `query` and returns a :class:`~siphon.catalog.TDSCatalog` instance.
Parameters
----------
query : RadarQuery
The parameter... | [
"Fetch",
"a",
"parsed",
"THREDDS",
"catalog",
"from",
"the",
"radar",
"server",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/radarserver.py#L129-L161 |
Unidata/siphon | siphon/simplewebservice/acis.py | acis_request | def acis_request(method, params):
"""Request data from the ACIS Web Services API.
Makes a request from the ACIS Web Services API for data
based on a given method (StnMeta,StnData,MultiStnData,GridData,General)
and parameters string. Information about the parameters can be obtained at:
http://www.rc... | python | def acis_request(method, params):
"""Request data from the ACIS Web Services API.
Makes a request from the ACIS Web Services API for data
based on a given method (StnMeta,StnData,MultiStnData,GridData,General)
and parameters string. Information about the parameters can be obtained at:
http://www.rc... | [
"def",
"acis_request",
"(",
"method",
",",
"params",
")",
":",
"base_url",
"=",
"'http://data.rcc-acis.org/'",
"# ACIS Web API URL",
"timeout",
"=",
"300",
"if",
"method",
"==",
"'MultiStnData'",
"else",
"60",
"try",
":",
"response",
"=",
"session_manager",
".",
... | Request data from the ACIS Web Services API.
Makes a request from the ACIS Web Services API for data
based on a given method (StnMeta,StnData,MultiStnData,GridData,General)
and parameters string. Information about the parameters can be obtained at:
http://www.rcc-acis.org/docs_webservices.html
If ... | [
"Request",
"data",
"from",
"the",
"ACIS",
"Web",
"Services",
"API",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/simplewebservice/acis.py#L11-L63 |
Unidata/siphon | siphon/ncss.py | parse_xml | def parse_xml(data, handle_units):
"""Parse XML data returned by NCSS."""
root = ET.fromstring(data)
return squish(parse_xml_dataset(root, handle_units)) | python | def parse_xml(data, handle_units):
"""Parse XML data returned by NCSS."""
root = ET.fromstring(data)
return squish(parse_xml_dataset(root, handle_units)) | [
"def",
"parse_xml",
"(",
"data",
",",
"handle_units",
")",
":",
"root",
"=",
"ET",
".",
"fromstring",
"(",
"data",
")",
"return",
"squish",
"(",
"parse_xml_dataset",
"(",
"root",
",",
"handle_units",
")",
")"
] | Parse XML data returned by NCSS. | [
"Parse",
"XML",
"data",
"returned",
"by",
"NCSS",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/ncss.py#L315-L318 |
Unidata/siphon | siphon/ncss.py | parse_xml_point | def parse_xml_point(elem):
"""Parse an XML point tag."""
point = {}
units = {}
for data in elem.findall('data'):
name = data.get('name')
unit = data.get('units')
point[name] = float(data.text) if name != 'date' else parse_iso_date(data.text)
if unit:
units[nam... | python | def parse_xml_point(elem):
"""Parse an XML point tag."""
point = {}
units = {}
for data in elem.findall('data'):
name = data.get('name')
unit = data.get('units')
point[name] = float(data.text) if name != 'date' else parse_iso_date(data.text)
if unit:
units[nam... | [
"def",
"parse_xml_point",
"(",
"elem",
")",
":",
"point",
"=",
"{",
"}",
"units",
"=",
"{",
"}",
"for",
"data",
"in",
"elem",
".",
"findall",
"(",
"'data'",
")",
":",
"name",
"=",
"data",
".",
"get",
"(",
"'name'",
")",
"unit",
"=",
"data",
".",
... | Parse an XML point tag. | [
"Parse",
"an",
"XML",
"point",
"tag",
"."
] | train | https://github.com/Unidata/siphon/blob/53fb0d84fbce1c18c8e81c9e68bc81620ee0a6ac/siphon/ncss.py#L321-L331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.