sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
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 Parameters ---------- data : pandas object Data to be written file_format : basestring String indicating netCDF3 or netCDF4 Returns ------- data_flag, datetime_flag, old_for...
entailment
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 Dictionary equivalent to Meta object info coltype : type ...
entailment
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. Parameters ---------- meta_to_translate : Meta The metadata object to translate Returns ------- dict A dictionary of the metadata for each variable of a...
entailment
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, only attributes that are present with self and not on base_instrument ...
entailment
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 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_...
entailment
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 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
entailment
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) :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
entailment
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 :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...
entailment
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 :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
entailment
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 :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
entailment
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 :param new_size: new size in bytes. :return: the old size
entailment
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. Update the hosts for the lun if needed. :param host_names: specify the new hosts which access the LUN.
entailment
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. :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...
entailment
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. :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 ...
entailment
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.
entailment
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`. :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 ...
entailment
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. :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...
entailment
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. :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...
entailment
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. :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...
entailment
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. 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. ...
entailment
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. :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...
entailment
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. 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...
entailment
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.
entailment
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. 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
entailment
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. Looks for sign changes in latitude (magnetic or geographic) as well as breaks in UT.
entailment
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. Looks for changes in unique values.
entailment
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. 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 ...
entailment
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. 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...
entailment
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. Note ---- Forms complete orbits across day boundaries. If no data loaded then the first orbit from the first date of data is returned.
entailment
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 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 ...
entailment
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.
entailment
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 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 ...
entailment
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 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)...
entailment
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 times when Kp > maxKp and for filterTime after Kp drops below maxKp. Parameters ---------- sat : pysat.Instrument Instrument to b...
entailment
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 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...
entailment
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. :param local_path: local path :param remote_path: remote path
entailment
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. :param remote_path: remote path :param local_path: local path
entailment
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.
entailment
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 :param check_invalid_data_mover: :param check_object: :return: the response of this request
entailment
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 :param f: function that returns the command in list :return: command execution result
entailment
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. :param backup: name of the backup snapshot :param delete_backup: Whether to delete the backup snap after a successful restore.
entailment
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.
entailment
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. :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.
entailment
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. :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 ...
entailment
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. :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)]
entailment
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.
entailment
def has_snap(self): """ This method won't count the snaps in "destroying" state! :return: false if no snaps or all snaps are destroying. """ return len(list(filter(lambda s: s.state != SnapStateEnum.DESTROYING, self.snapshots))) > 0
This method won't count the snaps in "destroying" state! :return: false if no snaps or all snaps are destroying.
entailment
def median2D(const, bin1, label1, bin2, label2, data_label, returnData=False): """Return a 2D average of data_label over a season and label1, label2. Parameters ---------- const: Constellation or Instrument bin#: [min, max, number of bins] label#: string i...
Return a 2D average of data_label over a season and label1, label2. Parameters ---------- const: Constellation or Instrument bin#: [min, max, number of bins] label#: string identifies data product for bin# data_label: list-like contains strings identify...
entailment
def get_rsc_list_2(self, rsc_clz_list=None): """get the list of resource list to collect based on clz list :param rsc_clz_list: the list of classes to collect :return: filtered list of resource list, like [VNXLunList(), VNXDiskList()] """ rsc_list_2 = self._defa...
get the list of resource list to collect based on clz list :param rsc_clz_list: the list of classes to collect :return: filtered list of resource list, like [VNXLunList(), VNXDiskList()]
entailment
def load(cosmicFiles, tag=None, sat_id=None): """ cosmic data load routine, called by pysat """ import netCDF4 num = len(cosmicFiles) # make sure there are files to read if num != 0: # call separate load_files routine, segemented for possible # multiprocessor load, not in...
cosmic data load routine, called by pysat
entailment
def load_files(files, tag=None, sat_id=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 = netCDF4.Dataset(file) ...
Loads a list of COSMIC data files, supplied by user. Returns a list of dicts, a dict for each file.
entailment
def download(date_array, tag, sat_id, data_path=None, user=None, password=None): """Downloads data from Madrigal. The user's names should be provided in field user. John Malkovich should be entered as John+Malkovich The password field should be the user's email address. These parameters ...
Downloads data from Madrigal. The user's names should be provided in field user. John Malkovich should be entered as John+Malkovich The password field should be the user's email address. These parameters are passed to Madrigal when downloading. The affiliation field is set to pysat ...
entailment
def clean(self): """Routine to return DMSP IVM data cleaned to the specified level 'Clean' enforces that both RPA and DM flags are <= 1 'Dusty' <= 2 'Dirty' <= 3 'None' None Routine is called by pysat, and not by the end user directly. Parameters ----------- inst : (pysat....
Routine to return DMSP IVM data cleaned to the specified level 'Clean' enforces that both RPA and DM flags are <= 1 'Dusty' <= 2 'Dirty' <= 3 'None' None Routine is called by pysat, and not by the end user directly. Parameters ----------- inst : (pysat.Instrument) Inst...
entailment
def create(cls, cli, management_address, local_username=None, local_password=None, remote_username=None, remote_password=None, connection_type=None): """ Configures a remote system for remote replication. :param cls: this class. :param cli: t...
Configures a remote system for remote replication. :param cls: this class. :param cli: the rest client. :param management_address: the management IP address of the remote system. :param local_username: administrative username of local system. :param local_password: a...
entailment
def modify(self, management_address=None, username=None, password=None, connection_type=None): """ Modifies a remote system for remote replication. :param management_address: same as the one in `create` method. :param username: username for accessing the remote system. ...
Modifies a remote system for remote replication. :param management_address: same as the one in `create` method. :param username: username for accessing the remote system. :param password: password for accessing the remote system. :param connection_type: same as the one in `create` metho...
entailment
def verify(self, connection_type=None): """ Verifies and update the remote system settings. :param connection_type: same as the one in `create` method. """ req_body = self._cli.make_body(connectionType=connection_type) resp = self.action('verify', **req_body) re...
Verifies and update the remote system settings. :param connection_type: same as the one in `create` method.
entailment
def create(cls, cli, sp, ip_port, ip_address, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on w...
Creates a replication interface. :param cls: this class. :param cli: the rest cli. :param sp: `UnityStorageProcessor` object. Storage processor on which the replication interface is running. :param ip_port: `UnityIpPort` object. Physical port or link aggregation ...
entailment
def modify(self, sp=None, ip_port=None, ip_address=None, netmask=None, v6_prefix_length=None, gateway=None, vlan_id=None): """ Modifies a replication interface. :param sp: same as the one in `create` method. :param ip_port: same as the one in `create` method. :par...
Modifies a replication interface. :param sp: same as the one in `create` method. :param ip_port: same as the one in `create` method. :param ip_address: same as the one in `create` method. :param netmask: same as the one in `create` method. :param v6_prefix_length: same as the on...
entailment
def sp_sum_values(self): """ return sp level values input: "values": { "spa": { "19": "385", "18": "0", "20": "0", "17": "0", "16": "0" }, "spb": { "19": "...
return sp level values input: "values": { "spa": { "19": "385", "18": "0", "20": "0", "17": "0", "16": "0" }, "spb": { "19": "101", "18": "101", ...
entailment
def sum_sp_values(self): """ return system level values (spa + spb) input: "values": { "spa": 385, "spb": 505 }, return: "values": { "0": 890 }, """ if self.values is None: ret = IdValues() ...
return system level values (spa + spb) input: "values": { "spa": 385, "spb": 505 }, return: "values": { "0": 890 },
entailment
def combine_numeric_values(self, other): """ numeric_values * sp_values """ if self.values is None: ret = IdValues() else: ret = sum([IdValues( {k: int(v) * int(other.values[key]) for k, v in value.items()}) for key, value i...
numeric_values * sp_values
entailment
def combine_sp_values(self, other): """ sp_values * sp_values """ if self.values is None: ret = IdValues() else: ret = IdValues({k: int(v) * int(other.values[k]) for k, v in self.values.items()}) return ret
sp_values * sp_values
entailment
def sum_combined_sp_values(self, other): """ sum(sp_values * sp_values) """ if self.values is None: ret = IdValues() else: ret = IdValues({'0': sum(int(x) for x in {k: int(v) * int(other.values[k]) for k, v ...
sum(sp_values * sp_values)
entailment
def add(self, function, kind='add', at_pos='end',*args, **kwargs): """Add a function to custom processing queue. Custom functions are applied automatically to associated pysat instrument whenever instrument.load command called. Parameters ---------- functio...
Add a function to custom processing queue. Custom functions are applied automatically to associated pysat instrument whenever instrument.load command called. Parameters ---------- function : string or function object name of function or function obj...
entailment
def _apply_all(self, sat): """ Apply all of the custom functions to the satellite data object. """ if len(self._functions) > 0: for func, arg, kwarg, kind in zip(self._functions, self._args, self._kwargs, self._kind): ...
Apply all of the custom functions to the satellite data object.
entailment
def clear(self): """Clear custom function list.""" self._functions=[] self._args=[] self._kwargs=[] self._kind=[]
Clear custom function list.
entailment
def list_files(tag='north', sat_id=None, data_path=None, format_str=None): """Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string) Denotes type of file to load. Accepted types are 'north' and 'south'. (default='north') sat_id : (strin...
Return a Pandas Series of every file for chosen satellite data Parameters ----------- tag : (string) Denotes type of file to load. Accepted types are 'north' and 'south'. (default='north') sat_id : (string or NoneType) Specifies the satellite ID for a constellation. Not used. ...
entailment
def download(date_array, tag, sat_id, data_path, user=None, password=None): """ Download SuperDARN data from Virginia Tech organized for loading by pysat. """ import sys import os import pysftp import davitpy if user is None: user = os.environ['DBREADUSER'] if password...
Download SuperDARN data from Virginia Tech organized for loading by pysat.
entailment
def same_disks(self, count=2): """ filter self to the required number of disks with same size and type Select the disks with the same type and same size. If not enough disks available, set self to empty. :param count: number of disks to retrieve :return: disk list """ ...
filter self to the required number of disks with same size and type Select the disks with the same type and same size. If not enough disks available, set self to empty. :param count: number of disks to retrieve :return: disk list
entailment
def set_bounds(self, start, stop): """ Sets boundaries for all instruments in constellation """ for instrument in self.instruments: instrument.bounds = (start, stop)
Sets boundaries for all instruments in constellation
entailment
def data_mod(self, *args, **kwargs): """ Register a function to modify data of member Instruments. The function is not partially applied to modify member data. When the Constellation receives a function call to register a function for data modification, it passes the call to ea...
Register a function to modify data of member Instruments. The function is not partially applied to modify member data. When the Constellation receives a function call to register a function for data modification, it passes the call to each instrument and registers it in the instrument's pysat....
entailment
def load(self, *args, **kwargs): """ Load instrument data into instrument object.data (Wraps pysat.Instrument.load; documentation of that function is reproduced here.) Parameters --------- yr : integer Year for desired data doy : integer ...
Load instrument data into instrument object.data (Wraps pysat.Instrument.load; documentation of that function is reproduced here.) Parameters --------- yr : integer Year for desired data doy : integer day of year data : datetime object ...
entailment
def add(self, bounds1, label1, bounds2, label2, bin3, label3, data_label): """ Combines signals from multiple instruments within given bounds. Parameters ---------- bounds1 : (min, max) Bounds for selecting data on the axis of label1 D...
Combines signals from multiple instruments within given bounds. Parameters ---------- bounds1 : (min, max) Bounds for selecting data on the axis of label1 Data points with label1 in [min, max) will be considered. label1 : string Data label for...
entailment
def difference(self, instrument1, instrument2, bounds, data_labels, cost_function): """ Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must ...
Calculates the difference in signals from multiple instruments within the given bounds. Parameters ---------- instrument1 : Instrument Information must already be loaded into the instrument. instrument2 : Instrument Information must already b...
entailment
def daily2D(inst, bin1, label1, bin2, label2, data_label, gate, returnBins=False): """2D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate at least once per day, then a 100% occurrence probability results.Season delineated by the bounds attached to...
2D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate at least once per day, then a 100% occurrence probability results.Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
entailment
def by_orbit2D(inst, bin1, label1, bin2, label2, data_label, gate, returnBins=False): """2D Occurrence Probability of data_label orbit-by-orbit over a season. If data_label is greater than gate atleast once per orbit, then a 100% occurrence probability results. Season delineated by the bounds atta...
2D Occurrence Probability of data_label orbit-by-orbit over a season. If data_label is greater than gate atleast once per orbit, then a 100% occurrence probability results. Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
entailment
def daily3D(inst, bin1, label1, bin2, label2, bin3, label3, data_label, gate, returnBins=False): """3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by...
3D Daily Occurrence Probability of data_label > gate over a season. If data_label is greater than gate atleast once per day, then a 100% occurrence probability results. Season delineated by the bounds attached to Instrument object. Prob = (# of times with at least one hit)/(# of times in bin) ...
entailment
def computational_form(data): """ Input Series of numbers, Series, or DataFrames repackaged for calculation. Parameters ---------- data : pandas.Series Series of numbers, Series, DataFrames Returns ------- pandas.Series, DataFrame, or Panel repacked data, aligned by...
Input Series of numbers, Series, or DataFrames repackaged for calculation. Parameters ---------- data : pandas.Series Series of numbers, Series, DataFrames Returns ------- pandas.Series, DataFrame, or Panel repacked data, aligned by indices, ready for calculation
entailment
def set_data_dir(path=None, store=None): """ Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs """ import ...
Set the top level directory pysat uses to look for data and reload. Parameters ---------- path : string valid path to directory pysat uses to look for data store : bool if True, store data directory for future runs
entailment
def load_netcdf4(fnames=None, strict_meta=False, file_format=None, epoch_name='Epoch', units_label='units', name_label='long_name', notes_label='notes', desc_label='desc', plot_label='label', axis_label='axis', scale_label='scale', m...
Load netCDF-3/4 file produced by pysat. Parameters ---------- fnames : string or array_like of strings filenames to load strict_meta : boolean check if metadata across fnames is the same file_format : string file_format keyword passed to netCDF4 routine NETCDF3_CLASS...
entailment
def getyrdoy(date): """Return a tuple of year, day of year for a supplied datetime object.""" try: doy = date.toordinal()-datetime(date.year,1,1).toordinal()+1 except AttributeError: raise AttributeError("Must supply a pandas datetime object or " + "equivalent")...
Return a tuple of year, day of year for a supplied datetime object.
entailment
def season_date_range(start, stop, freq='D'): """ Return array of datetime objects using input frequency from start to stop Supports single datetime object or list, tuple, ndarray of start and stop dates. freq codes correspond to pandas date_range codes, D daily, M monthly, S secondly """...
Return array of datetime objects using input frequency from start to stop Supports single datetime object or list, tuple, ndarray of start and stop dates. freq codes correspond to pandas date_range codes, D daily, M monthly, S secondly
entailment
def create_datetime_index(year=None, month=None, day=None, uts=None): """Create a timeseries index using supplied year, month, day, and ut in seconds. Parameters ---------- year : array_like of ints month : array_like of ints or None day : array_like of ints for day...
Create a timeseries index using supplied year, month, day, and ut in seconds. Parameters ---------- year : array_like of ints month : array_like of ints or None day : array_like of ints for day (default) or day of year (use month=None) uts : array_like of floats...
entailment
def nan_circmean(samples, high=2.0*np.pi, low=0.0, axis=None): """NaN insensitive version of scipy's circular mean routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or i...
NaN insensitive version of scipy's circular mean routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or int Upper boundary for circular standard deviation range (defau...
entailment
def nan_circstd(samples, high=2.0*np.pi, low=0.0, axis=None): """NaN insensitive version of scipy's circular standard deviation routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) hig...
NaN insensitive version of scipy's circular standard deviation routine Parameters ----------- samples : array_like Input array low : float or int Lower boundary for circular standard deviation range (default=0) high: float or int Upper boundary for circular standard deviatio...
entailment
def default(inst): """Default routine to be applied when loading data. Removes redundant naming """ import pysat.instruments.icon_ivm as icivm inst.tag = 'level_2' icivm.remove_icon_names(inst, target='ICON_L2_EUV_Daytime_OP_')
Default routine to be applied when loading data. Removes redundant naming
entailment
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2 """ desc = None level = tag if level == 'level_1': code = 'L1' desc = None elif level == 'level_2': code = 'L...
Produce a list of ICON EUV files. Notes ----- Currently fixed to level-2
entailment
def shadow_copy(self): """ Return a copy of the resource with same raw data :return: copy of the resource """ ret = self.__class__() if not self._is_updated(): # before copy, make sure source is updated. self.update() ret._parsed_resource = self._...
Return a copy of the resource with same raw data :return: copy of the resource
entailment
def load(fnames, tag=None, sat_id=None, **kwargs): """Loads data using pysat.utils.load_netcdf4 . This routine is called as needed by pysat. It is not intended for direct user interaction. Parameters ---------- fnames : array-like iterable of filename strings, full path, to data fi...
Loads data using pysat.utils.load_netcdf4 . This routine is called as needed by pysat. It is not intended for direct user interaction. Parameters ---------- fnames : array-like iterable of filename strings, full path, to data files to be loaded. This input is nominally provided...
entailment
def list_files(tag=None, sat_id=None, data_path=None, format_str=None): """Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' inp...
Produce a list of files corresponding to format_str located at data_path. This routine is invoked by pysat and is not intended for direct use by the end user. Multiple data levels may be supported via the 'tag' and 'sat_id' input strings. Parameters ---------- tag : string ('') tag na...
entailment
def command(f): """ indicate it's a command of naviseccli :param f: function that returns the command in list :return: command execution result """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): if 'ip' in kwargs: ip = kwargs['ip'] del kwargs['ip']...
indicate it's a command of naviseccli :param f: function that returns the command in list :return: command execution result
entailment
def duel_command(f): """ indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2) """ @functools.wraps(f) def func_wrapper(self, *argv, **kwargs): commands = _get_commands(f, self...
indicate it's a command need to be called on both SP :param f: function that returns the command in list :return: command execution result on both sps (tuple of 2)
entailment
def supplement_filesystem(old_size, user_cap=False): """Return new size accounting for the metadata.""" new_size = old_size if user_cap: if old_size <= _GiB_to_Byte(1.5): new_size = _GiB_to_Byte(3) else: new_size += _GiB_to_Byte(1.5) return int(new_size)
Return new size accounting for the metadata.
entailment
def synchronized(cls, obj=None): """ synchronize on obj if obj is supplied. :param obj: the obj to lock on. if none, lock to the function :return: return of the func. """ def get_key(f, o): if o is None: key = hash(f) else: ...
synchronize on obj if obj is supplied. :param obj: the obj to lock on. if none, lock to the function :return: return of the func.
entailment
def re_enqueue(self, item): """Re-enqueue till reach max retries.""" if 'retries' in item: retries = item['retries'] if retries >= self.MAX_RETRIES: log.warn("Failed to execute {} after {} retries, give it " " up.".format(item['method'], r...
Re-enqueue till reach max retries.
entailment
def _support_op(*args): """Internal decorator to define an criteria compare operations.""" def inner(func): for one_arg in args: _op_mapping_[one_arg] = func return func return inner
Internal decorator to define an criteria compare operations.
entailment
def clean(inst): """Routine to return VEFI data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) ...
Routine to return VEFI data cleaned to the specified level Parameters ----------- inst : (pysat.Instrument) Instrument class object, whose attribute clean_level is used to return the desired level of data selectivity. Returns -------- Void : (NoneType) data in inst is m...
entailment
def remove_icon_names(inst, target=None): """Removes leading text on ICON project variable names Parameters ---------- inst : pysat.Instrument ICON associated pysat.Instrument object target : str Leading string to remove. If none supplied, ICON project standards are used to ...
Removes leading text on ICON project variable names Parameters ---------- inst : pysat.Instrument ICON associated pysat.Instrument object target : str Leading string to remove. If none supplied, ICON project standards are used to identify and remove leading text Ret...
entailment
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 '1min' and '5min'. (default=None) sat_id : (s...
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 '1min' and '5min'. (default=None) sat_id : (string or NoneType) Specifies the satellite ID for a constellation. Not...
entailment
def time_shift_to_magnetic_poles(inst): """ OMNI data is time-shifted to bow shock. Time shifted again to intersections with magnetic pole. Parameters ----------- inst : Instrument class object Instrument with OMNI HRO data Notes --------- Time shift calculated using distance t...
OMNI data is time-shifted to bow shock. Time shifted again to intersections with magnetic pole. Parameters ----------- inst : Instrument class object Instrument with OMNI HRO data Notes --------- Time shift calculated using distance to bow shock nose (BSN) and velocity of solar...
entailment