partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | UnityHost.has_hlu | Returns True if `lun_or_snap` is attached to the host.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: True - if `lun_or_snap` is attached, otherwise False. | storops/unity/resource/host.py | def has_hlu(self, lun_or_snap, cg_member=None):
"""Returns True if `lun_or_snap` is attached to the host.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: True - if `lu... | def has_hlu(self, lun_or_snap, cg_member=None):
"""Returns True if `lun_or_snap` is attached to the host.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: True - if `lu... | [
"Returns",
"True",
"if",
"lun_or_snap",
"is",
"attached",
"to",
"the",
"host",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L310-L319 | [
"def",
"has_hlu",
"(",
"self",
",",
"lun_or_snap",
",",
"cg_member",
"=",
"None",
")",
":",
"hlu",
"=",
"self",
".",
"get_hlu",
"(",
"lun_or_snap",
",",
"cg_member",
"=",
"cg_member",
")",
"return",
"hlu",
"is",
"not",
"None"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityHost.get_host_lun | Gets the host lun of a lun, lun snap, cg snap or a member snap of cg
snap.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: the host lun object. | storops/unity/resource/host.py | def get_host_lun(self, lun_or_snap, cg_member=None):
"""Gets the host lun of a lun, lun snap, cg snap or a member snap of cg
snap.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg sna... | def get_host_lun(self, lun_or_snap, cg_member=None):
"""Gets the host lun of a lun, lun snap, cg snap or a member snap of cg
snap.
:param lun_or_snap: can be lun, lun snap, cg snap or a member snap of
cg snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg sna... | [
"Gets",
"the",
"host",
"lun",
"of",
"a",
"lun",
"lun",
"snap",
"cg",
"snap",
"or",
"a",
"member",
"snap",
"of",
"cg",
"snap",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L329-L358 | [
"def",
"get_host_lun",
"(",
"self",
",",
"lun_or_snap",
",",
"cg_member",
"=",
"None",
")",
":",
"import",
"storops",
".",
"unity",
".",
"resource",
".",
"lun",
"as",
"lun_module",
"import",
"storops",
".",
"unity",
".",
"resource",
".",
"snap",
"as",
"s... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityHost.get_hlu | Gets the hlu number of a lun, lun snap, cg snap or a member snap of
cg snap.
:param resource: can be lun, lun snap, cg snap or a member snap of cg
snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
:return: the hlu number. | storops/unity/resource/host.py | def get_hlu(self, resource, cg_member=None):
"""Gets the hlu number of a lun, lun snap, cg snap or a member snap of
cg snap.
:param resource: can be lun, lun snap, cg snap or a member snap of cg
snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
... | def get_hlu(self, resource, cg_member=None):
"""Gets the hlu number of a lun, lun snap, cg snap or a member snap of
cg snap.
:param resource: can be lun, lun snap, cg snap or a member snap of cg
snap.
:param cg_member: the member lun of cg if `lun_or_snap` is cg snap.
... | [
"Gets",
"the",
"hlu",
"number",
"of",
"a",
"lun",
"lun",
"snap",
"cg",
"snap",
"or",
"a",
"member",
"snap",
"of",
"cg",
"snap",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L360-L370 | [
"def",
"get_hlu",
"(",
"self",
",",
"resource",
",",
"cg_member",
"=",
"None",
")",
":",
"host_lun",
"=",
"self",
".",
"get_host_lun",
"(",
"resource",
",",
"cg_member",
"=",
"cg_member",
")",
"return",
"host_lun",
"if",
"host_lun",
"is",
"None",
"else",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityHost.update_initiators | Primarily for puppet-unity use.
Update the iSCSI and FC initiators if needed. | storops/unity/resource/host.py | def update_initiators(self, iqns=None, wwns=None):
"""Primarily for puppet-unity use.
Update the iSCSI and FC initiators if needed.
"""
# First get current iqns
iqns = set(iqns) if iqns else set()
current_iqns = set()
if self.iscsi_host_initiators:
cu... | def update_initiators(self, iqns=None, wwns=None):
"""Primarily for puppet-unity use.
Update the iSCSI and FC initiators if needed.
"""
# First get current iqns
iqns = set(iqns) if iqns else set()
current_iqns = set()
if self.iscsi_host_initiators:
cu... | [
"Primarily",
"for",
"puppet",
"-",
"unity",
"use",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/host.py#L435-L454 | [
"def",
"update_initiators",
"(",
"self",
",",
"iqns",
"=",
"None",
",",
"wwns",
"=",
"None",
")",
":",
"# First get current iqns",
"iqns",
"=",
"set",
"(",
"iqns",
")",
"if",
"iqns",
"else",
"set",
"(",
")",
"current_iqns",
"=",
"set",
"(",
")",
"if",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | list_files | Return a Pandas Series of every file for chosen satellite data.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are <tag strings>... | pysat/instruments/nasa_cdaweb_methods.py | def list_files(tag=None, sat_id=None, data_path=None, format_str=None,
supported_tags=None, fake_daily_files_from_monthly=False,
two_digit_year_break=None):
"""Return a Pandas Series of every file for chosen satellite data.
This routine is intended to be used by pysat instrume... | def list_files(tag=None, sat_id=None, data_path=None, format_str=None,
supported_tags=None, fake_daily_files_from_monthly=False,
two_digit_year_break=None):
"""Return a Pandas Series of every file for chosen satellite data.
This routine is intended to be used by pysat instrume... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"satellite",
"data",
".",
"This",
"routine",
"is",
"intended",
"to",
"be",
"used",
"by",
"pysat",
"instrument",
"modules",
"supporting",
"a",
"particular",
"NASA",
"CDAWeb",
"dataset",
... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L15-L85 | [
"def",
"list_files",
"(",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
",",
"supported_tags",
"=",
"None",
",",
"fake_daily_files_from_monthly",
"=",
"False",
",",
"two_digit_year_break",
"=",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load | Load NASA CDAWeb CDF files.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str... | pysat/instruments/nasa_cdaweb_methods.py | def load(fnames, tag=None, sat_id=None,
fake_daily_files_from_monthly=False,
flatten_twod=True):
"""Load NASA CDAWeb CDF files.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
------------
fnames : (... | def load(fnames, tag=None, sat_id=None,
fake_daily_files_from_monthly=False,
flatten_twod=True):
"""Load NASA CDAWeb CDF files.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
------------
fnames : (... | [
"Load",
"NASA",
"CDAWeb",
"CDF",
"files",
".",
"This",
"routine",
"is",
"intended",
"to",
"be",
"used",
"by",
"pysat",
"instrument",
"modules",
"supporting",
"a",
"particular",
"NASA",
"CDAWeb",
"dataset",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L87-L157 | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"fake_daily_files_from_monthly",
"=",
"False",
",",
"flatten_twod",
"=",
"True",
")",
":",
"import",
"pysatCDF",
"if",
"len",
"(",
"fnames",
")",
"<=",
"0",
":",
"r... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | download | Routine to download NASA CDAWeb CDF data.
This routine is intended to be used by pysat instrument modules supporting
a particular NASA CDAWeb dataset.
Parameters
-----------
supported_tags : dict
dict of dicts. Keys are supported tag names for download. Value is
a dict with 'd... | pysat/instruments/nasa_cdaweb_methods.py | def download(supported_tags, date_array, tag, sat_id,
ftp_site='cdaweb.gsfc.nasa.gov',
data_path=None, user=None, password=None,
fake_daily_files_from_monthly=False):
"""Routine to download NASA CDAWeb CDF data.
This routine is intended to be used by pysat instrumen... | def download(supported_tags, date_array, tag, sat_id,
ftp_site='cdaweb.gsfc.nasa.gov',
data_path=None, user=None, password=None,
fake_daily_files_from_monthly=False):
"""Routine to download NASA CDAWeb CDF data.
This routine is intended to be used by pysat instrumen... | [
"Routine",
"to",
"download",
"NASA",
"CDAWeb",
"CDF",
"data",
".",
"This",
"routine",
"is",
"intended",
"to",
"be",
"used",
"by",
"pysat",
"instrument",
"modules",
"supporting",
"a",
"particular",
"NASA",
"CDAWeb",
"dataset",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/nasa_cdaweb_methods.py#L159-L261 | [
"def",
"download",
"(",
"supported_tags",
",",
"date_array",
",",
"tag",
",",
"sat_id",
",",
"ftp_site",
"=",
"'cdaweb.gsfc.nasa.gov'",
",",
"data_path",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"fake_daily_files_from_monthly",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | from_response | Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request | storops/connection/exceptions.py | def from_response(response, method, url):
"""Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request
"""
req_id = response.headers.get("x-opensta... | def from_response(response, method, url):
"""Returns an instance of :class:`HttpError` or subclass based on response.
:param response: instance of `requests.Response` class
:param method: HTTP method used for request
:param url: URL used for request
"""
req_id = response.headers.get("x-opensta... | [
"Returns",
"an",
"instance",
"of",
":",
"class",
":",
"HttpError",
"or",
"subclass",
"based",
"on",
"response",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/connection/exceptions.py#L84-L132 | [
"def",
"from_response",
"(",
"response",
",",
"method",
",",
"url",
")",
":",
"req_id",
"=",
"response",
".",
"headers",
".",
"get",
"(",
"\"x-openstack-request-id\"",
")",
"# NOTE(hdd) true for older versions of nova and cinder",
"if",
"not",
"req_id",
":",
"req_id... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySystem.create_pool | Create pool based on RaidGroupParameter.
:param name: pool name
:param raid_groups: a list of *RaidGroupParameter*
:param description: pool description
:param alert_threshold: Threshold at which the system will generate
alerts about the free space in the pool, specified a... | storops/unity/resource/system.py | def create_pool(self, name, raid_groups, description=None, **kwargs):
"""Create pool based on RaidGroupParameter.
:param name: pool name
:param raid_groups: a list of *RaidGroupParameter*
:param description: pool description
:param alert_threshold: Threshold at which the system ... | def create_pool(self, name, raid_groups, description=None, **kwargs):
"""Create pool based on RaidGroupParameter.
:param name: pool name
:param raid_groups: a list of *RaidGroupParameter*
:param description: pool description
:param alert_threshold: Threshold at which the system ... | [
"Create",
"pool",
"based",
"on",
"RaidGroupParameter",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L122-L160 | [
"def",
"create_pool",
"(",
"self",
",",
"name",
",",
"raid_groups",
",",
"description",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"UnityPool",
".",
"create",
"(",
"self",
".",
"_cli",
",",
"name",
"=",
"name",
",",
"description",
"=",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySystem.get_file_port | Returns ports list can be used by File
File ports includes ethernet ports and link aggregation ports. | storops/unity/resource/system.py | def get_file_port(self):
"""Returns ports list can be used by File
File ports includes ethernet ports and link aggregation ports.
"""
eths = self.get_ethernet_port(bond=False)
las = self.get_link_aggregation()
return eths + las | def get_file_port(self):
"""Returns ports list can be used by File
File ports includes ethernet ports and link aggregation ports.
"""
eths = self.get_ethernet_port(bond=False)
las = self.get_link_aggregation()
return eths + las | [
"Returns",
"ports",
"list",
"can",
"be",
"used",
"by",
"File"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L209-L216 | [
"def",
"get_file_port",
"(",
"self",
")",
":",
"eths",
"=",
"self",
".",
"get_ethernet_port",
"(",
"bond",
"=",
"False",
")",
"las",
"=",
"self",
".",
"get_link_aggregation",
"(",
")",
"return",
"eths",
"+",
"las"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySystem.create_remote_system | Configures a remote system for remote replication.
:param management_address: the management IP address of the remote
system.
:param local_username: administrative username of local system.
:param local_password: administrative password of local system.
:param remote_usernam... | storops/unity/resource/system.py | def create_remote_system(self, management_address,
local_username=None, local_password=None,
remote_username=None, remote_password=None,
connection_type=None):
"""
Configures a remote system for remote replication.
... | def create_remote_system(self, management_address,
local_username=None, local_password=None,
remote_username=None, remote_password=None,
connection_type=None):
"""
Configures a remote system for remote replication.
... | [
"Configures",
"a",
"remote",
"system",
"for",
"remote",
"replication",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L512-L534 | [
"def",
"create_remote_system",
"(",
"self",
",",
"management_address",
",",
"local_username",
"=",
"None",
",",
"local_password",
"=",
"None",
",",
"remote_username",
"=",
"None",
",",
"remote_password",
"=",
"None",
",",
"connection_type",
"=",
"None",
")",
":"... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySystem.create_replication_interface | Creates a replication interface.
:param sp: `UnityStorageProcessor` object. Storage processor on which
the replication interface is running.
:param ip_port: `UnityIpPort` object. Physical port or link aggregation
on the storage processor on which the interface is running.
... | storops/unity/resource/system.py | def create_replication_interface(self, sp, ip_port, ip_address,
netmask=None, v6_prefix_length=None,
gateway=None, vlan_id=None):
"""
Creates a replication interface.
:param sp: `UnityStorageProcessor` object. Storage pro... | def create_replication_interface(self, sp, ip_port, ip_address,
netmask=None, v6_prefix_length=None,
gateway=None, vlan_id=None):
"""
Creates a replication interface.
:param sp: `UnityStorageProcessor` object. Storage pro... | [
"Creates",
"a",
"replication",
"interface",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/system.py#L544-L567 | [
"def",
"create_replication_interface",
"(",
"self",
",",
"sp",
",",
"ip_port",
",",
"ip_address",
",",
"netmask",
"=",
"None",
",",
"v6_prefix_length",
"=",
"None",
",",
"gateway",
"=",
"None",
",",
"vlan_id",
"=",
"None",
")",
":",
"return",
"UnityReplicati... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | geo2mag | geographic coordinate to magnetic coordinate (coarse):
Parameters
----------
incoord : numpy.array of shape (2,*)
array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]),
where glat, glon are geographic latitude and longitude
(or if you have only one point it is [[glat,glon]]).
... | demo/cosmic_and_ivm_demo.py | def geo2mag(incoord):
"""geographic coordinate to magnetic coordinate (coarse):
Parameters
----------
incoord : numpy.array of shape (2,*)
array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]),
where glat, glon are geographic latitude and longitude
(or if you have only one po... | def geo2mag(incoord):
"""geographic coordinate to magnetic coordinate (coarse):
Parameters
----------
incoord : numpy.array of shape (2,*)
array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]),
where glat, glon are geographic latitude and longitude
(or if you have only one po... | [
"geographic",
"coordinate",
"to",
"magnetic",
"coordinate",
"(",
"coarse",
")",
":"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/demo/cosmic_and_ivm_demo.py#L13-L104 | [
"def",
"geo2mag",
"(",
"incoord",
")",
":",
"from",
"numpy",
"import",
"pi",
",",
"cos",
",",
"sin",
",",
"arctan2",
",",
"sqrt",
",",
"dot",
"# SOME 'constants' for location of northern mag pole",
"lat",
"=",
"80.08",
"#79.3",
"lon",
"=",
"-",
"72.211",
"+"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | VNXSnap.restore | Restores a snapshot.
:param res_id: the LUN number of primary LUN or snapshot mount point to
be restored.
:param backup_snap: the name of a backup snapshot to be created before
restoring. | storops/vnx/resource/snap.py | def restore(self, res_id, backup_snap=None):
"""
Restores a snapshot.
:param res_id: the LUN number of primary LUN or snapshot mount point to
be restored.
:param backup_snap: the name of a backup snapshot to be created before
restoring.
"""
name = ... | def restore(self, res_id, backup_snap=None):
"""
Restores a snapshot.
:param res_id: the LUN number of primary LUN or snapshot mount point to
be restored.
:param backup_snap: the name of a backup snapshot to be created before
restoring.
"""
name = ... | [
"Restores",
"a",
"snapshot",
".",
":",
"param",
"res_id",
":",
"the",
"LUN",
"number",
"of",
"primary",
"LUN",
"or",
"snapshot",
"mount",
"point",
"to",
"be",
"restored",
".",
":",
"param",
"backup_snap",
":",
"the",
"name",
"of",
"a",
"backup",
"snapsho... | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/snap.py#L104-L115 | [
"def",
"restore",
"(",
"self",
",",
"res_id",
",",
"backup_snap",
"=",
"None",
")",
":",
"name",
"=",
"self",
".",
"_get_name",
"(",
")",
"out",
"=",
"self",
".",
"_cli",
".",
"restore_snap",
"(",
"name",
",",
"res_id",
",",
"backup_snap",
")",
"ex",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | list_files | Return a Pandas Series of every file for chosen SuperMAG data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (default='')
sat_id : (string or NoneType)
... | pysat/instruments/supermag_magnetometer.py | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen SuperMAG data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magne... | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen SuperMAG data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magne... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"SuperMAG",
"data"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L62-L128 | [
"def",
"list_files",
"(",
"tag",
"=",
"''",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"if",
"format_str",
"is",
"None",
"and",
"data_path",
"is",
"not",
"None",
":",
"file_base",
"=",
"'superma... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load | Load the SuperMAG files
Parameters
-----------
fnames : (list)
List of filenames
tag : (str or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (default='')
sat_id : (str or NoneType)
... | pysat/instruments/supermag_magnetometer.py | def load(fnames, tag='', sat_id=None):
""" Load the SuperMAG files
Parameters
-----------
fnames : (list)
List of filenames
tag : (str or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (d... | def load(fnames, tag='', sat_id=None):
""" Load the SuperMAG files
Parameters
-----------
fnames : (list)
List of filenames
tag : (str or NoneType)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements). (d... | [
"Load",
"the",
"SuperMAG",
"files"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L131-L195 | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"''",
",",
"sat_id",
"=",
"None",
")",
":",
"# Ensure that there are files to load",
"if",
"len",
"(",
"fnames",
")",
"<=",
"0",
":",
"return",
"pysat",
".",
"DataFrame",
"(",
"None",
")",
",",
"pysat",
".... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load_csv_data | Load data from a comma separated SuperMAG file
Parameters
------------
fname : (str)
CSV SuperMAG file name
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements).
Returns
--------
data... | pysat/instruments/supermag_magnetometer.py | def load_csv_data(fname, tag):
"""Load data from a comma separated SuperMAG file
Parameters
------------
fname : (str)
CSV SuperMAG file name
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurement... | def load_csv_data(fname, tag):
"""Load data from a comma separated SuperMAG file
Parameters
------------
fname : (str)
CSV SuperMAG file name
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurement... | [
"Load",
"data",
"from",
"a",
"comma",
"separated",
"SuperMAG",
"file"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L197-L259 | [
"def",
"load_csv_data",
"(",
"fname",
",",
"tag",
")",
":",
"import",
"re",
"if",
"tag",
"==",
"\"stations\"",
":",
"# Because there may be multiple operators, the default pandas reader",
"# cannot be used.",
"ddict",
"=",
"dict",
"(",
")",
"dkeys",
"=",
"list",
"("... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load_ascii_data | Load data from a self-documenting ASCII SuperMAG file
Parameters
------------
fname : (str)
ASCII SuperMAG filename
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer measurements).
Returns
--------
... | pysat/instruments/supermag_magnetometer.py | def load_ascii_data(fname, tag):
"""Load data from a self-documenting ASCII SuperMAG file
Parameters
------------
fname : (str)
ASCII SuperMAG filename
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer m... | def load_ascii_data(fname, tag):
"""Load data from a self-documenting ASCII SuperMAG file
Parameters
------------
fname : (str)
ASCII SuperMAG filename
tag : (str)
Denotes type of file to load. Accepted types are 'indices', 'all',
'stations', and '' (for just magnetometer m... | [
"Load",
"data",
"from",
"a",
"self",
"-",
"documenting",
"ASCII",
"SuperMAG",
"file"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L261-L414 | [
"def",
"load_ascii_data",
"(",
"fname",
",",
"tag",
")",
":",
"import",
"re",
"ndata",
"=",
"{",
"\"indices\"",
":",
"2",
",",
"\"\"",
":",
"4",
",",
"\"all\"",
":",
"4",
",",
"\"stations\"",
":",
"8",
"}",
"dkeys",
"=",
"{",
"'stations'",
":",
"li... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | update_smag_metadata | Update SuperMAG metadata
Parameters
-----------
col_name : (str)
Data column name
Returns
--------
col_dict : (dict)
Dictionary of strings detailing the units and long-form name of the data | pysat/instruments/supermag_magnetometer.py | def update_smag_metadata(col_name):
"""Update SuperMAG metadata
Parameters
-----------
col_name : (str)
Data column name
Returns
--------
col_dict : (dict)
Dictionary of strings detailing the units and long-form name of the data
"""
smag_units = {'IAGA':'non... | def update_smag_metadata(col_name):
"""Update SuperMAG metadata
Parameters
-----------
col_name : (str)
Data column name
Returns
--------
col_dict : (dict)
Dictionary of strings detailing the units and long-form name of the data
"""
smag_units = {'IAGA':'non... | [
"Update",
"SuperMAG",
"metadata"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L416-L483 | [
"def",
"update_smag_metadata",
"(",
"col_name",
")",
":",
"smag_units",
"=",
"{",
"'IAGA'",
":",
"'none'",
",",
"'N'",
":",
"'nT'",
",",
"'E'",
":",
"'nT'",
",",
"'Z'",
":",
"'nT'",
",",
"'MLT'",
":",
"'hours'",
",",
"'MLAT'",
":",
"'degrees'",
",",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | format_baseline_list | Format the list of baseline information from the loaded files into a
cohesive, informative string
Parameters
------------
baseline_list : (list)
List of strings specifying the baseline information for each
SuperMAG file
Returns
---------
base_string : (str)
Single s... | pysat/instruments/supermag_magnetometer.py | def format_baseline_list(baseline_list):
"""Format the list of baseline information from the loaded files into a
cohesive, informative string
Parameters
------------
baseline_list : (list)
List of strings specifying the baseline information for each
SuperMAG file
Returns
--... | def format_baseline_list(baseline_list):
"""Format the list of baseline information from the loaded files into a
cohesive, informative string
Parameters
------------
baseline_list : (list)
List of strings specifying the baseline information for each
SuperMAG file
Returns
--... | [
"Format",
"the",
"list",
"of",
"baseline",
"information",
"from",
"the",
"loaded",
"files",
"into",
"a",
"cohesive",
"informative",
"string"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L485-L544 | [
"def",
"format_baseline_list",
"(",
"baseline_list",
")",
":",
"uniq_base",
"=",
"dict",
"(",
")",
"uniq_delta",
"=",
"dict",
"(",
")",
"for",
"bline",
"in",
"baseline_list",
":",
"bsplit",
"=",
"bline",
".",
"split",
"(",
")",
"bdate",
"=",
"\" \"",
"."... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | download | Routine to download SuperMAG data
Parameters
-----------
date_array : np.array
Array of datetime objects
tag : string
String denoting the type of file to load, accepted values are 'indices',
'all', 'stations', and '' (for only magnetometer data)
sat_id : string
Not u... | pysat/instruments/supermag_magnetometer.py | def download(date_array, tag, sat_id='', data_path=None, user=None,
password=None, baseline='all', delta='none', options='all',
file_fmt='ascii'):
"""Routine to download SuperMAG data
Parameters
-----------
date_array : np.array
Array of datetime objects
tag : stri... | def download(date_array, tag, sat_id='', data_path=None, user=None,
password=None, baseline='all', delta='none', options='all',
file_fmt='ascii'):
"""Routine to download SuperMAG data
Parameters
-----------
date_array : np.array
Array of datetime objects
tag : stri... | [
"Routine",
"to",
"download",
"SuperMAG",
"data"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L551-L767 | [
"def",
"download",
"(",
"date_array",
",",
"tag",
",",
"sat_id",
"=",
"''",
",",
"data_path",
"=",
"None",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"baseline",
"=",
"'all'",
",",
"delta",
"=",
"'none'",
",",
"options",
"=",
"'all'... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | append_data | Load the SuperMAG files
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
file_fmt : str
String denoting file type (ascii or csv)
tag : string
String denoting the type of file to load, accepted values are... | pysat/instruments/supermag_magnetometer.py | def append_data(file_strings, file_fmt, tag):
""" Load the SuperMAG files
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
file_fmt : str
String denoting file type (ascii or csv)
tag : string
String ... | def append_data(file_strings, file_fmt, tag):
""" Load the SuperMAG files
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
file_fmt : str
String denoting file type (ascii or csv)
tag : string
String ... | [
"Load",
"the",
"SuperMAG",
"files"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L769-L792 | [
"def",
"append_data",
"(",
"file_strings",
",",
"file_fmt",
",",
"tag",
")",
":",
"# Determine the right appending routine for the file type",
"if",
"file_fmt",
".",
"lower",
"(",
")",
"==",
"\"csv\"",
":",
"return",
"append_csv_data",
"(",
"file_strings",
")",
"els... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | append_ascii_data | Append data from multiple files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
tag : string
String denoting the type of file to load, accepted values are 'indices',
'all', 'station... | pysat/instruments/supermag_magnetometer.py | def append_ascii_data(file_strings, tag):
""" Append data from multiple files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
tag : string
String denoting the type of file to load, acce... | def append_ascii_data(file_strings, tag):
""" Append data from multiple files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
tag : string
String denoting the type of file to load, acce... | [
"Append",
"data",
"from",
"multiple",
"files",
"for",
"the",
"same",
"time",
"period"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L794-L902 | [
"def",
"append_ascii_data",
"(",
"file_strings",
",",
"tag",
")",
":",
"import",
"re",
"# Start with data from the first list element",
"out_lines",
"=",
"file_strings",
"[",
"0",
"]",
".",
"split",
"(",
"'\\n'",
")",
"iparam",
"=",
"-",
"1",
"# Index for the para... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | append_csv_data | Append data from multiple csv files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
Returns
-------
out_string : string
String with all data, ready for output to a file | pysat/instruments/supermag_magnetometer.py | def append_csv_data(file_strings):
""" Append data from multiple csv files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
Returns
-------
out_string : string
String with all d... | def append_csv_data(file_strings):
""" Append data from multiple csv files for the same time period
Parameters
-----------
file_strings : array-like
Lists or arrays of strings, where each string contains one file of data
Returns
-------
out_string : string
String with all d... | [
"Append",
"data",
"from",
"multiple",
"csv",
"files",
"for",
"the",
"same",
"time",
"period"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/supermag_magnetometer.py#L904-L946 | [
"def",
"append_csv_data",
"(",
"file_strings",
")",
":",
"# Start with data from the first list element",
"out_lines",
"=",
"list",
"(",
")",
"head_line",
"=",
"None",
"# Cycle through the lists of file strings, creating a list of line strings",
"for",
"fstrings",
"in",
"file_s... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | init | Adds custom calculations to orbit simulation.
This routine is run once, and only once, upon instantiation.
Adds quasi-dipole coordiantes, velocity calculation in ECEF coords,
adds the attitude vectors of spacecraft assuming x is ram pointing and
z is generally nadir, adds ionospheric parameters fro... | pysat/instruments/pysat_sgp4.py | def init(self):
"""
Adds custom calculations to orbit simulation.
This routine is run once, and only once, upon instantiation.
Adds quasi-dipole coordiantes, velocity calculation in ECEF coords,
adds the attitude vectors of spacecraft assuming x is ram pointing and
z is generally nadir, add... | def init(self):
"""
Adds custom calculations to orbit simulation.
This routine is run once, and only once, upon instantiation.
Adds quasi-dipole coordiantes, velocity calculation in ECEF coords,
adds the attitude vectors of spacecraft assuming x is ram pointing and
z is generally nadir, add... | [
"Adds",
"custom",
"calculations",
"to",
"orbit",
"simulation",
".",
"This",
"routine",
"is",
"run",
"once",
"and",
"only",
"once",
"upon",
"instantiation",
".",
"Adds",
"quasi",
"-",
"dipole",
"coordiantes",
"velocity",
"calculation",
"in",
"ECEF",
"coords",
"... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L35-L67 | [
"def",
"init",
"(",
"self",
")",
":",
"self",
".",
"custom",
".",
"add",
"(",
"add_quasi_dipole_coordinates",
",",
"'modify'",
")",
"self",
".",
"custom",
".",
"add",
"(",
"add_aacgm_coordinates",
",",
"'modify'",
")",
"self",
".",
"custom",
".",
"add",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load | Returns data and metadata in the format required by pysat. Finds position
of satellite in both ECI and ECEF co-ordinates.
Routine is directly called by pysat and not the user.
Parameters
----------
fnames : list-like collection
File name that contains date in its name. ... | pysat/instruments/pysat_sgp4.py | def load(fnames, tag=None, sat_id=None, obs_long=0., obs_lat=0., obs_alt=0.,
TLE1=None, TLE2=None):
"""
Returns data and metadata in the format required by pysat. Finds position
of satellite in both ECI and ECEF co-ordinates.
Routine is directl... | def load(fnames, tag=None, sat_id=None, obs_long=0., obs_lat=0., obs_alt=0.,
TLE1=None, TLE2=None):
"""
Returns data and metadata in the format required by pysat. Finds position
of satellite in both ECI and ECEF co-ordinates.
Routine is directl... | [
"Returns",
"data",
"and",
"metadata",
"in",
"the",
"format",
"required",
"by",
"pysat",
".",
"Finds",
"position",
"of",
"satellite",
"in",
"both",
"ECI",
"and",
"ECEF",
"co",
"-",
"ordinates",
".",
"Routine",
"is",
"directly",
"called",
"by",
"pysat",
"and... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L69-L205 | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"obs_long",
"=",
"0.",
",",
"obs_lat",
"=",
"0.",
",",
"obs_alt",
"=",
"0.",
",",
"TLE1",
"=",
"None",
",",
"TLE2",
"=",
"None",
")",
":",
"import",
"sgp4",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | list_files | Produce a fake list of files spanning a year | pysat/instruments/pysat_sgp4.py | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Produce a fake list of files spanning a year"""
index = pds.date_range(pysat.datetime(2017,12,1), pysat.datetime(2018,12,1))
# file list is effectively just the date in string format - '%D' works only in Mac. '%x' workins in bo... | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Produce a fake list of files spanning a year"""
index = pds.date_range(pysat.datetime(2017,12,1), pysat.datetime(2018,12,1))
# file list is effectively just the date in string format - '%D' works only in Mac. '%x' workins in bo... | [
"Produce",
"a",
"fake",
"list",
"of",
"files",
"spanning",
"a",
"year"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L255-L261 | [
"def",
"list_files",
"(",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"index",
"=",
"pds",
".",
"date_range",
"(",
"pysat",
".",
"datetime",
"(",
"2017",
",",
"12",
",",
"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_sc_attitude_vectors | Add attitude vectors for spacecraft assuming ram pointing.
Presumes spacecraft is pointed along the velocity vector (x), z is
generally nadir pointing (positive towards Earth), and y completes the
right handed system (generally southward).
Notes
-----
Expects velocity and positi... | pysat/instruments/pysat_sgp4.py | def add_sc_attitude_vectors(inst):
"""
Add attitude vectors for spacecraft assuming ram pointing.
Presumes spacecraft is pointed along the velocity vector (x), z is
generally nadir pointing (positive towards Earth), and y completes the
right handed system (generally southward).
... | def add_sc_attitude_vectors(inst):
"""
Add attitude vectors for spacecraft assuming ram pointing.
Presumes spacecraft is pointed along the velocity vector (x), z is
generally nadir pointing (positive towards Earth), and y completes the
right handed system (generally southward).
... | [
"Add",
"attitude",
"vectors",
"for",
"spacecraft",
"assuming",
"ram",
"pointing",
".",
"Presumes",
"spacecraft",
"is",
"pointed",
"along",
"the",
"velocity",
"vector",
"(",
"x",
")",
"z",
"is",
"generally",
"nadir",
"pointing",
"(",
"positive",
"towards",
"Ear... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L269-L361 | [
"def",
"add_sc_attitude_vectors",
"(",
"inst",
")",
":",
"import",
"pysatMagVect",
"# ram pointing is along velocity vector",
"inst",
"[",
"'sc_xhat_ecef_x'",
"]",
",",
"inst",
"[",
"'sc_xhat_ecef_y'",
"]",
",",
"inst",
"[",
"'sc_xhat_ecef_z'",
"]",
"=",
"pysatMagVect... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | calculate_ecef_velocity | Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should be run using pysat data padding feature
to c... | pysat/instruments/pysat_sgp4.py | def calculate_ecef_velocity(inst):
"""
Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should b... | def calculate_ecef_velocity(inst):
"""
Calculates spacecraft velocity in ECEF frame.
Presumes that the spacecraft velocity in ECEF is in
the input instrument object as position_ecef_*. Uses a symmetric
difference to calculate the velocity thus endpoints will be
set to NaN. Routine should b... | [
"Calculates",
"spacecraft",
"velocity",
"in",
"ECEF",
"frame",
".",
"Presumes",
"that",
"the",
"spacecraft",
"velocity",
"in",
"ECEF",
"is",
"in",
"the",
"input",
"instrument",
"object",
"as",
"position_ecef_",
"*",
".",
"Uses",
"a",
"symmetric",
"difference",
... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L363-L405 | [
"def",
"calculate_ecef_velocity",
"(",
"inst",
")",
":",
"x",
"=",
"inst",
"[",
"'position_ecef_x'",
"]",
"vel_x",
"=",
"(",
"x",
".",
"values",
"[",
"2",
":",
"]",
"-",
"x",
".",
"values",
"[",
"0",
":",
"-",
"2",
"]",
")",
"/",
"2.",
"y",
"="... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_quasi_dipole_coordinates | Uses Apexpy package to add quasi-dipole coordinates to instrument object.
The Quasi-Dipole coordinate system includes both the tilt and offset of the
geomagnetic field to calculate the latitude, longitude, and local time
of the spacecraft with respect to the geomagnetic field.
This system is ... | pysat/instruments/pysat_sgp4.py | def add_quasi_dipole_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses Apexpy package to add quasi-dipole coordinates to instrument object.
The Quasi-Dipole coordinate system includes both the tilt and offset of the
geomag... | def add_quasi_dipole_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses Apexpy package to add quasi-dipole coordinates to instrument object.
The Quasi-Dipole coordinate system includes both the tilt and offset of the
geomag... | [
"Uses",
"Apexpy",
"package",
"to",
"add",
"quasi",
"-",
"dipole",
"coordinates",
"to",
"instrument",
"object",
".",
"The",
"Quasi",
"-",
"Dipole",
"coordinate",
"system",
"includes",
"both",
"the",
"tilt",
"and",
"offset",
"of",
"the",
"geomagnetic",
"field",
... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L407-L462 | [
"def",
"add_quasi_dipole_coordinates",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"apexpy",
"ap",
"=",
"apexpy",
".",
"Apex",
"(",
"date",
"=",
"inst",
".",
"date",... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_aacgm_coordinates | Uses AACGMV2 package to add AACGM coordinates to instrument object.
The Altitude Adjusted Corrected Geomagnetic Coordinates library is used
to calculate the latitude, longitude, and local time
of the spacecraft with respect to the geomagnetic field.
Example
-------
# function added... | pysat/instruments/pysat_sgp4.py | def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses AACGMV2 package to add AACGM coordinates to instrument object.
The Altitude Adjusted Corrected Geomagnetic Coordinates library is used
to calculate the latitud... | def add_aacgm_coordinates(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses AACGMV2 package to add AACGM coordinates to instrument object.
The Altitude Adjusted Corrected Geomagnetic Coordinates library is used
to calculate the latitud... | [
"Uses",
"AACGMV2",
"package",
"to",
"add",
"AACGM",
"coordinates",
"to",
"instrument",
"object",
".",
"The",
"Altitude",
"Adjusted",
"Corrected",
"Geomagnetic",
"Coordinates",
"library",
"is",
"used",
"to",
"calculate",
"the",
"latitude",
"longitude",
"and",
"loca... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L464-L516 | [
"def",
"add_aacgm_coordinates",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"aacgmv2",
"aalat",
"=",
"[",
"]",
"aalon",
"=",
"[",
"]",
"mlt",
"=",
"[",
"]",
"for... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_iri_thermal_plasma | Uses IRI (International Reference Ionosphere) model to simulate an ionosphere.
Uses pyglow module to run IRI. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
inst.custom.add(add_i... | pysat/instruments/pysat_sgp4.py | def add_iri_thermal_plasma(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses IRI (International Reference Ionosphere) model to simulate an ionosphere.
Uses pyglow module to run IRI. Configured to use actual solar parameters to run
model.
... | def add_iri_thermal_plasma(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses IRI (International Reference Ionosphere) model to simulate an ionosphere.
Uses pyglow module to run IRI. Configured to use actual solar parameters to run
model.
... | [
"Uses",
"IRI",
"(",
"International",
"Reference",
"Ionosphere",
")",
"model",
"to",
"simulate",
"an",
"ionosphere",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"IRI",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"to",
"run",
"model",
".... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L519-L582 | [
"def",
"add_iri_thermal_plasma",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"from",
"pyglow",
".",
"pyglow",
"import",
"Point",
"iri_params",
"=",
"[",
"]",... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_hwm_winds_and_ecef_vectors | Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
Uses pyglow module to run HWM. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
inst.custom.add(add_hwm_winds... | pysat/instruments/pysat_sgp4.py | def add_hwm_winds_and_ecef_vectors(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
Uses pyglow module to run HWM. Configured to use actual solar parameters to run
m... | def add_hwm_winds_and_ecef_vectors(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses HWM (Horizontal Wind Model) model to obtain neutral wind details.
Uses pyglow module to run HWM. Configured to use actual solar parameters to run
m... | [
"Uses",
"HWM",
"(",
"Horizontal",
"Wind",
"Model",
")",
"model",
"to",
"obtain",
"neutral",
"wind",
"details",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"HWM",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"to",
"run",
"model",
".",
... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L585-L681 | [
"def",
"add_hwm_winds_and_ecef_vectors",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"import",
"pysatMagVect",
"hwm_params",
"=",
"[",
"]",
"for",
"time",
",",... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_igrf | Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values.
Uses pyglow module to run IGRF. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
ins... | pysat/instruments/pysat_sgp4.py | def add_igrf(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values.
Uses pyglow module to run IGRF. Configured to use actual solar parameters to run
... | def add_igrf(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses International Geomagnetic Reference Field (IGRF) model to obtain geomagnetic field values.
Uses pyglow module to run IGRF. Configured to use actual solar parameters to run
... | [
"Uses",
"International",
"Geomagnetic",
"Reference",
"Field",
"(",
"IGRF",
")",
"model",
"to",
"obtain",
"geomagnetic",
"field",
"values",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"IGRF",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"t... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L684-L765 | [
"def",
"add_igrf",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"from",
"pyglow",
".",
"pyglow",
"import",
"Point",
"import",
"pysatMagVect",
"igrf_params",
"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | add_msis | Uses MSIS model to obtain thermospheric values.
Uses pyglow module to run MSIS. Configured to use actual solar parameters to run
model.
Example
-------
# function added velow modifies the inst object upon every inst.load call
inst.custom.add(add_msis, 'modify', glat_label='cus... | pysat/instruments/pysat_sgp4.py | def add_msis(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses MSIS model to obtain thermospheric values.
Uses pyglow module to run MSIS. Configured to use actual solar parameters to run
model.
Example
-------
# f... | def add_msis(inst, glat_label='glat', glong_label='glong',
alt_label='alt'):
"""
Uses MSIS model to obtain thermospheric values.
Uses pyglow module to run MSIS. Configured to use actual solar parameters to run
model.
Example
-------
# f... | [
"Uses",
"MSIS",
"model",
"to",
"obtain",
"thermospheric",
"values",
".",
"Uses",
"pyglow",
"module",
"to",
"run",
"MSIS",
".",
"Configured",
"to",
"use",
"actual",
"solar",
"parameters",
"to",
"run",
"model",
".",
"Example",
"-------",
"#",
"function",
"adde... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L768-L843 | [
"def",
"add_msis",
"(",
"inst",
",",
"glat_label",
"=",
"'glat'",
",",
"glong_label",
"=",
"'glong'",
",",
"alt_label",
"=",
"'alt'",
")",
":",
"import",
"pyglow",
"from",
"pyglow",
".",
"pyglow",
"import",
"Point",
"msis_params",
"=",
"[",
"]",
"# print '... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | project_ecef_vector_onto_sc | Express input vector using s/c attitude directions
x - ram pointing
y - generally southward
z - generally nadir
Parameters
----------
x_label : string
Label used to get ECEF-X component of vector to be projected
y_label : string
Label used to get ECEF-Y component of... | pysat/instruments/pysat_sgp4.py | def project_ecef_vector_onto_sc(inst, x_label, y_label, z_label,
new_x_label, new_y_label, new_z_label,
meta=None):
"""Express input vector using s/c attitude directions
x - ram pointing
y - generally southward
z - generally nadir
... | def project_ecef_vector_onto_sc(inst, x_label, y_label, z_label,
new_x_label, new_y_label, new_z_label,
meta=None):
"""Express input vector using s/c attitude directions
x - ram pointing
y - generally southward
z - generally nadir
... | [
"Express",
"input",
"vector",
"using",
"s",
"/",
"c",
"attitude",
"directions",
"x",
"-",
"ram",
"pointing",
"y",
"-",
"generally",
"southward",
"z",
"-",
"generally",
"nadir",
"Parameters",
"----------",
"x_label",
":",
"string",
"Label",
"used",
"to",
"get... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/pysat_sgp4.py#L845-L887 | [
"def",
"project_ecef_vector_onto_sc",
"(",
"inst",
",",
"x_label",
",",
"y_label",
",",
"z_label",
",",
"new_x_label",
",",
"new_y_label",
",",
"new_z_label",
",",
"meta",
"=",
"None",
")",
":",
"import",
"pysatMagVect",
"x",
",",
"y",
",",
"z",
"=",
"pysa... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | scatterplot | Return scatterplot of data_label(s) as functions of labelx,y over a season.
Parameters
----------
labelx : string
data product for x-axis
labely : string
data product for y-axis
data_label : string, array-like of strings
data product(s) to be scatter plotted
datalim : ... | pysat/ssnl/plot.py | def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None):
"""Return scatterplot of data_label(s) as functions of labelx,y over a season.
Parameters
----------
labelx : string
data product for x-axis
labely : string
data product for y-axis
data_label : s... | def scatterplot(inst, labelx, labely, data_label, datalim, xlim=None, ylim=None):
"""Return scatterplot of data_label(s) as functions of labelx,y over a season.
Parameters
----------
labelx : string
data product for x-axis
labely : string
data product for y-axis
data_label : s... | [
"Return",
"scatterplot",
"of",
"data_label",
"(",
"s",
")",
"as",
"functions",
"of",
"labelx",
"y",
"over",
"a",
"season",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/ssnl/plot.py#L9-L92 | [
"def",
"scatterplot",
"(",
"inst",
",",
"labelx",
",",
"labely",
",",
"data_label",
",",
"datalim",
",",
"xlim",
"=",
"None",
",",
"ylim",
"=",
"None",
")",
":",
"# interactive plotting off",
"plt",
".",
"ioff",
"(",
")",
"# create figures for plotting",
"fi... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | enable_log | Enable console logging.
This is a utils method for try run with storops.
:param level: log level, default to DEBUG | storops/__init__.py | def enable_log(level=logging.DEBUG):
"""Enable console logging.
This is a utils method for try run with storops.
:param level: log level, default to DEBUG
"""
logger = logging.getLogger(__name__)
logger.setLevel(level)
if not logger.handlers:
logger.info('enabling logging to console... | def enable_log(level=logging.DEBUG):
"""Enable console logging.
This is a utils method for try run with storops.
:param level: log level, default to DEBUG
"""
logger = logging.getLogger(__name__)
logger.setLevel(level)
if not logger.handlers:
logger.info('enabling logging to console... | [
"Enable",
"console",
"logging",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/__init__.py#L30-L40 | [
"def",
"enable_log",
"(",
"level",
"=",
"logging",
".",
"DEBUG",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"logger",
".",
"setLevel",
"(",
"level",
")",
"if",
"not",
"logger",
".",
"handlers",
":",
"logger",
".",
"info... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | list_files | Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary data type (ascii) is loaded.
(default=None)
sat_id : (string or None... | pysat/instruments/cosmic2013_gps.py | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary d... | def list_files(tag=None, sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary d... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"satellite",
"data"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic2013_gps.py#L57-L122 | [
"def",
"list_files",
"(",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"import",
"sys",
"#if tag == 'ionprf':",
"# # from_os constructor currently doesn't work because of the variable ",
"#... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load_files | Loads a list of COSMIC data files, supplied by user.
Returns a list of dicts, a dict for each file. | pysat/instruments/cosmic2013_gps.py | def load_files(files, tag=None, sat_id=None, altitude_bin=None):
'''Loads a list of COSMIC data files, supplied by user.
Returns a list of dicts, a dict for each file.
'''
output = [None]*len(files)
drop_idx = []
for (i,file) in enumerate(files):
try:
#data = net... | def load_files(files, tag=None, sat_id=None, altitude_bin=None):
'''Loads a list of COSMIC data files, supplied by user.
Returns a list of dicts, a dict for each file.
'''
output = [None]*len(files)
drop_idx = []
for (i,file) in enumerate(files):
try:
#data = net... | [
"Loads",
"a",
"list",
"of",
"COSMIC",
"data",
"files",
"supplied",
"by",
"user",
".",
"Returns",
"a",
"list",
"of",
"dicts",
"a",
"dict",
"for",
"each",
"file",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/cosmic2013_gps.py#L172-L224 | [
"def",
"load_files",
"(",
"files",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
",",
"altitude_bin",
"=",
"None",
")",
":",
"output",
"=",
"[",
"None",
"]",
"*",
"len",
"(",
"files",
")",
"drop_idx",
"=",
"[",
"]",
"for",
"(",
"i",
",",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | round_60 | round the number to the multiple of 60
Say a random value is represented by: 60 * n + r
n is an integer and r is an integer between 0 and 60.
if r < 30, the result is 60 * n.
otherwise, the result is 60 * (n + 1)
The use of this function is that the counter refreshment on
VNX is always 1 minut... | storops/vnx/calculator.py | def round_60(value):
""" round the number to the multiple of 60
Say a random value is represented by: 60 * n + r
n is an integer and r is an integer between 0 and 60.
if r < 30, the result is 60 * n.
otherwise, the result is 60 * (n + 1)
The use of this function is that the counter refreshment... | def round_60(value):
""" round the number to the multiple of 60
Say a random value is represented by: 60 * n + r
n is an integer and r is an integer between 0 and 60.
if r < 30, the result is 60 * n.
otherwise, the result is 60 * (n + 1)
The use of this function is that the counter refreshment... | [
"round",
"the",
"number",
"to",
"the",
"multiple",
"of",
"60"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L85-L108 | [
"def",
"round_60",
"(",
"value",
")",
":",
"t",
"=",
"60",
"if",
"value",
"is",
"not",
"None",
":",
"r",
"=",
"value",
"%",
"t",
"if",
"r",
">",
"t",
"/",
"2",
":",
"ret",
"=",
"value",
"+",
"(",
"t",
"-",
"r",
")",
"else",
":",
"ret",
"=... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | utilization | calculate the utilization
delta_busy = curr.busy - prev.busy
delta_idle = curr.idle - prev.idle
utilization = delta_busy / (delta_busy + delta_idle)
:param prev: previous resource
:param curr: current resource
:param counters: list of two, busy ticks and idle ticks
:return: value, NaN if i... | storops/vnx/calculator.py | def utilization(prev, curr, counters):
""" calculate the utilization
delta_busy = curr.busy - prev.busy
delta_idle = curr.idle - prev.idle
utilization = delta_busy / (delta_busy + delta_idle)
:param prev: previous resource
:param curr: current resource
:param counters: list of two, busy ti... | def utilization(prev, curr, counters):
""" calculate the utilization
delta_busy = curr.busy - prev.busy
delta_idle = curr.idle - prev.idle
utilization = delta_busy / (delta_busy + delta_idle)
:param prev: previous resource
:param curr: current resource
:param counters: list of two, busy ti... | [
"calculate",
"the",
"utilization"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L138-L161 | [
"def",
"utilization",
"(",
"prev",
",",
"curr",
",",
"counters",
")",
":",
"busy_prop",
",",
"idle_prop",
"=",
"counters",
"pb",
"=",
"getattr",
"(",
"prev",
",",
"busy_prop",
")",
"pi",
"=",
"getattr",
"(",
"prev",
",",
"idle_prop",
")",
"cb",
"=",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | delta_ps | calculate the delta per second of one counter
formula: (curr - prev) / delta_time
:param prev: previous resource
:param curr: current resource
:param counters: the counter to do delta and per second, one only
:return: value, NaN if invalid. | storops/vnx/calculator.py | def delta_ps(prev, curr, counters):
""" calculate the delta per second of one counter
formula: (curr - prev) / delta_time
:param prev: previous resource
:param curr: current resource
:param counters: the counter to do delta and per second, one only
:return: value, NaN if invalid.
"""
co... | def delta_ps(prev, curr, counters):
""" calculate the delta per second of one counter
formula: (curr - prev) / delta_time
:param prev: previous resource
:param curr: current resource
:param counters: the counter to do delta and per second, one only
:return: value, NaN if invalid.
"""
co... | [
"calculate",
"the",
"delta",
"per",
"second",
"of",
"one",
"counter"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L170-L183 | [
"def",
"delta_ps",
"(",
"prev",
",",
"curr",
",",
"counters",
")",
":",
"counter",
"=",
"get_counter",
"(",
"counters",
")",
"pv",
"=",
"getattr",
"(",
"prev",
",",
"counter",
")",
"cv",
"=",
"getattr",
"(",
"curr",
",",
"counter",
")",
"return",
"mi... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | io_size_kb | calculate the io size based on bandwidth and throughput
formula: average_io_size = bandwidth / throughput
:param prev: prev resource, not used
:param curr: current resource
:param counters: two stats, bandwidth in MB and throughput count
:return: value, NaN if invalid | storops/vnx/calculator.py | def io_size_kb(prev, curr, counters):
""" calculate the io size based on bandwidth and throughput
formula: average_io_size = bandwidth / throughput
:param prev: prev resource, not used
:param curr: current resource
:param counters: two stats, bandwidth in MB and throughput count
:return: value,... | def io_size_kb(prev, curr, counters):
""" calculate the io size based on bandwidth and throughput
formula: average_io_size = bandwidth / throughput
:param prev: prev resource, not used
:param curr: current resource
:param counters: two stats, bandwidth in MB and throughput count
:return: value,... | [
"calculate",
"the",
"io",
"size",
"based",
"on",
"bandwidth",
"and",
"throughput"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/calculator.py#L187-L198 | [
"def",
"io_size_kb",
"(",
"prev",
",",
"curr",
",",
"counters",
")",
":",
"bw_stats",
",",
"io_stats",
"=",
"counters",
"size_mb",
"=",
"div",
"(",
"getattr",
"(",
"curr",
",",
"bw_stats",
")",
",",
"getattr",
"(",
"curr",
",",
"io_stats",
")",
")",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | list_files | Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary data type (ascii) is loaded.
(default='')
sat_id : (string or NoneTy... | pysat/instruments/champ_star.py | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary dat... | def list_files(tag='', sat_id=None, data_path=None, format_str=None):
"""Return a Pandas Series of every file for chosen satellite data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '' and 'ascii'.
If '' is specified, the primary dat... | [
"Return",
"a",
"Pandas",
"Series",
"of",
"every",
"file",
"for",
"chosen",
"satellite",
"data"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/champ_star.py#L39-L75 | [
"def",
"list_files",
"(",
"tag",
"=",
"''",
",",
"sat_id",
"=",
"None",
",",
"data_path",
"=",
"None",
",",
"format_str",
"=",
"None",
")",
":",
"if",
"format_str",
"is",
"None",
"and",
"tag",
"is",
"not",
"None",
":",
"if",
"tag",
"==",
"''",
"or"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load | Load CHAMP STAR files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
---------
data : (pandas.DataFrame)
Objec... | pysat/instruments/champ_star.py | def load(fnames, tag=None, sat_id=None):
"""Load CHAMP STAR files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-----... | def load(fnames, tag=None, sat_id=None):
"""Load CHAMP STAR files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-----... | [
"Load",
"CHAMP",
"STAR",
"files"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/champ_star.py#L78-L193 | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
")",
":",
"import",
"re",
"if",
"len",
"(",
"fnames",
")",
"<=",
"0",
":",
"return",
"pysat",
".",
"DataFrame",
"(",
"None",
")",
",",
"pysat",
".",
"Meta",
"(",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._assign_funcs | Assign all external science instrument methods to Instrument object. | pysat/_instrument.py | def _assign_funcs(self, by_name=False, inst_module=None):
"""Assign all external science instrument methods to Instrument object.
"""
import importlib
# set defaults
self._list_rtn = self._pass_func
self._load_rtn = self._pass_func
self._default_rtn = self... | def _assign_funcs(self, by_name=False, inst_module=None):
"""Assign all external science instrument methods to Instrument object.
"""
import importlib
# set defaults
self._list_rtn = self._pass_func
self._load_rtn = self._pass_func
self._default_rtn = self... | [
"Assign",
"all",
"external",
"science",
"instrument",
"methods",
"to",
"Instrument",
"object",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L452-L515 | [
"def",
"_assign_funcs",
"(",
"self",
",",
"by_name",
"=",
"False",
",",
"inst_module",
"=",
"None",
")",
":",
"import",
"importlib",
"# set defaults",
"self",
".",
"_list_rtn",
"=",
"self",
".",
"_pass_func",
"self",
".",
"_load_rtn",
"=",
"self",
".",
"_p... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._load_data | Load data for an instrument on given date or fid, dependng upon input.
Parameters
------------
date : (dt.datetime.date object or NoneType)
file date
fid : (int or NoneType)
filename index value
Returns
--------
data : (pds.DataFrame)
... | pysat/_instrument.py | def _load_data(self, date=None, fid=None):
"""
Load data for an instrument on given date or fid, dependng upon input.
Parameters
------------
date : (dt.datetime.date object or NoneType)
file date
fid : (int or NoneType)
filename index value
... | def _load_data(self, date=None, fid=None):
"""
Load data for an instrument on given date or fid, dependng upon input.
Parameters
------------
date : (dt.datetime.date object or NoneType)
file date
fid : (int or NoneType)
filename index value
... | [
"Load",
"data",
"for",
"an",
"instrument",
"on",
"given",
"date",
"or",
"fid",
"dependng",
"upon",
"input",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L592-L664 | [
"def",
"_load_data",
"(",
"self",
",",
"date",
"=",
"None",
",",
"fid",
"=",
"None",
")",
":",
"if",
"fid",
"is",
"not",
"None",
":",
"# get filename based off of index value",
"fname",
"=",
"self",
".",
"files",
"[",
"fid",
":",
"fid",
"+",
"1",
"]",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._load_next | Load the next days data (or file) without incrementing the date.
Repeated calls will not advance date/file and will produce the same data
Uses info stored in object to either increment the date,
or the file. Looks for self._load_by_date flag. | pysat/_instrument.py | def _load_next(self):
"""Load the next days data (or file) without incrementing the date.
Repeated calls will not advance date/file and will produce the same data
Uses info stored in object to either increment the date,
or the file. Looks for self._load_by_date flag.
... | def _load_next(self):
"""Load the next days data (or file) without incrementing the date.
Repeated calls will not advance date/file and will produce the same data
Uses info stored in object to either increment the date,
or the file. Looks for self._load_by_date flag.
... | [
"Load",
"the",
"next",
"days",
"data",
"(",
"or",
"file",
")",
"without",
"incrementing",
"the",
"date",
".",
"Repeated",
"calls",
"will",
"not",
"advance",
"date",
"/",
"file",
"and",
"will",
"produce",
"the",
"same",
"data",
"Uses",
"info",
"stored",
"... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L666-L678 | [
"def",
"_load_next",
"(",
"self",
")",
":",
"if",
"self",
".",
"_load_by_date",
":",
"next_date",
"=",
"self",
".",
"date",
"+",
"pds",
".",
"DateOffset",
"(",
"days",
"=",
"1",
")",
"return",
"self",
".",
"_load_data",
"(",
"date",
"=",
"next_date",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._load_prev | Load the next days data (or file) without decrementing the date.
Repeated calls will not decrement date/file and will produce the same
data
Uses info stored in object to either decrement the date,
or the file. Looks for self._load_by_date flag. | pysat/_instrument.py | def _load_prev(self):
"""Load the next days data (or file) without decrementing the date.
Repeated calls will not decrement date/file and will produce the same
data
Uses info stored in object to either decrement the date,
or the file. Looks for self._load_by_date flag. ... | def _load_prev(self):
"""Load the next days data (or file) without decrementing the date.
Repeated calls will not decrement date/file and will produce the same
data
Uses info stored in object to either decrement the date,
or the file. Looks for self._load_by_date flag. ... | [
"Load",
"the",
"next",
"days",
"data",
"(",
"or",
"file",
")",
"without",
"decrementing",
"the",
"date",
".",
"Repeated",
"calls",
"will",
"not",
"decrement",
"date",
"/",
"file",
"and",
"will",
"produce",
"the",
"same",
"data",
"Uses",
"info",
"stored",
... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L680-L694 | [
"def",
"_load_prev",
"(",
"self",
")",
":",
"if",
"self",
".",
"_load_by_date",
":",
"prev_date",
"=",
"self",
".",
"date",
"-",
"pds",
".",
"DateOffset",
"(",
"days",
"=",
"1",
")",
"return",
"self",
".",
"_load_data",
"(",
"date",
"=",
"prev_date",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument.load | Load instrument data into Instrument object .data.
Parameters
----------
yr : integer
year for desired data
doy : integer
day of year
date : datetime object
date to load
fname : 'string'
filename to be loaded
verify... | pysat/_instrument.py | def load(self, yr=None, doy=None, date=None, fname=None, fid=None,
verifyPad=False):
"""Load instrument data into Instrument object .data.
Parameters
----------
yr : integer
year for desired data
doy : integer
day of year
date : date... | def load(self, yr=None, doy=None, date=None, fname=None, fid=None,
verifyPad=False):
"""Load instrument data into Instrument object .data.
Parameters
----------
yr : integer
year for desired data
doy : integer
day of year
date : date... | [
"Load",
"instrument",
"data",
"into",
"Instrument",
"object",
".",
"data",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L709-L916 | [
"def",
"load",
"(",
"self",
",",
"yr",
"=",
"None",
",",
"doy",
"=",
"None",
",",
"date",
"=",
"None",
",",
"fname",
"=",
"None",
",",
"fid",
"=",
"None",
",",
"verifyPad",
"=",
"False",
")",
":",
"# set options used by loading routine based upon user inpu... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument.download | Download data for given Instrument object from start to stop.
Parameters
----------
start : pandas.datetime
start date to download data
stop : pandas.datetime
stop date to download data
freq : string
Stepsize between dates for season, ... | pysat/_instrument.py | def download(self, start, stop, freq='D', user=None, password=None,
**kwargs):
"""Download data for given Instrument object from start to stop.
Parameters
----------
start : pandas.datetime
start date to download data
stop : pandas.datetime
... | def download(self, start, stop, freq='D', user=None, password=None,
**kwargs):
"""Download data for given Instrument object from start to stop.
Parameters
----------
start : pandas.datetime
start date to download data
stop : pandas.datetime
... | [
"Download",
"data",
"for",
"given",
"Instrument",
"object",
"from",
"start",
"to",
"stop",
".",
"Parameters",
"----------",
"start",
":",
"pandas",
".",
"datetime",
"start",
"date",
"to",
"download",
"data",
"stop",
":",
"pandas",
".",
"datetime",
"stop",
"d... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L918-L980 | [
"def",
"download",
"(",
"self",
",",
"start",
",",
"stop",
",",
"freq",
"=",
"'D'",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"errno",
"# make sure directories are there, otherwise create them",
"try... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument.next | Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first day(default)/file will be loaded. | pysat/_instrument.py | def next(self, verifyPad=False):
"""Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first... | def next(self, verifyPad=False):
"""Manually iterate through the data loaded in Instrument object.
Bounds of iteration and iteration type (day/file) are set by
`bounds` attribute.
Note
----
If there were no previous calls to load then the
first... | [
"Manually",
"iterate",
"through",
"the",
"data",
"loaded",
"in",
"Instrument",
"object",
".",
"Bounds",
"of",
"iteration",
"and",
"iteration",
"type",
"(",
"day",
"/",
"file",
")",
"are",
"set",
"by",
"bounds",
"attribute",
".",
"Note",
"----",
"If",
"ther... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1132-L1168 | [
"def",
"next",
"(",
"self",
",",
"verifyPad",
"=",
"False",
")",
":",
"if",
"self",
".",
"_iter_type",
"==",
"'date'",
":",
"if",
"self",
".",
"date",
"is",
"not",
"None",
":",
"idx",
",",
"=",
"np",
".",
"where",
"(",
"self",
".",
"_iter_list",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._get_var_type_code | Determines the two-character type code for a given variable type
Parameters
----------
coltype : type or np.dtype
The type of the variable
Returns
-------
str
The variable type code for the given type | pysat/_instrument.py | def _get_var_type_code(self, coltype):
'''Determines the two-character type code for a given variable type
Parameters
----------
coltype : type or np.dtype
The type of the variable
Returns
-------
str
The variable type code for the given ... | def _get_var_type_code(self, coltype):
'''Determines the two-character type code for a given variable type
Parameters
----------
coltype : type or np.dtype
The type of the variable
Returns
-------
str
The variable type code for the given ... | [
"Determines",
"the",
"two",
"-",
"character",
"type",
"code",
"for",
"a",
"given",
"variable",
"type"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1208-L1248 | [
"def",
"_get_var_type_code",
"(",
"self",
",",
"coltype",
")",
":",
"if",
"type",
"(",
"coltype",
")",
"is",
"np",
".",
"dtype",
":",
"var_type",
"=",
"coltype",
".",
"kind",
"+",
"str",
"(",
"coltype",
".",
"itemsize",
")",
"return",
"var_type",
"else... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._get_data_info | Support file writing by determiniing data type and other options
Parameters
----------
data : pandas object
Data to be written
file_format : basestring
String indicating netCDF3 or netCDF4
Returns
-------
data_flag, datetime_flag, old_for... | pysat/_instrument.py | def _get_data_info(self, data, file_format):
"""Support file writing by determiniing data type and other options
Parameters
----------
data : pandas object
Data to be written
file_format : basestring
String indicating netCDF3 or netCDF4
Returns
... | def _get_data_info(self, data, file_format):
"""Support file writing by determiniing data type and other options
Parameters
----------
data : pandas object
Data to be written
file_format : basestring
String indicating netCDF3 or netCDF4
Returns
... | [
"Support",
"file",
"writing",
"by",
"determiniing",
"data",
"type",
"and",
"other",
"options"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1252-L1303 | [
"def",
"_get_data_info",
"(",
"self",
",",
"data",
",",
"file_format",
")",
":",
"# get type of data",
"data_type",
"=",
"data",
".",
"dtype",
"# check if older file_format",
"# if file_format[:7] == 'NETCDF3':",
"if",
"file_format",
"!=",
"'NETCDF4'",
":",
"old_format"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument._filter_netcdf4_metadata | Filter metadata properties to be consistent with netCDF4.
Notes
-----
removed forced to True if coltype consistent with a string type
Parameters
----------
mdata_dict : dict
Dictionary equivalent to Meta object info
coltype : type
... | pysat/_instrument.py | def _filter_netcdf4_metadata(self, mdata_dict, coltype, remove=False):
"""Filter metadata properties to be consistent with netCDF4.
Notes
-----
removed forced to True if coltype consistent with a string type
Parameters
----------
mdata_dict : dic... | def _filter_netcdf4_metadata(self, mdata_dict, coltype, remove=False):
"""Filter metadata properties to be consistent with netCDF4.
Notes
-----
removed forced to True if coltype consistent with a string type
Parameters
----------
mdata_dict : dic... | [
"Filter",
"metadata",
"properties",
"to",
"be",
"consistent",
"with",
"netCDF4",
".",
"Notes",
"-----",
"removed",
"forced",
"to",
"True",
"if",
"coltype",
"consistent",
"with",
"a",
"string",
"type",
"Parameters",
"----------",
"mdata_dict",
":",
"dict",
"Dicti... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1305-L1346 | [
"def",
"_filter_netcdf4_metadata",
"(",
"self",
",",
"mdata_dict",
",",
"coltype",
",",
"remove",
"=",
"False",
")",
":",
"# Coerce boolean types to integers",
"for",
"key",
"in",
"mdata_dict",
":",
"if",
"type",
"(",
"mdata_dict",
"[",
"key",
"]",
")",
"==",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument.generic_meta_translator | Translates the metadate contained in an object into a dictionary
suitable for export.
Parameters
----------
meta_to_translate : Meta
The metadata object to translate
Returns
-------
dict
A dictionary of the metadata for each variable of a... | pysat/_instrument.py | def generic_meta_translator(self, meta_to_translate):
'''Translates the metadate contained in an object into a dictionary
suitable for export.
Parameters
----------
meta_to_translate : Meta
The metadata object to translate
Returns
-------
dic... | def generic_meta_translator(self, meta_to_translate):
'''Translates the metadate contained in an object into a dictionary
suitable for export.
Parameters
----------
meta_to_translate : Meta
The metadata object to translate
Returns
-------
dic... | [
"Translates",
"the",
"metadate",
"contained",
"in",
"an",
"object",
"into",
"a",
"dictionary",
"suitable",
"for",
"export",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1348-L1406 | [
"def",
"generic_meta_translator",
"(",
"self",
",",
"meta_to_translate",
")",
":",
"export_dict",
"=",
"{",
"}",
"if",
"self",
".",
"_meta_translation_table",
"is",
"not",
"None",
":",
"# Create a translation table for the actual values of the meta labels.",
"# The instrume... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Instrument.to_netcdf4 | Stores loaded data into a netCDF4 file.
Parameters
----------
fname : string
full path to save instrument object to
base_instrument : pysat.Instrument
used as a comparison, only attributes that are present with
self and not on base_instrument ... | pysat/_instrument.py | def to_netcdf4(self, fname=None, base_instrument=None, epoch_name='Epoch',
zlib=False, complevel=4, shuffle=True):
"""Stores loaded data into a netCDF4 file.
Parameters
----------
fname : string
full path to save instrument object to
base_i... | def to_netcdf4(self, fname=None, base_instrument=None, epoch_name='Epoch',
zlib=False, complevel=4, shuffle=True):
"""Stores loaded data into a netCDF4 file.
Parameters
----------
fname : string
full path to save instrument object to
base_i... | [
"Stores",
"loaded",
"data",
"into",
"a",
"netCDF4",
"file",
".",
"Parameters",
"----------",
"fname",
":",
"string",
"full",
"path",
"to",
"save",
"instrument",
"object",
"to",
"base_instrument",
":",
"pysat",
".",
"Instrument",
"used",
"as",
"a",
"comparison"... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_instrument.py#L1409-L1823 | [
"def",
"to_netcdf4",
"(",
"self",
",",
"fname",
"=",
"None",
",",
"base_instrument",
"=",
"None",
",",
"epoch_name",
"=",
"'Epoch'",
",",
"zlib",
"=",
"False",
",",
"complevel",
"=",
"4",
",",
"shuffle",
"=",
"True",
")",
":",
"import",
"netCDF4",
"imp... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | to_alu_hlu_map | Converter for alu hlu map
Convert following input into a alu -> hlu map:
Sample input:
```
HLU Number ALU Number
---------- ----------
0 12
1 23
```
ALU stands for array LUN number
hlu stands for host LUN number
:param input_... | storops/lib/converter.py | def to_alu_hlu_map(input_str):
"""Converter for alu hlu map
Convert following input into a alu -> hlu map:
Sample input:
```
HLU Number ALU Number
---------- ----------
0 12
1 23
```
ALU stands for array LUN number
hlu stands... | def to_alu_hlu_map(input_str):
"""Converter for alu hlu map
Convert following input into a alu -> hlu map:
Sample input:
```
HLU Number ALU Number
---------- ----------
0 12
1 23
```
ALU stands for array LUN number
hlu stands... | [
"Converter",
"for",
"alu",
"hlu",
"map"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L126-L158 | [
"def",
"to_alu_hlu_map",
"(",
"input_str",
")",
":",
"ret",
"=",
"{",
"}",
"if",
"input_str",
"is",
"not",
"None",
":",
"pattern",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\s*(\\d+)'",
")",
"for",
"line",
"in",
"input_str",
".",
"split",
"(",
"'\\n'",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | to_disk_indices | Convert following input to disk indices
Sample input:
```
Disks:
Bus 0 Enclosure 0 Disk 9
Bus 1 Enclosure 0 Disk 12
Bus 1 Enclosure 0 Disk 9
Bus 0 Enclosure 0 Disk 4
Bus 0 Enclosure 0 Disk 7
```
:param value: disk list
:return: disk indices in list | storops/lib/converter.py | def to_disk_indices(value):
"""Convert following input to disk indices
Sample input:
```
Disks:
Bus 0 Enclosure 0 Disk 9
Bus 1 Enclosure 0 Disk 12
Bus 1 Enclosure 0 Disk 9
Bus 0 Enclosure 0 Disk 4
Bus 0 Enclosure 0 Disk 7
```
:param value: disk list
:return: disk indic... | def to_disk_indices(value):
"""Convert following input to disk indices
Sample input:
```
Disks:
Bus 0 Enclosure 0 Disk 9
Bus 1 Enclosure 0 Disk 12
Bus 1 Enclosure 0 Disk 9
Bus 0 Enclosure 0 Disk 4
Bus 0 Enclosure 0 Disk 7
```
:param value: disk list
:return: disk indic... | [
"Convert",
"following",
"input",
"to",
"disk",
"indices"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L161-L190 | [
"def",
"to_disk_indices",
"(",
"value",
")",
":",
"ret",
"=",
"[",
"]",
"p",
"=",
"re",
".",
"compile",
"(",
"r'Bus\\s+(\\w+)\\s+Enclosure\\s+(\\w+)\\s+Disk\\s+(\\w+)'",
")",
"if",
"value",
"is",
"not",
"None",
":",
"for",
"line",
"in",
"value",
".",
"split"... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | url_to_host | convert a url to a host (ip or domain)
:param url: url string
:returns: host: domain name or ipv4/v6 address
:rtype: str
:raises: ValueError: given an illegal url that without a ip or domain name | storops/lib/converter.py | def url_to_host(url):
"""convert a url to a host (ip or domain)
:param url: url string
:returns: host: domain name or ipv4/v6 address
:rtype: str
:raises: ValueError: given an illegal url that without a ip or domain name
"""
regex_url = r"([a-z][a-z0-9+\-.]*://)?" + \
r"([a... | def url_to_host(url):
"""convert a url to a host (ip or domain)
:param url: url string
:returns: host: domain name or ipv4/v6 address
:rtype: str
:raises: ValueError: given an illegal url that without a ip or domain name
"""
regex_url = r"([a-z][a-z0-9+\-.]*://)?" + \
r"([a... | [
"convert",
"a",
"url",
"to",
"a",
"host",
"(",
"ip",
"or",
"domain",
")"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L235-L254 | [
"def",
"url_to_host",
"(",
"url",
")",
":",
"regex_url",
"=",
"r\"([a-z][a-z0-9+\\-.]*://)?\"",
"+",
"r\"([a-z0-9\\-._~%!$&'()*+,;=]+@)?\"",
"+",
"r\"([a-z0-9\\-._~%]+\"",
"+",
"r\"|\\[[a-z0-9\\-._~%!$&'()*+,;=:]+\\])?\"",
"+",
"r\"(:(?P<port>[0-9]+))?\"",
"m",
"=",
"re",
"."... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | parse_host_address | parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address
:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
cidr prefix if there is,
net mask code string if there is
:rtype: (s... | storops/lib/converter.py | def parse_host_address(addr):
"""
parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address
:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
cidr prefix if there is,
net m... | def parse_host_address(addr):
"""
parse host address to get domain name or ipv4/v6 address,
cidr prefix and net mask code string if given a subnet address
:param addr:
:type addr: str
:return: parsed domain name/ipv4 address/ipv6 address,
cidr prefix if there is,
net m... | [
"parse",
"host",
"address",
"to",
"get",
"domain",
"name",
"or",
"ipv4",
"/",
"v6",
"address",
"cidr",
"prefix",
"and",
"net",
"mask",
"code",
"string",
"if",
"given",
"a",
"subnet",
"address"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L257-L286 | [
"def",
"parse_host_address",
"(",
"addr",
")",
":",
"if",
"addr",
".",
"startswith",
"(",
"'['",
")",
"and",
"addr",
".",
"endswith",
"(",
"']'",
")",
":",
"addr",
"=",
"addr",
"[",
"1",
":",
"-",
"1",
"]",
"parts",
"=",
"addr",
".",
"split",
"("... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | ipv4_prefix_to_mask | ipv4 cidr prefix to net mask
:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str | storops/lib/converter.py | def ipv4_prefix_to_mask(prefix):
"""
ipv4 cidr prefix to net mask
:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str
"""
if prefix > 32 or prefix < 0:
raise ValueError("invalid cidr prefix for i... | def ipv4_prefix_to_mask(prefix):
"""
ipv4 cidr prefix to net mask
:param prefix: cidr prefix , rang in (0, 32)
:type prefix: int
:return: dot separated ipv4 net mask code, eg: 255.255.255.0
:rtype: str
"""
if prefix > 32 or prefix < 0:
raise ValueError("invalid cidr prefix for i... | [
"ipv4",
"cidr",
"prefix",
"to",
"net",
"mask"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L289-L309 | [
"def",
"ipv4_prefix_to_mask",
"(",
"prefix",
")",
":",
"if",
"prefix",
">",
"32",
"or",
"prefix",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"invalid cidr prefix for ipv4\"",
")",
"else",
":",
"mask",
"=",
"(",
"(",
"1",
"<<",
"32",
")",
"-",
"1",
")... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | ipv6_prefix_to_mask | ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str | storops/lib/converter.py | def ipv6_prefix_to_mask(prefix):
"""
ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str
"""
if prefix > 128 or prefix < 0:
r... | def ipv6_prefix_to_mask(prefix):
"""
ipv6 cidr prefix to net mask
:param prefix: cidr prefix, rang in (0, 128)
:type prefix: int
:return: comma separated ipv6 net mask code,
eg: ffff:ffff:ffff:ffff:0000:0000:0000:0000
:rtype: str
"""
if prefix > 128 or prefix < 0:
r... | [
"ipv6",
"cidr",
"prefix",
"to",
"net",
"mask"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/converter.py#L312-L333 | [
"def",
"ipv6_prefix_to_mask",
"(",
"prefix",
")",
":",
"if",
"prefix",
">",
"128",
"or",
"prefix",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"invalid cidr prefix for ipv6\"",
")",
"else",
":",
"mask",
"=",
"(",
"(",
"1",
"<<",
"128",
")",
"-",
"1",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityLun.expand | expand the LUN to a new size
:param new_size: new size in bytes.
:return: the old size | storops/unity/resource/lun.py | def expand(self, new_size):
""" expand the LUN to a new size
:param new_size: new size in bytes.
:return: the old size
"""
ret = self.size_total
resp = self.modify(size=new_size)
resp.raise_if_err()
return ret | def expand(self, new_size):
""" expand the LUN to a new size
:param new_size: new size in bytes.
:return: the old size
"""
ret = self.size_total
resp = self.modify(size=new_size)
resp.raise_if_err()
return ret | [
"expand",
"the",
"LUN",
"to",
"a",
"new",
"size"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L195-L204 | [
"def",
"expand",
"(",
"self",
",",
"new_size",
")",
":",
"ret",
"=",
"self",
".",
"size_total",
"resp",
"=",
"self",
".",
"modify",
"(",
"size",
"=",
"new_size",
")",
"resp",
".",
"raise_if_err",
"(",
")",
"return",
"ret"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityLun.update_hosts | Primarily for puppet-unity use.
Update the hosts for the lun if needed.
:param host_names: specify the new hosts which access the LUN. | storops/unity/resource/lun.py | def update_hosts(self, host_names):
"""Primarily for puppet-unity use.
Update the hosts for the lun if needed.
:param host_names: specify the new hosts which access the LUN.
"""
if self.host_access:
curr_hosts = [access.host.name for access in self.host_access]
... | def update_hosts(self, host_names):
"""Primarily for puppet-unity use.
Update the hosts for the lun if needed.
:param host_names: specify the new hosts which access the LUN.
"""
if self.host_access:
curr_hosts = [access.host.name for access in self.host_access]
... | [
"Primarily",
"for",
"puppet",
"-",
"unity",
"use",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L314-L340 | [
"def",
"update_hosts",
"(",
"self",
",",
"host_names",
")",
":",
"if",
"self",
".",
"host_access",
":",
"curr_hosts",
"=",
"[",
"access",
".",
"host",
".",
"name",
"for",
"access",
"in",
"self",
".",
"host_access",
"]",
"else",
":",
"curr_hosts",
"=",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityLun.replicate | Creates a replication session with a existing lun as destination.
:param dst_lun_id: destination lun id.
:param max_time_out_of_sync: maximum time to wait before syncing the
source and destination. Value `-1` means the automatic sync is not
performed. `0` means it is a sync repl... | storops/unity/resource/lun.py | def replicate(self, dst_lun_id, max_time_out_of_sync,
replication_name=None, replicate_existing_snaps=None,
remote_system=None):
"""
Creates a replication session with a existing lun as destination.
:param dst_lun_id: destination lun id.
:param max_ti... | def replicate(self, dst_lun_id, max_time_out_of_sync,
replication_name=None, replicate_existing_snaps=None,
remote_system=None):
"""
Creates a replication session with a existing lun as destination.
:param dst_lun_id: destination lun id.
:param max_ti... | [
"Creates",
"a",
"replication",
"session",
"with",
"a",
"existing",
"lun",
"as",
"destination",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L415-L437 | [
"def",
"replicate",
"(",
"self",
",",
"dst_lun_id",
",",
"max_time_out_of_sync",
",",
"replication_name",
"=",
"None",
",",
"replicate_existing_snaps",
"=",
"None",
",",
"remote_system",
"=",
"None",
")",
":",
"return",
"UnityReplicationSession",
".",
"create",
"(... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityLun.replicate_with_dst_resource_provisioning | Creates a replication session with destination lun provisioning.
:param max_time_out_of_sync: maximum time to wait before syncing the
source and destination. Value `-1` means the automatic sync is not
performed. `0` means it is a sync replication.
:param dst_pool_id: id of pool ... | storops/unity/resource/lun.py | def replicate_with_dst_resource_provisioning(self, max_time_out_of_sync,
dst_pool_id,
dst_lun_name=None,
remote_system=None,
... | def replicate_with_dst_resource_provisioning(self, max_time_out_of_sync,
dst_pool_id,
dst_lun_name=None,
remote_system=None,
... | [
"Creates",
"a",
"replication",
"session",
"with",
"destination",
"lun",
"provisioning",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/lun.py#L439-L480 | [
"def",
"replicate_with_dst_resource_provisioning",
"(",
"self",
",",
"max_time_out_of_sync",
",",
"dst_pool_id",
",",
"dst_lun_name",
"=",
"None",
",",
"remote_system",
"=",
"None",
",",
"replication_name",
"=",
"None",
",",
"dst_size",
"=",
"None",
",",
"dst_sp",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityIpPort.get_physical_port | Returns the link aggregation object or the ethernet port object. | storops/unity/resource/port.py | def get_physical_port(self):
"""Returns the link aggregation object or the ethernet port object."""
obj = None
if self.is_link_aggregation():
obj = UnityLinkAggregation.get(self._cli, self.get_id())
else:
obj = UnityEthernetPort.get(self._cli, self.get_id())
... | def get_physical_port(self):
"""Returns the link aggregation object or the ethernet port object."""
obj = None
if self.is_link_aggregation():
obj = UnityLinkAggregation.get(self._cli, self.get_id())
else:
obj = UnityEthernetPort.get(self._cli, self.get_id())
... | [
"Returns",
"the",
"link",
"aggregation",
"object",
"or",
"the",
"ethernet",
"port",
"object",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/port.py#L51-L58 | [
"def",
"get_physical_port",
"(",
"self",
")",
":",
"obj",
"=",
"None",
"if",
"self",
".",
"is_link_aggregation",
"(",
")",
":",
"obj",
"=",
"UnityLinkAggregation",
".",
"get",
"(",
"self",
".",
"_cli",
",",
"self",
".",
"get_id",
"(",
")",
")",
"else",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityResourceConfig.to_embedded | Constructs an embeded object of `UnityResourceConfig`.
:param pool_id: storage pool of the resource.
:param is_thin_enabled: is thin type or not.
:param is_deduplication_enabled: is deduplication enabled or not.
:param is_compression_enabled: is in-line compression (ILC) enabled or
... | storops/unity/resource/replication_session.py | def to_embedded(pool_id=None, is_thin_enabled=None,
is_deduplication_enabled=None, is_compression_enabled=None,
is_backup_only=None, size=None, tiering_policy=None,
request_id=None, src_id=None, name=None, default_sp=None,
replication_resou... | def to_embedded(pool_id=None, is_thin_enabled=None,
is_deduplication_enabled=None, is_compression_enabled=None,
is_backup_only=None, size=None, tiering_policy=None,
request_id=None, src_id=None, name=None, default_sp=None,
replication_resou... | [
"Constructs",
"an",
"embeded",
"object",
"of",
"UnityResourceConfig",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L56-L88 | [
"def",
"to_embedded",
"(",
"pool_id",
"=",
"None",
",",
"is_thin_enabled",
"=",
"None",
",",
"is_deduplication_enabled",
"=",
"None",
",",
"is_compression_enabled",
"=",
"None",
",",
"is_backup_only",
"=",
"None",
",",
"size",
"=",
"None",
",",
"tiering_policy",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityReplicationSession.create | Creates a replication session.
:param cli: the rest cli.
:param src_resource_id: id of the replication source, could be
lun/fs/cg.
:param dst_resource_id: id of the replication destination.
:param max_time_out_of_sync: maximum time to wait before syncing the
sour... | storops/unity/resource/replication_session.py | def create(cls, cli, src_resource_id, dst_resource_id,
max_time_out_of_sync, name=None, members=None,
auto_initiate=None, hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
replicate_existing_snaps=None, remote_system=None,
... | def create(cls, cli, src_resource_id, dst_resource_id,
max_time_out_of_sync, name=None, members=None,
auto_initiate=None, hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
replicate_existing_snaps=None, remote_system=None,
... | [
"Creates",
"a",
"replication",
"session",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L94-L156 | [
"def",
"create",
"(",
"cls",
",",
"cli",
",",
"src_resource_id",
",",
"dst_resource_id",
",",
"max_time_out_of_sync",
",",
"name",
"=",
"None",
",",
"members",
"=",
"None",
",",
"auto_initiate",
"=",
"None",
",",
"hourly_snap_replication_policy",
"=",
"None",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityReplicationSession.create_with_dst_resource_provisioning | Create a replication session along with destination resource
provisioning.
:param cli: the rest cli.
:param src_resource_id: id of the replication source, could be
lun/fs/cg.
:param dst_resource_config: `UnityResourceConfig` object. The user
chosen config for des... | storops/unity/resource/replication_session.py | def create_with_dst_resource_provisioning(
cls, cli, src_resource_id, dst_resource_config,
max_time_out_of_sync, name=None, remote_system=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None,
dst_resource_element... | def create_with_dst_resource_provisioning(
cls, cli, src_resource_id, dst_resource_config,
max_time_out_of_sync, name=None, remote_system=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None,
dst_resource_element... | [
"Create",
"a",
"replication",
"session",
"along",
"with",
"destination",
"resource",
"provisioning",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L159-L236 | [
"def",
"create_with_dst_resource_provisioning",
"(",
"cls",
",",
"cli",
",",
"src_resource_id",
",",
"dst_resource_config",
",",
"max_time_out_of_sync",
",",
"name",
"=",
"None",
",",
"remote_system",
"=",
"None",
",",
"src_spa_interface",
"=",
"None",
",",
"src_spb... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityReplicationSession.modify | Modifies properties of a replication session.
:param max_time_out_of_sync: same as the one in `create` method.
:param name: same as the one in `create` method.
:param hourly_snap_replication_policy: same as the one in `create`
method.
:param daily_snap_replication_policy: sa... | storops/unity/resource/replication_session.py | def modify(self, max_time_out_of_sync=None, name=None,
hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Modifies proper... | def modify(self, max_time_out_of_sync=None, name=None,
hourly_snap_replication_policy=None,
daily_snap_replication_policy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Modifies proper... | [
"Modifies",
"properties",
"of",
"a",
"replication",
"session",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L238-L268 | [
"def",
"modify",
"(",
"self",
",",
"max_time_out_of_sync",
"=",
"None",
",",
"name",
"=",
"None",
",",
"hourly_snap_replication_policy",
"=",
"None",
",",
"daily_snap_replication_policy",
"=",
"None",
",",
"src_spa_interface",
"=",
"None",
",",
"src_spb_interface",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityReplicationSession.resume | Resumes a replication session.
This can be applied on replication session when it's operational status
is reported as Failed over, or Paused.
:param force_full_copy: needed when replication session goes out of
sync due to a fault.
True - replicate all data.
... | storops/unity/resource/replication_session.py | def resume(self, force_full_copy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Resumes a replication session.
This can be applied on replication session when it's operational status
is reported as... | def resume(self, force_full_copy=None,
src_spa_interface=None, src_spb_interface=None,
dst_spa_interface=None, dst_spb_interface=None):
"""
Resumes a replication session.
This can be applied on replication session when it's operational status
is reported as... | [
"Resumes",
"a",
"replication",
"session",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L270-L296 | [
"def",
"resume",
"(",
"self",
",",
"force_full_copy",
"=",
"None",
",",
"src_spa_interface",
"=",
"None",
",",
"src_spb_interface",
"=",
"None",
",",
"dst_spa_interface",
"=",
"None",
",",
"dst_spb_interface",
"=",
"None",
")",
":",
"req_body",
"=",
"self",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityReplicationSession.failover | Fails over a replication session.
:param sync: True - sync the source and destination resources before
failing over the asynchronous replication session or keep them in
sync after failing over the synchronous replication session.
False - don't sync.
:param force: Tru... | storops/unity/resource/replication_session.py | def failover(self, sync=None, force=None):
"""
Fails over a replication session.
:param sync: True - sync the source and destination resources before
failing over the asynchronous replication session or keep them in
sync after failing over the synchronous replication ses... | def failover(self, sync=None, force=None):
"""
Fails over a replication session.
:param sync: True - sync the source and destination resources before
failing over the asynchronous replication session or keep them in
sync after failing over the synchronous replication ses... | [
"Fails",
"over",
"a",
"replication",
"session",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L319-L335 | [
"def",
"failover",
"(",
"self",
",",
"sync",
"=",
"None",
",",
"force",
"=",
"None",
")",
":",
"req_body",
"=",
"self",
".",
"_cli",
".",
"make_body",
"(",
"sync",
"=",
"sync",
",",
"force",
"=",
"force",
")",
"resp",
"=",
"self",
".",
"action",
... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityReplicationSession.failback | Fails back a replication session.
This can be applied on a replication session that is failed over. Fail
back will synchronize the changes done to original destination back to
original source site and will restore the original direction of
session.
:param force_full_copy: indic... | storops/unity/resource/replication_session.py | def failback(self, force_full_copy=None):
"""
Fails back a replication session.
This can be applied on a replication session that is failed over. Fail
back will synchronize the changes done to original destination back to
original source site and will restore the original direct... | def failback(self, force_full_copy=None):
"""
Fails back a replication session.
This can be applied on a replication session that is failed over. Fail
back will synchronize the changes done to original destination back to
original source site and will restore the original direct... | [
"Fails",
"back",
"a",
"replication",
"session",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/replication_session.py#L337-L354 | [
"def",
"failback",
"(",
"self",
",",
"force_full_copy",
"=",
"None",
")",
":",
"req_body",
"=",
"self",
".",
"_cli",
".",
"make_body",
"(",
"forceFullCopy",
"=",
"force_full_copy",
")",
"resp",
"=",
"self",
".",
"action",
"(",
"'failback'",
",",
"*",
"*"... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | Orbits._calcOrbits | Prepares data structure for breaking data into orbits. Not intended
for end user. | pysat/_orbits.py | def _calcOrbits(self):
"""Prepares data structure for breaking data into orbits. Not intended
for end user."""
# if the breaks between orbit have not been defined, define them
# also, store the data so that grabbing different orbits does not
# require reloads of whole dataset
... | def _calcOrbits(self):
"""Prepares data structure for breaking data into orbits. Not intended
for end user."""
# if the breaks between orbit have not been defined, define them
# also, store the data so that grabbing different orbits does not
# require reloads of whole dataset
... | [
"Prepares",
"data",
"structure",
"for",
"breaking",
"data",
"into",
"orbits",
".",
"Not",
"intended",
"for",
"end",
"user",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L157-L169 | [
"def",
"_calcOrbits",
"(",
"self",
")",
":",
"# if the breaks between orbit have not been defined, define them",
"# also, store the data so that grabbing different orbits does not",
"# require reloads of whole dataset",
"if",
"len",
"(",
"self",
".",
"_orbit_breaks",
")",
"==",
"0"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Orbits._equaBreaks | Determine where breaks in an equatorial satellite orbit occur.
Looks for negative gradients in local time (or longitude) as well as
breaks in UT.
Parameters
----------
orbit_index_period : float
The change in value of supplied index parameter for a single orbit | pysat/_orbits.py | def _equaBreaks(self, orbit_index_period=24.):
"""Determine where breaks in an equatorial satellite orbit occur.
Looks for negative gradients in local time (or longitude) as well as
breaks in UT.
Parameters
----------
orbit_index_period : float
The change in... | def _equaBreaks(self, orbit_index_period=24.):
"""Determine where breaks in an equatorial satellite orbit occur.
Looks for negative gradients in local time (or longitude) as well as
breaks in UT.
Parameters
----------
orbit_index_period : float
The change in... | [
"Determine",
"where",
"breaks",
"in",
"an",
"equatorial",
"satellite",
"orbit",
"occur",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L171-L300 | [
"def",
"_equaBreaks",
"(",
"self",
",",
"orbit_index_period",
"=",
"24.",
")",
":",
"if",
"self",
".",
"orbit_index",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Orbit properties must be defined at '",
"+",
"'pysat.Instrument object instantiation.'",
"+",
"'See I... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Orbits._polarBreaks | Determine where breaks in a polar orbiting satellite orbit occur.
Looks for sign changes in latitude (magnetic or geographic) as well as
breaks in UT. | pysat/_orbits.py | def _polarBreaks(self):
"""Determine where breaks in a polar orbiting satellite orbit occur.
Looks for sign changes in latitude (magnetic or geographic) as well as
breaks in UT.
"""
if self.orbit_index is None:
raise ValueError('Orbit properties must be defined at ... | def _polarBreaks(self):
"""Determine where breaks in a polar orbiting satellite orbit occur.
Looks for sign changes in latitude (magnetic or geographic) as well as
breaks in UT.
"""
if self.orbit_index is None:
raise ValueError('Orbit properties must be defined at ... | [
"Determine",
"where",
"breaks",
"in",
"a",
"polar",
"orbiting",
"satellite",
"orbit",
"occur",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L302-L346 | [
"def",
"_polarBreaks",
"(",
"self",
")",
":",
"if",
"self",
".",
"orbit_index",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Orbit properties must be defined at '",
"+",
"'pysat.Instrument object instantiation.'",
"+",
"'See Instrument docs.'",
")",
"else",
":",
"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Orbits._orbitNumberBreaks | Determine where orbital breaks in a dataset with orbit numbers occur.
Looks for changes in unique values. | pysat/_orbits.py | def _orbitNumberBreaks(self):
"""Determine where orbital breaks in a dataset with orbit numbers occur.
Looks for changes in unique values.
"""
if self.orbit_index is None:
raise ValueError('Orbit properties must be defined at ' +
'pysat.Instrum... | def _orbitNumberBreaks(self):
"""Determine where orbital breaks in a dataset with orbit numbers occur.
Looks for changes in unique values.
"""
if self.orbit_index is None:
raise ValueError('Orbit properties must be defined at ' +
'pysat.Instrum... | [
"Determine",
"where",
"orbital",
"breaks",
"in",
"a",
"dataset",
"with",
"orbit",
"numbers",
"occur",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L348-L383 | [
"def",
"_orbitNumberBreaks",
"(",
"self",
")",
":",
"if",
"self",
".",
"orbit_index",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'Orbit properties must be defined at '",
"+",
"'pysat.Instrument object instantiation.'",
"+",
"'See Instrument docs.'",
")",
"else",
":... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Orbits._getBasicOrbit | Load a particular orbit into .data for loaded day.
Parameters
----------
orbit : int
orbit number, 1 indexed, negative indexes allowed, -1 last orbit
Note
----
A day of data must be loaded before this routine functions properly.
If the last orbit of ... | pysat/_orbits.py | def _getBasicOrbit(self, orbit=None):
"""Load a particular orbit into .data for loaded day.
Parameters
----------
orbit : int
orbit number, 1 indexed, negative indexes allowed, -1 last orbit
Note
----
A day of data must be loaded before this routine ... | def _getBasicOrbit(self, orbit=None):
"""Load a particular orbit into .data for loaded day.
Parameters
----------
orbit : int
orbit number, 1 indexed, negative indexes allowed, -1 last orbit
Note
----
A day of data must be loaded before this routine ... | [
"Load",
"a",
"particular",
"orbit",
"into",
".",
"data",
"for",
"loaded",
"day",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L385-L434 | [
"def",
"_getBasicOrbit",
"(",
"self",
",",
"orbit",
"=",
"None",
")",
":",
"# ensure data exists",
"if",
"not",
"self",
".",
"sat",
".",
"empty",
":",
"# ensure proper orbit metadata present",
"self",
".",
"_calcOrbits",
"(",
")",
"# ensure user is requesting a part... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Orbits.load | Load a particular orbit into .data for loaded day.
Parameters
----------
orbit : int
orbit number, 1 indexed
Note
----
A day of data must be loaded before this routine functions properly.
If the last orbit of the day is requested, it will automat... | pysat/_orbits.py | def load(self, orbit=None):
"""Load a particular orbit into .data for loaded day.
Parameters
----------
orbit : int
orbit number, 1 indexed
Note
----
A day of data must be loaded before this routine functions properly.
If the last orbit o... | def load(self, orbit=None):
"""Load a particular orbit into .data for loaded day.
Parameters
----------
orbit : int
orbit number, 1 indexed
Note
----
A day of data must be loaded before this routine functions properly.
If the last orbit o... | [
"Load",
"a",
"particular",
"orbit",
"into",
".",
"data",
"for",
"loaded",
"day",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L436-L516 | [
"def",
"load",
"(",
"self",
",",
"orbit",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"sat",
".",
"empty",
":",
"# ensure data exists",
"# set up orbit metadata",
"self",
".",
"_calcOrbits",
"(",
")",
"# ensure user supplied an orbit",
"if",
"orbit",
"is"... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | Orbits.next | Load the next orbit into .data.
Note
----
Forms complete orbits across day boundaries. If no data loaded
then the first orbit from the first date of data is returned. | pysat/_orbits.py | def next(self, *arg, **kwarg):
"""Load the next orbit into .data.
Note
----
Forms complete orbits across day boundaries. If no data loaded
then the first orbit from the first date of data is returned.
"""
# first, check if data exists
if not self.sat.emp... | def next(self, *arg, **kwarg):
"""Load the next orbit into .data.
Note
----
Forms complete orbits across day boundaries. If no data loaded
then the first orbit from the first date of data is returned.
"""
# first, check if data exists
if not self.sat.emp... | [
"Load",
"the",
"next",
"orbit",
"into",
".",
"data",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/_orbits.py#L518-L657 | [
"def",
"next",
"(",
"self",
",",
"*",
"arg",
",",
"*",
"*",
"kwarg",
")",
":",
"# first, check if data exists",
"if",
"not",
"self",
".",
"sat",
".",
"empty",
":",
"# set up orbit metadata",
"self",
".",
"_calcOrbits",
"(",
")",
"# if current orbit near the la... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load | Load Kp index files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
---------
data : (pandas.DataFrame)
Object ... | pysat/instruments/sw_dst.py | def load(fnames, tag=None, sat_id=None):
"""Load Kp index files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-------... | def load(fnames, tag=None, sat_id=None):
"""Load Kp index files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-------... | [
"Load",
"Kp",
"index",
"files"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/sw_dst.py#L42-L118 | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
")",
":",
"data",
"=",
"pds",
".",
"DataFrame",
"(",
")",
"for",
"filename",
"in",
"fnames",
":",
"# need to remove date appended to dst filename",
"fname",
"=",
"filename",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | _parse | Basic parser to deal with date format of the Kp file. | pysat/instruments/sw_kp.py | def _parse(yr, mo, day):
"""
Basic parser to deal with date format of the Kp file.
"""
yr = '20'+yr
yr = int(yr)
mo = int(mo)
day = int(day)
return pds.datetime(yr, mo, day) | def _parse(yr, mo, day):
"""
Basic parser to deal with date format of the Kp file.
"""
yr = '20'+yr
yr = int(yr)
mo = int(mo)
day = int(day)
return pds.datetime(yr, mo, day) | [
"Basic",
"parser",
"to",
"deal",
"with",
"date",
"format",
"of",
"the",
"Kp",
"file",
"."
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/sw_kp.py#L45-L54 | [
"def",
"_parse",
"(",
"yr",
",",
"mo",
",",
"day",
")",
":",
"yr",
"=",
"'20'",
"+",
"yr",
"yr",
"=",
"int",
"(",
"yr",
")",
"mo",
"=",
"int",
"(",
"mo",
")",
"day",
"=",
"int",
"(",
"day",
")",
"return",
"pds",
".",
"datetime",
"(",
"yr",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | load | Load Kp index files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
---------
data : (pandas.DataFrame)
Object ... | pysat/instruments/sw_kp.py | def load(fnames, tag=None, sat_id=None):
"""Load Kp index files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-------... | def load(fnames, tag=None, sat_id=None):
"""Load Kp index files
Parameters
------------
fnames : (pandas.Series)
Series of filenames
tag : (str or NoneType)
tag or None (default=None)
sat_id : (str or NoneType)
satellite id or None (default=None)
Returns
-------... | [
"Load",
"Kp",
"index",
"files"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/sw_kp.py#L57-L129 | [
"def",
"load",
"(",
"fnames",
",",
"tag",
"=",
"None",
",",
"sat_id",
"=",
"None",
")",
":",
"# Kp data stored monthly, need to return data daily",
"# the daily date is attached to filename",
"# parse off the last date, load month of data, downselect to desired day",
"data",
"=",... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | download | Routine to download Kp index data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '1min' and '5min'.
(default=None)
sat_id : (string or NoneType)
Specifies the satellite ID for a constellation. Not used.
(default=None)... | pysat/instruments/sw_kp.py | def download(date_array, tag, sat_id, data_path, user=None, password=None):
"""Routine to download Kp index data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '1min' and '5min'.
(default=None)
sat_id : (string or NoneType)
... | def download(date_array, tag, sat_id, data_path, user=None, password=None):
"""Routine to download Kp index data
Parameters
-----------
tag : (string or NoneType)
Denotes type of file to load. Accepted types are '1min' and '5min'.
(default=None)
sat_id : (string or NoneType)
... | [
"Routine",
"to",
"download",
"Kp",
"index",
"data"
] | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/sw_kp.py#L183-L234 | [
"def",
"download",
"(",
"date_array",
",",
"tag",
",",
"sat_id",
",",
"data_path",
",",
"user",
"=",
"None",
",",
"password",
"=",
"None",
")",
":",
"import",
"ftplib",
"from",
"ftplib",
"import",
"FTP",
"import",
"sys",
"ftp",
"=",
"FTP",
"(",
"'ftp.g... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | filter_geoquiet | Filters pysat.Instrument data for given time after Kp drops below gate.
Loads Kp data for the same timeframe covered by sat and sets sat.data to
NaN for times when Kp > maxKp and for filterTime after Kp drops below maxKp.
Parameters
----------
sat : pysat.Instrument
Instrument to b... | pysat/instruments/sw_kp.py | def filter_geoquiet(sat, maxKp=None, filterTime=None, kpData=None, kp_inst=None):
"""Filters pysat.Instrument data for given time after Kp drops below gate.
Loads Kp data for the same timeframe covered by sat and sets sat.data to
NaN for times when Kp > maxKp and for filterTime after Kp drops below max... | def filter_geoquiet(sat, maxKp=None, filterTime=None, kpData=None, kp_inst=None):
"""Filters pysat.Instrument data for given time after Kp drops below gate.
Loads Kp data for the same timeframe covered by sat and sets sat.data to
NaN for times when Kp > maxKp and for filterTime after Kp drops below max... | [
"Filters",
"pysat",
".",
"Instrument",
"data",
"for",
"given",
"time",
"after",
"Kp",
"drops",
"below",
"gate",
".",
"Loads",
"Kp",
"data",
"for",
"the",
"same",
"timeframe",
"covered",
"by",
"sat",
"and",
"sets",
"sat",
".",
"data",
"to",
"NaN",
"for",
... | rstoneback/pysat | python | https://github.com/rstoneback/pysat/blob/4ae1afd80e15e4449397d39dce8c3e969c32c422/pysat/instruments/sw_kp.py#L236-L286 | [
"def",
"filter_geoquiet",
"(",
"sat",
",",
"maxKp",
"=",
"None",
",",
"filterTime",
"=",
"None",
",",
"kpData",
"=",
"None",
",",
"kp_inst",
"=",
"None",
")",
":",
"if",
"kp_inst",
"is",
"not",
"None",
":",
"kp_inst",
".",
"load",
"(",
"date",
"=",
... | 4ae1afd80e15e4449397d39dce8c3e969c32c422 |
train | ParserConfigFactory._get_converter | find converter function reference by name
find converter by name, converter name follows this convention:
Class.method
or:
method
The first type of converter class/function must be available in
current module.
The second type of converter must be avai... | storops/lib/parser.py | def _get_converter(self, converter_str):
"""find converter function reference by name
find converter by name, converter name follows this convention:
Class.method
or:
method
The first type of converter class/function must be available in
current modul... | def _get_converter(self, converter_str):
"""find converter function reference by name
find converter by name, converter name follows this convention:
Class.method
or:
method
The first type of converter class/function must be available in
current modul... | [
"find",
"converter",
"function",
"reference",
"by",
"name"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/lib/parser.py#L398-L443 | [
"def",
"_get_converter",
"(",
"self",
",",
"converter_str",
")",
":",
"ret",
"=",
"None",
"if",
"converter_str",
"is",
"not",
"None",
":",
"converter_desc_list",
"=",
"converter_str",
".",
"split",
"(",
"'.'",
")",
"if",
"len",
"(",
"converter_desc_list",
")... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | SSHConnector.copy_file_to_remote | scp the local file to remote folder.
:param local_path: local path
:param remote_path: remote path | storops/connection/connector.py | def copy_file_to_remote(self, local_path, remote_path):
"""scp the local file to remote folder.
:param local_path: local path
:param remote_path: remote path
"""
sftp_client = self.transport.open_sftp_client()
LOG.debug('Copy the local file to remote. '
... | def copy_file_to_remote(self, local_path, remote_path):
"""scp the local file to remote folder.
:param local_path: local path
:param remote_path: remote path
"""
sftp_client = self.transport.open_sftp_client()
LOG.debug('Copy the local file to remote. '
... | [
"scp",
"the",
"local",
"file",
"to",
"remote",
"folder",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/connection/connector.py#L177-L192 | [
"def",
"copy_file_to_remote",
"(",
"self",
",",
"local_path",
",",
"remote_path",
")",
":",
"sftp_client",
"=",
"self",
".",
"transport",
".",
"open_sftp_client",
"(",
")",
"LOG",
".",
"debug",
"(",
"'Copy the local file to remote. '",
"'Source=%(src)s. Target=%(targe... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | SSHConnector.get_remote_file | Fetch remote File.
:param remote_path: remote path
:param local_path: local path | storops/connection/connector.py | def get_remote_file(self, remote_path, local_path):
"""Fetch remote File.
:param remote_path: remote path
:param local_path: local path
"""
sftp_client = self.transport.open_sftp_client()
LOG.debug('Get the remote file. '
'Source=%(src)s. Target=%(targe... | def get_remote_file(self, remote_path, local_path):
"""Fetch remote File.
:param remote_path: remote path
:param local_path: local path
"""
sftp_client = self.transport.open_sftp_client()
LOG.debug('Get the remote file. '
'Source=%(src)s. Target=%(targe... | [
"Fetch",
"remote",
"File",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/connection/connector.py#L194-L209 | [
"def",
"get_remote_file",
"(",
"self",
",",
"remote_path",
",",
"local_path",
")",
":",
"sftp_client",
"=",
"self",
".",
"transport",
".",
"open_sftp_client",
"(",
")",
"LOG",
".",
"debug",
"(",
"'Get the remote file. '",
"'Source=%(src)s. Target=%(target)s.'",
"%",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | SSHConnector.close | Closes the ssh connection. | storops/connection/connector.py | def close(self):
"""Closes the ssh connection."""
if 'isLive' in self.__dict__ and self.isLive:
self.transport.close()
self.isLive = False | def close(self):
"""Closes the ssh connection."""
if 'isLive' in self.__dict__ and self.isLive:
self.transport.close()
self.isLive = False | [
"Closes",
"the",
"ssh",
"connection",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/connection/connector.py#L211-L215 | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"'isLive'",
"in",
"self",
".",
"__dict__",
"and",
"self",
".",
"isLive",
":",
"self",
".",
"transport",
".",
"close",
"(",
")",
"self",
".",
"isLive",
"=",
"False"
] | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | xml_request | indicate the return value is a xml api request
:param check_invalid_data_mover:
:param check_object:
:return: the response of this request | storops/vnx/nas_client.py | def xml_request(check_object=False, check_invalid_data_mover=False):
""" indicate the return value is a xml api request
:param check_invalid_data_mover:
:param check_object:
:return: the response of this request
"""
def decorator(f):
@functools.wraps(f)
def func_wrapper(self, *... | def xml_request(check_object=False, check_invalid_data_mover=False):
""" indicate the return value is a xml api request
:param check_invalid_data_mover:
:param check_object:
:return: the response of this request
"""
def decorator(f):
@functools.wraps(f)
def func_wrapper(self, *... | [
"indicate",
"the",
"return",
"value",
"is",
"a",
"xml",
"api",
"request"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/nas_client.py#L127-L145 | [
"def",
"xml_request",
"(",
"check_object",
"=",
"False",
",",
"check_invalid_data_mover",
"=",
"False",
")",
":",
"def",
"decorator",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"func_wrapper",
"(",
"self",
",",
"*",
"argv",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | nas_command | indicate it's a command of nas command run with ssh
:param f: function that returns the command in list
:return: command execution result | storops/vnx/nas_client.py | def nas_command(f):
""" indicate it's a command of nas command run with ssh
:param f: function that returns the command in list
:return: command execution result
"""
@functools.wraps(f)
def func_wrapper(self, *argv, **kwargs):
commands = f(self, *argv, **kwargs)
return self.ssh... | def nas_command(f):
""" indicate it's a command of nas command run with ssh
:param f: function that returns the command in list
:return: command execution result
"""
@functools.wraps(f)
def func_wrapper(self, *argv, **kwargs):
commands = f(self, *argv, **kwargs)
return self.ssh... | [
"indicate",
"it",
"s",
"a",
"command",
"of",
"nas",
"command",
"run",
"with",
"ssh"
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/nas_client.py#L152-L164 | [
"def",
"nas_command",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"func_wrapper",
"(",
"self",
",",
"*",
"argv",
",",
"*",
"*",
"kwargs",
")",
":",
"commands",
"=",
"f",
"(",
"self",
",",
"*",
"argv",
",",
"*",
"*"... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySnap.restore | Restore the snapshot to the associated storage resource.
:param backup: name of the backup snapshot
:param delete_backup: Whether to delete the backup snap after a
successful restore. | storops/unity/resource/snap.py | def restore(self, backup=None, delete_backup=False):
"""Restore the snapshot to the associated storage resource.
:param backup: name of the backup snapshot
:param delete_backup: Whether to delete the backup snap after a
successful restore.
"""
resp ... | def restore(self, backup=None, delete_backup=False):
"""Restore the snapshot to the associated storage resource.
:param backup: name of the backup snapshot
:param delete_backup: Whether to delete the backup snap after a
successful restore.
"""
resp ... | [
"Restore",
"the",
"snapshot",
"to",
"the",
"associated",
"storage",
"resource",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/snap.py#L154-L172 | [
"def",
"restore",
"(",
"self",
",",
"backup",
"=",
"None",
",",
"delete_backup",
"=",
"False",
")",
":",
"resp",
"=",
"self",
".",
"_cli",
".",
"action",
"(",
"self",
".",
"resource_class",
",",
"self",
".",
"get_id",
"(",
")",
",",
"'restore'",
",",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySnap.thin_clone | Creates a new thin clone from this snapshot.
.. note:: this snapshot should not enable Auto-Delete. | storops/unity/resource/snap.py | def thin_clone(self, name, io_limit_policy=None, description=None):
"""Creates a new thin clone from this snapshot.
.. note:: this snapshot should not enable Auto-Delete.
"""
if self.is_member_snap():
raise UnityCGMemberActionNotSupportError()
if self.lun and not sel... | def thin_clone(self, name, io_limit_policy=None, description=None):
"""Creates a new thin clone from this snapshot.
.. note:: this snapshot should not enable Auto-Delete.
"""
if self.is_member_snap():
raise UnityCGMemberActionNotSupportError()
if self.lun and not sel... | [
"Creates",
"a",
"new",
"thin",
"clone",
"from",
"this",
"snapshot",
".",
"..",
"note",
"::",
"this",
"snapshot",
"should",
"not",
"enable",
"Auto",
"-",
"Delete",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/snap.py#L184-L195 | [
"def",
"thin_clone",
"(",
"self",
",",
"name",
",",
"io_limit_policy",
"=",
"None",
",",
"description",
"=",
"None",
")",
":",
"if",
"self",
".",
"is_member_snap",
"(",
")",
":",
"raise",
"UnityCGMemberActionNotSupportError",
"(",
")",
"if",
"self",
".",
"... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnitySnap.delete | Deletes the snapshot.
:param async_mode: whether to delete the snapshot in async mode.
:param even_attached: whether to delete the snapshot even it is
attached to hosts. | storops/unity/resource/snap.py | def delete(self, async_mode=False, even_attached=False):
"""Deletes the snapshot.
:param async_mode: whether to delete the snapshot in async mode.
:param even_attached: whether to delete the snapshot even it is
attached to hosts.
"""
try:
return super(Uni... | def delete(self, async_mode=False, even_attached=False):
"""Deletes the snapshot.
:param async_mode: whether to delete the snapshot in async mode.
:param even_attached: whether to delete the snapshot even it is
attached to hosts.
"""
try:
return super(Uni... | [
"Deletes",
"the",
"snapshot",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/resource/snap.py#L201-L221 | [
"def",
"delete",
"(",
"self",
",",
"async_mode",
"=",
"False",
",",
"even_attached",
"=",
"False",
")",
":",
"try",
":",
"return",
"super",
"(",
"UnitySnap",
",",
"self",
")",
".",
"delete",
"(",
"async_mode",
"=",
"async_mode",
")",
"except",
"UnityDele... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityClient.get_all | Get the resource by resource id.
:param nested_fields: nested resource fields
:param base_fields: fields of this resource
:param the_filter: dictionary of filter like `{'name': 'abc'}`
:param type_name: Resource type. For example, pool, lun, nasServer.
:return: List of resource ... | storops/unity/client.py | def get_all(self, type_name, base_fields=None, the_filter=None,
nested_fields=None):
"""Get the resource by resource id.
:param nested_fields: nested resource fields
:param base_fields: fields of this resource
:param the_filter: dictionary of filter like `{'name': 'abc'}... | def get_all(self, type_name, base_fields=None, the_filter=None,
nested_fields=None):
"""Get the resource by resource id.
:param nested_fields: nested resource fields
:param base_fields: fields of this resource
:param the_filter: dictionary of filter like `{'name': 'abc'}... | [
"Get",
"the",
"resource",
"by",
"resource",
"id",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/client.py#L63-L84 | [
"def",
"get_all",
"(",
"self",
",",
"type_name",
",",
"base_fields",
"=",
"None",
",",
"the_filter",
"=",
"None",
",",
"nested_fields",
"=",
"None",
")",
":",
"fields",
"=",
"self",
".",
"get_fields",
"(",
"type_name",
",",
"base_fields",
",",
"nested_fiel... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | UnityClient.get | Get the resource by resource id.
:param nested_fields: nested resource fields.
:param type_name: Resource type. For example, pool, lun, nasServer.
:param obj_id: Resource id
:param base_fields: Resource fields to return
:return: List of tuple [(name, res_inst)] | storops/unity/client.py | def get(self, type_name, obj_id, base_fields=None, nested_fields=None):
"""Get the resource by resource id.
:param nested_fields: nested resource fields.
:param type_name: Resource type. For example, pool, lun, nasServer.
:param obj_id: Resource id
:param base_fields: Resource f... | def get(self, type_name, obj_id, base_fields=None, nested_fields=None):
"""Get the resource by resource id.
:param nested_fields: nested resource fields.
:param type_name: Resource type. For example, pool, lun, nasServer.
:param obj_id: Resource id
:param base_fields: Resource f... | [
"Get",
"the",
"resource",
"by",
"resource",
"id",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/unity/client.py#L169-L180 | [
"def",
"get",
"(",
"self",
",",
"type_name",
",",
"obj_id",
",",
"base_fields",
"=",
"None",
",",
"nested_fields",
"=",
"None",
")",
":",
"base_fields",
"=",
"self",
".",
"get_fields",
"(",
"type_name",
",",
"base_fields",
",",
"nested_fields",
")",
"url",... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
train | VNXConnectionPortList._flat_vports | Flat the virtual ports. | storops/vnx/resource/port.py | def _flat_vports(self, connection_port):
"""Flat the virtual ports."""
vports = []
for vport in connection_port.virtual_ports:
self._set_child_props(connection_port, vport)
vports.append(vport)
return vports | def _flat_vports(self, connection_port):
"""Flat the virtual ports."""
vports = []
for vport in connection_port.virtual_ports:
self._set_child_props(connection_port, vport)
vports.append(vport)
return vports | [
"Flat",
"the",
"virtual",
"ports",
"."
] | emc-openstack/storops | python | https://github.com/emc-openstack/storops/blob/24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd/storops/vnx/resource/port.py#L334-L340 | [
"def",
"_flat_vports",
"(",
"self",
",",
"connection_port",
")",
":",
"vports",
"=",
"[",
"]",
"for",
"vport",
"in",
"connection_port",
".",
"virtual_ports",
":",
"self",
".",
"_set_child_props",
"(",
"connection_port",
",",
"vport",
")",
"vports",
".",
"app... | 24b4b13bf065c0ef0538dd0b5ebb8f25d24176bd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.