_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q19900 | Users.set_privilege | train | def set_privilege(self, name, value=None):
"""Configures the user privilege value in EOS
Args:
name (str): The name of the user to craete
value (int): The privilege value to assign to the user. Valid
values are in the range of 0 to 15
Returns:
... | python | {
"resource": ""
} |
q19901 | Users.set_role | train | def set_role(self, name, value=None, default=False, disable=False):
"""Configures the user role vale in EOS
Args:
name (str): The name of the user to create
value (str): The value to configure for the user role
default (bool): Configure the user role using the EOS ... | python | {
"resource": ""
} |
q19902 | make_connection | train | def make_connection(transport, **kwargs):
""" Creates a connection instance based on the transport
This function creates the EapiConnection object based on the desired
transport. It looks up the transport class in the TRANSPORTS global
dictionary.
Args:
transport (string): The transport t... | python | {
"resource": ""
} |
q19903 | connect | train | def connect(transport=None, host='localhost', username='admin',
password='', port=None, timeout=60, return_node=False, **kwargs):
""" Creates a connection using the supplied settings
This function will create a connection to an Arista EOS node using
the arguments. All arguments are optional wi... | python | {
"resource": ""
} |
q19904 | connect_to | train | def connect_to(name):
"""Creates a node instance based on an entry from the config
This function will retrieve the settings for the specified connection
from the config and return a Node instance. The configuration must
be loaded prior to calling this function.
Args:
name (str): The name ... | python | {
"resource": ""
} |
q19905 | Config.connections | train | def connections(self):
"""
Returns all of the loaded connections names as a list
"""
conn = lambda x: str(x).replace('connection:', '')
return [conn(name) for name in self.sections()] | python | {
"resource": ""
} |
q19906 | Config.autoload | train | def autoload(self):
""" Loads the eapi.conf file
This method will use the module variable CONFIG_SEARCH_PATH to
attempt to locate a valid eapi.conf file if a filename is not already
configured. This method will load the first eapi.conf file it
finds and then return.
T... | python | {
"resource": ""
} |
q19907 | Config.read | train | def read(self, filename):
"""Reads the file specified by filename
This method will load the eapi.conf file specified by filename into
the instance object. It will also add the default connection localhost
if it was not defined in the eapi.conf file
Args:
filename (... | python | {
"resource": ""
} |
q19908 | Config.generate_tags | train | def generate_tags(self):
""" Generates the tags with collection with hosts
"""
self.tags = dict()
for section in self.sections():
if self.has_option(section, 'tags'):
tags = self.get(section, 'tags')
for tag in [str(t).strip() for t in tags.spl... | python | {
"resource": ""
} |
q19909 | Config.reload | train | def reload(self):
"""Reloades the configuration
This method will reload the configuration instance using the last
known filename. Note this method will initially clear the
configuration and reload all entries.
"""
for section in self.sections():
self.remove... | python | {
"resource": ""
} |
q19910 | Config.get_connection | train | def get_connection(self, name):
"""Returns the properties for a connection name
This method will return the settings for the configuration specified
by name. Note that the name argument should only be the name.
For instance, give the following eapi.conf file
.. code-block:: i... | python | {
"resource": ""
} |
q19911 | Config.add_connection | train | def add_connection(self, name, **kwargs):
"""Adds a connection to the configuration
This method will add a connection to the configuration. The connection
added is only available for the lifetime of the object and is not
persisted.
Note:
If a call is made to load()... | python | {
"resource": ""
} |
q19912 | Node._get_version_properties | train | def _get_version_properties(self):
"""Parses version and model information out of 'show version' output
and uses the output to populate class properties.
"""
# Parse out version info
output = self.enable('show version')
self._version = str(output[0]['result']['version'])
... | python | {
"resource": ""
} |
q19913 | Node.config | train | def config(self, commands, **kwargs):
"""Configures the node with the specified commands
This method is used to send configuration commands to the node. It
will take either a string or a list and prepend the necessary commands
to put the session into config mode.
Args:
... | python | {
"resource": ""
} |
q19914 | Node.section | train | def section(self, regex, config='running_config'):
"""Returns a section of the config
Args:
regex (str): A valid regular expression used to select sections
of configuration to return
config (str): The configuration to return. Valid values for config
... | python | {
"resource": ""
} |
q19915 | Node.enable | train | def enable(self, commands, encoding='json', strict=False,
send_enable=True, **kwargs):
"""Sends the array of commands to the node in enable mode
This method will send the commands to the node and evaluate
the results. If a command fails due to an encoding error,
then the... | python | {
"resource": ""
} |
q19916 | Node.run_commands | train | def run_commands(self, commands, encoding='json', send_enable=True,
**kwargs):
"""Sends the commands over the transport to the device
This method sends the commands to the device using the nodes
transport. This is a lower layer function that shouldn't normally
need... | python | {
"resource": ""
} |
q19917 | Node.api | train | def api(self, name, namespace='pyeapi.api'):
"""Loads the specified api module
This method is the API autoload mechanism that will load the API
module specified by the name argument. The API module will be loaded
and look first for an initialize() function and secondly for an
i... | python | {
"resource": ""
} |
q19918 | Node.get_config | train | def get_config(self, config='running-config', params=None,
as_string=False):
""" Retreives the config from the node
This method will retrieve the config from the node as either a string
or a list object. The config to retrieve can be specified as either
the startup-c... | python | {
"resource": ""
} |
q19919 | Routemaps.get | train | def get(self, name):
"""Provides a method to retrieve all routemap configuration
related to the name attribute.
Args:
name (string): The name of the routemap.
Returns:
None if the specified routemap does not exists. If the routermap
exists a dictiona... | python | {
"resource": ""
} |
q19920 | Routemaps.create | train | def create(self, name, action, seqno):
"""Creates a new routemap on the node
Note:
This method will attempt to create the routemap regardless
if the routemap exists or not. If the routemap already exists
then this method will still return True.
Args:
... | python | {
"resource": ""
} |
q19921 | Routemaps.delete | train | def delete(self, name, action, seqno):
"""Deletes the routemap from the node
Note:
This method will attempt to delete the routemap from the nodes
operational config. If the routemap does not exist then this
method will not perform any changes but still return True
... | python | {
"resource": ""
} |
q19922 | Routemaps.default | train | def default(self, name, action, seqno):
"""Defaults the routemap on the node
Note:
This method will attempt to default the routemap from the nodes
operational config. Since routemaps do not exist by default,
the default action is essentially a negation and the result... | python | {
"resource": ""
} |
q19923 | Routemaps.set_match_statements | train | def set_match_statements(self, name, action, seqno, statements):
"""Configures the match statements within the routemap clause.
The final configuration of match statements will reflect the list
of statements passed into the statements attribute. This implies
match statements found in the... | python | {
"resource": ""
} |
q19924 | Routemaps.set_continue | train | def set_continue(self, name, action, seqno, value=None, default=False,
disable=False):
"""Configures the routemap continue value
Args:
name (string): The full name of the routemap.
action (string): The action to take for this routemap clause.
seq... | python | {
"resource": ""
} |
q19925 | Routemaps.set_description | train | def set_description(self, name, action, seqno, value=None, default=False,
disable=False):
"""Configures the routemap description
Args:
name (string): The full name of the routemap.
action (string): The action to take for this routemap clause.
... | python | {
"resource": ""
} |
q19926 | EnsembleMethod._calc_delta | train | def _calc_delta(self,ensemble,scaling_matrix=None):
'''
calc the scaled ensemble differences from the mean
'''
mean = np.array(ensemble.mean(axis=0))
delta = ensemble.as_pyemu_matrix()
for i in range(ensemble.shape[0]):
delta.x[i,:] -= mean
if scaling... | python | {
"resource": ""
} |
q19927 | EnsembleMethod._calc_obs_local | train | def _calc_obs_local(self,parensemble):
'''
propagate the ensemble forward using sweep.
'''
self.logger.log("evaluating ensemble of size {0} locally with sweep".\
format(parensemble.shape[0]))
parensemble.to_csv(self.sweep_in_csv)
if self.num_slaves... | python | {
"resource": ""
} |
q19928 | concat | train | def concat(mats):
"""Concatenate Matrix objects. Tries either axis.
Parameters
----------
mats: list
list of Matrix objects
Returns
-------
Matrix : Matrix
"""
for mat in mats:
if mat.isdiagonal:
raise NotImplementedError("concat not supported for diago... | python | {
"resource": ""
} |
q19929 | get_common_elements | train | def get_common_elements(list1, list2):
"""find the common elements in two lists. used to support auto align
might be faster with sets
Parameters
----------
list1 : list
a list of objects
list2 : list
a list of objects
Returns
-------
list : list
list of... | python | {
"resource": ""
} |
q19930 | __set_svd | train | def __set_svd(self):
"""private method to set SVD components.
Note: this should not be called directly
"""
if self.isdiagonal:
x = np.diag(self.x.flatten())
else:
# just a pointer to x
x = self.x
try:
u, s, v = la.svd(x, ... | python | {
"resource": ""
} |
q19931 | element_isaligned | train | def element_isaligned(self, other):
"""check if matrices are aligned for element-wise operations
Parameters
----------
other : Matrix
Returns
-------
bool : bool
True if aligned, False if not aligned
"""
assert isinstance(other, Matri... | python | {
"resource": ""
} |
q19932 | as_2d | train | def as_2d(self):
""" get a 2D representation of x. If not self.isdiagonal, simply
return reference to self.x, otherwise, constructs and returns
a 2D, diagonal ndarray
Returns
-------
numpy.ndarray : numpy.ndarray
"""
if not self.isdiagonal:
... | python | {
"resource": ""
} |
q19933 | shape | train | def shape(self):
"""get the implied, 2D shape of self
Returns
-------
tuple : tuple
length 2 tuple of ints
"""
if self.__x is not None:
if self.isdiagonal:
return (max(self.__x.shape), max(self.__x.shape))
if len(self.... | python | {
"resource": ""
} |
q19934 | transpose | train | def transpose(self):
"""transpose operation of self
Returns
-------
Matrix : Matrix
transpose of self
"""
if not self.isdiagonal:
return type(self)(x=self.__x.copy().transpose(),
row_names=self.col_names,
... | python | {
"resource": ""
} |
q19935 | inv | train | def inv(self):
"""inversion operation of self
Returns
-------
Matrix : Matrix
inverse of self
"""
if self.isdiagonal:
inv = 1.0 / self.__x
if (np.any(~np.isfinite(inv))):
idx = np.isfinite(inv)
np.savet... | python | {
"resource": ""
} |
q19936 | get_maxsing | train | def get_maxsing(self,eigthresh=1.0e-5):
""" Get the number of singular components with a singular
value ratio greater than or equal to eigthresh
Parameters
----------
eigthresh : float
the ratio of the largest to smallest singular value
Returns
-----... | python | {
"resource": ""
} |
q19937 | pseudo_inv | train | def pseudo_inv(self,maxsing=None,eigthresh=1.0e-5):
""" The pseudo inverse of self. Formed using truncated singular
value decomposition and Matrix.pseudo_inv_components
Parameters
----------
maxsing : int
the number of singular components to use. If None,
... | python | {
"resource": ""
} |
q19938 | sqrt | train | def sqrt(self):
"""square root operation
Returns
-------
Matrix : Matrix
square root of self
"""
if self.isdiagonal:
return type(self)(x=np.sqrt(self.__x), isdiagonal=True,
row_names=self.row_names,
... | python | {
"resource": ""
} |
q19939 | full_s | train | def full_s(self):
""" Get the full singular value matrix of self
Returns
-------
Matrix : Matrix
"""
x = np.zeros((self.shape),dtype=np.float32)
x[:self.s.shape[0],:self.s.shape[0]] = self.s.as_2d
s = Matrix(x=x, row_names=self.row_names,
... | python | {
"resource": ""
} |
q19940 | zero2d | train | def zero2d(self):
""" get an 2D instance of self with all zeros
Returns
-------
Matrix : Matrix
"""
return type(self)(x=np.atleast_2d(np.zeros((self.shape[0],self.shape[1]))),
row_names=self.row_names,
col_names=self.col_names,
... | python | {
"resource": ""
} |
q19941 | Ensemble.as_pyemu_matrix | train | def as_pyemu_matrix(self,typ=Matrix):
"""
Create a pyemu.Matrix from the Ensemble.
Parameters
----------
typ : pyemu.Matrix or derived type
the type of matrix to return
Returns
-------
pyemu.Matrix : pyemu.Matrix
"""
... | python | {
"resource": ""
} |
q19942 | Ensemble.draw | train | def draw(self,cov,num_reals=1,names=None):
""" draw random realizations from a multivariate
Gaussian distribution
Parameters
----------
cov: pyemu.Cov
covariance structure to draw from
num_reals: int
number of realizations to generate
... | python | {
"resource": ""
} |
q19943 | Ensemble.plot | train | def plot(self,bins=10,facecolor='0.5',plot_cols=None,
filename="ensemble.pdf",func_dict = None,
**kwargs):
"""plot ensemble histograms to multipage pdf
Parameters
----------
bins : int
number of bins
facecolor : str
... | python | {
"resource": ""
} |
q19944 | Ensemble.from_dataframe | train | def from_dataframe(cls,**kwargs):
"""class method constructor to create an Ensemble from
a pandas.DataFrame
Parameters
----------
**kwargs : dict
optional args to pass to the
Ensemble Constructor. Expects 'df' in kwargs.keys()
that must be a ... | python | {
"resource": ""
} |
q19945 | Ensemble.copy | train | def copy(self):
"""make a deep copy of self
Returns
-------
Ensemble : Ensemble
"""
df = super(Ensemble,self).copy()
return type(self).from_dataframe(df=df) | python | {
"resource": ""
} |
q19946 | Ensemble.covariance_matrix | train | def covariance_matrix(self,localizer=None):
"""calculate the approximate covariance matrix implied by the ensemble using
mean-differencing operation at the core of EnKF
Parameters
----------
localizer : pyemu.Matrix
covariance localizer to apply
Retu... | python | {
"resource": ""
} |
q19947 | ObservationEnsemble.mean_values | train | def mean_values(self):
""" property decorated method to get mean values of observation noise.
This is a zero-valued pandas.Series
Returns
-------
mean_values : pandas Series
"""
vals = self.pst.observation_data.obsval.copy()
vals.loc[self.names] = 0.0
... | python | {
"resource": ""
} |
q19948 | ObservationEnsemble.nonzero | train | def nonzero(self):
""" property decorated method to get a new ObservationEnsemble
of only non-zero weighted observations
Returns
-------
ObservationEnsemble : ObservationEnsemble
"""
df = self.loc[:,self.pst.nnz_obs_names]
return ObservationEnsemble.from... | python | {
"resource": ""
} |
q19949 | ObservationEnsemble.from_binary | train | def from_binary(cls,pst,filename):
"""instantiate an observation obsemble from a jco-type file
Parameters
----------
pst : pyemu.Pst
a Pst instance
filename : str
the binary file name
Returns
-------
oe : ObservationEnsemble
... | python | {
"resource": ""
} |
q19950 | ParameterEnsemble.mean_values | train | def mean_values(self):
""" the mean value vector while respecting log transform
Returns
-------
mean_values : pandas.Series
"""
if not self.istransformed:
return self.pst.parameter_data.parval1.copy()
else:
# vals = (self.pst.parameter_da... | python | {
"resource": ""
} |
q19951 | ParameterEnsemble.adj_names | train | def adj_names(self):
""" Get the names of adjustable parameters in the ParameterEnsemble
Returns
-------
list : list
adjustable parameter names
"""
return list(self.pst.parameter_data.parnme.loc[~self.fixed_indexer]) | python | {
"resource": ""
} |
q19952 | ParameterEnsemble.ubnd | train | def ubnd(self):
""" the upper bound vector while respecting log transform
Returns
-------
ubnd : pandas.Series
"""
if not self.istransformed:
return self.pst.parameter_data.parubnd.copy()
else:
ub = self.pst.parameter_data.parubnd.copy()
... | python | {
"resource": ""
} |
q19953 | ParameterEnsemble.lbnd | train | def lbnd(self):
""" the lower bound vector while respecting log transform
Returns
-------
lbnd : pandas.Series
"""
if not self.istransformed:
return self.pst.parameter_data.parlbnd.copy()
else:
lb = self.pst.parameter_data.parlbnd.copy()
... | python | {
"resource": ""
} |
q19954 | ParameterEnsemble.fixed_indexer | train | def fixed_indexer(self):
""" indexer for fixed status
Returns
-------
fixed_indexer : pandas.Series
"""
#isfixed = self.pst.parameter_data.partrans == "fixed"
isfixed = self.pst.parameter_data.partrans.\
apply(lambda x : x in ["fixed","tied"])
... | python | {
"resource": ""
} |
q19955 | ParameterEnsemble.draw | train | def draw(self,cov,num_reals=1,how="normal",enforce_bounds=None):
"""draw realizations of parameter values
Parameters
----------
cov : pyemu.Cov
covariance matrix that describes the support around
the mean parameter values
num_reals : int
numbe... | python | {
"resource": ""
} |
q19956 | ParameterEnsemble.from_uniform_draw | train | def from_uniform_draw(cls,pst,num_reals):
""" instantiate a parameter ensemble from uniform draws
Parameters
----------
pst : pyemu.Pst
a control file instance
num_reals : int
number of realizations to generate
Returns
-------
Par... | python | {
"resource": ""
} |
q19957 | ParameterEnsemble.from_binary | train | def from_binary(cls, pst, filename):
"""instantiate an parameter obsemble from a jco-type file
Parameters
----------
pst : pyemu.Pst
a Pst instance
filename : str
the binary file name
Returns
-------
pe : ParameterEnsemble
... | python | {
"resource": ""
} |
q19958 | ParameterEnsemble._back_transform | train | def _back_transform(self,inplace=True):
""" Private method to remove log10 transformation from ensemble
Parameters
----------
inplace: bool
back transform self in place
Returns
------
ParameterEnsemble : ParameterEnsemble
if inplace if Fa... | python | {
"resource": ""
} |
q19959 | ParameterEnsemble._transform | train | def _transform(self,inplace=True):
""" Private method to perform log10 transformation for ensemble
Parameters
----------
inplace: bool
transform self in place
Returns
-------
ParameterEnsemble : ParameterEnsemble
if inplace is False
... | python | {
"resource": ""
} |
q19960 | ParameterEnsemble.project | train | def project(self,projection_matrix,inplace=True,log=None,
enforce_bounds="reset"):
""" project the ensemble using the null-space Monte Carlo method
Parameters
----------
projection_matrix : pyemu.Matrix
projection operator - must already respect log transform... | python | {
"resource": ""
} |
q19961 | ParameterEnsemble.enforce_drop | train | def enforce_drop(self):
""" enforce parameter bounds on the ensemble by dropping
violating realizations
"""
ub = self.ubnd
lb = self.lbnd
drop = []
for id in self.index:
#mx = (ub - self.loc[id,:]).min()
#mn = (lb - self.loc[id,:]).max()
... | python | {
"resource": ""
} |
q19962 | ParameterEnsemble.enforce_reset | train | def enforce_reset(self):
"""enforce parameter bounds on the ensemble by resetting
violating vals to bound
"""
ub = (self.ubnd * (1.0+self.bound_tol)).to_dict()
lb = (self.lbnd * (1.0 - self.bound_tol)).to_dict()
#for iname,name in enumerate(self.columns):
#se... | python | {
"resource": ""
} |
q19963 | ParameterEnsemble.to_binary | train | def to_binary(self,filename):
"""write the parameter ensemble to a jco-style binary file
Parameters
----------
filename : str
the filename to write
Returns
-------
None
Note
----
this function back-transforms inplace with re... | python | {
"resource": ""
} |
q19964 | ParameterEnsemble.to_parfiles | train | def to_parfiles(self,prefix):
"""
write the parameter ensemble to PEST-style parameter files
Parameters
----------
prefix: str
file prefix for par files
Note
----
this function back-transforms inplace with respect to
log10 before ... | python | {
"resource": ""
} |
q19965 | EnsembleKalmanFilter.forecast | train | def forecast(self,parensemble=None):
"""for the enkf formulation, this simply moves the ensemble forward by running the model
once for each realization"""
if parensemble is None:
parensemble = self.parensemble
self.logger.log("evaluating ensemble")
failed_runs, obsens... | python | {
"resource": ""
} |
q19966 | EnsembleKalmanFilter.update | train | def update(self):
"""update performs the analysis, then runs the forecast using the updated self.parensemble.
This can be called repeatedly to iterate..."""
parensemble = self.analysis_evensen()
obsensemble = self.forecast(parensemble=parensemble)
# todo: check for phi improveme... | python | {
"resource": ""
} |
q19967 | run | train | def run(cmd_str,cwd='.',verbose=False):
""" an OS agnostic function to execute a command line
Parameters
----------
cmd_str : str
the str to execute with os.system()
cwd : str
the directory to execute the command in
verbose : bool
flag to echo to stdout complete cmd st... | python | {
"resource": ""
} |
q19968 | RegData.write | train | def write(self,f):
""" write the regularization section to an open
file handle
Parameters
----------
f : file handle
"""
f.write("* regularization\n")
for vline in REG_VARIABLE_LINES:
vraw = vline.strip().split()
for v in vraw:
... | python | {
"resource": ""
} |
q19969 | SvdData.write | train | def write(self,f):
""" write an SVD section to a file handle
Parameters
----------
f : file handle
"""
f.write("* singular value decomposition\n")
f.write(IFMT(self.svdmode)+'\n')
f.write(IFMT(self.maxsing)+' '+FFMT(self.eigthresh)+"\n")
f.write(... | python | {
"resource": ""
} |
q19970 | SvdData.parse_values_from_lines | train | def parse_values_from_lines(self,lines):
""" parse values from lines of the SVD section
Parameters
----------
lines : list
"""
assert len(lines) == 3,"SvdData.parse_values_from_lines: expected " + \
"3 lines, not {0}".format(len(lines))
... | python | {
"resource": ""
} |
q19971 | ControlData.formatted_values | train | def formatted_values(self):
""" list the entries and current values in the control data section
Returns
-------
formatted_values : pandas.Series
"""
return self._df.apply(lambda x: self.formatters[x["type"]](x["value"]),axis=1) | python | {
"resource": ""
} |
q19972 | read_struct_file | train | def read_struct_file(struct_file,return_type=GeoStruct):
"""read an existing PEST-type structure file into a GeoStruct instance
Parameters
----------
struct_file : (str)
existing pest-type structure file
return_type : (object)
the instance type to return. Default is GeoStruct
... | python | {
"resource": ""
} |
q19973 | _read_variogram | train | def _read_variogram(f):
"""Function to instantiate a Vario2d from a PEST-style structure file
Parameters
----------
f : (file handle)
file handle opened for reading
Returns
-------
Vario2d : Vario2d
Vario2d derived type
"""
line = ''
vartype = None
bearing... | python | {
"resource": ""
} |
q19974 | _read_structure_attributes | train | def _read_structure_attributes(f):
""" function to read information from a PEST-style structure file
Parameters
----------
f : (file handle)
file handle open for reading
Returns
-------
nugget : float
the GeoStruct nugget
transform : str
the GeoStruct transforma... | python | {
"resource": ""
} |
q19975 | read_sgems_variogram_xml | train | def read_sgems_variogram_xml(xml_file,return_type=GeoStruct):
""" function to read an SGEMS-type variogram XML file into
a GeoStruct
Parameters
----------
xml_file : (str)
SGEMS variogram XML file
return_type : (object)
the instance type to return. Default is GeoStruct
Re... | python | {
"resource": ""
} |
q19976 | gslib_2_dataframe | train | def gslib_2_dataframe(filename,attr_name=None,x_idx=0,y_idx=1):
""" function to read a GSLIB point data file into a pandas.DataFrame
Parameters
----------
filename : (str)
GSLIB file
attr_name : (str)
the column name in the dataframe for the attribute. If None, GSLIB file
c... | python | {
"resource": ""
} |
q19977 | load_sgems_exp_var | train | def load_sgems_exp_var(filename):
""" read an SGEM experimental variogram into a sequence of
pandas.DataFrames
Parameters
----------
filename : (str)
an SGEMS experimental variogram XML file
Returns
-------
dfs : list
a list of pandas.DataFrames of x, y, pairs for each
... | python | {
"resource": ""
} |
q19978 | GeoStruct.to_struct_file | train | def to_struct_file(self, f):
""" write a PEST-style structure file
Parameters
----------
f : (str or file handle)
file to write the GeoStruct information to
"""
if isinstance(f, str):
f = open(f,'w')
f.write("STRUCTURE {0}\n".format(self.... | python | {
"resource": ""
} |
q19979 | GeoStruct.covariance | train | def covariance(self,pt0,pt1):
"""get the covariance between two points implied by the GeoStruct.
This is used during the ordinary kriging process to get the RHS
Parameters
----------
pt0 : (iterable length 2 of floats)
pt1 : (iterable length 2 of floats)
Returns... | python | {
"resource": ""
} |
q19980 | GeoStruct.covariance_points | train | def covariance_points(self,x0,y0,xother,yother):
""" Get the covariance between point x0,y0 and the points
contained in xother, yother.
Parameters
----------
x0 : (float)
x-coordinate
y0 : (float)
y-coordinate
xother : (iterable of floats)... | python | {
"resource": ""
} |
q19981 | GeoStruct.sill | train | def sill(self):
""" get the sill of the GeoStruct
Return
------
sill : float
the sill of the (nested) GeoStruct, including nugget and contribution
from each variogram
"""
sill = self.nugget
for v in self.variograms:
sill += v.c... | python | {
"resource": ""
} |
q19982 | GeoStruct.plot | train | def plot(self,**kwargs):
""" make a cheap plot of the GeoStruct
Parameters
----------
**kwargs : (dict)
keyword arguments to use for plotting.
Returns
-------
ax : matplotlib.pyplot.axis
the axis with the GeoStruct plot
Note
... | python | {
"resource": ""
} |
q19983 | OrdinaryKrige.check_point_data_dist | train | def check_point_data_dist(self, rectify=False):
""" check for point_data entries that are closer than
EPSILON distance - this will cause a singular kriging matrix.
Parameters
----------
rectify : (boolean)
flag to fix the problems with point_data
by dropp... | python | {
"resource": ""
} |
q19984 | Vario2d.to_struct_file | train | def to_struct_file(self, f):
""" write the Vario2d to a PEST-style structure file
Parameters
----------
f : (str or file handle)
item to write to
"""
if isinstance(f, str):
f = open(f,'w')
f.write("VARIOGRAM {0}\n".format(self.name))
... | python | {
"resource": ""
} |
q19985 | Vario2d.rotation_coefs | train | def rotation_coefs(self):
""" get the rotation coefficents in radians
Returns
-------
rotation_coefs : list
the rotation coefficients implied by Vario2d.bearing
"""
return [np.cos(self.bearing_rads),
np.sin(self.bearing_rads),
... | python | {
"resource": ""
} |
q19986 | Vario2d.plot | train | def plot(self,**kwargs):
""" get a cheap plot of the Vario2d
Parameters
----------
**kwargs : (dict)
keyword arguments to use for plotting
Returns
-------
ax : matplotlib.pyplot.axis
Note
----
optional arguments in kwargs inc... | python | {
"resource": ""
} |
q19987 | Vario2d.add_sparse_covariance_matrix | train | def add_sparse_covariance_matrix(self,x,y,names,iidx,jidx,data):
"""build a pyemu.SparseMatrix instance implied by Vario2d
Parameters
----------
x : (iterable of floats)
x-coordinate locations
y : (iterable of floats)
y-coordinate locations
names... | python | {
"resource": ""
} |
q19988 | Vario2d.covariance_matrix | train | def covariance_matrix(self,x,y,names=None,cov=None):
"""build a pyemu.Cov instance implied by Vario2d
Parameters
----------
x : (iterable of floats)
x-coordinate locations
y : (iterable of floats)
y-coordinate locations
names : (iterable of str)
... | python | {
"resource": ""
} |
q19989 | Vario2d._apply_rotation | train | def _apply_rotation(self,dx,dy):
""" private method to rotate points
according to Vario2d.bearing and Vario2d.anisotropy
Parameters
----------
dx : (float or numpy.ndarray)
x-coordinates to rotate
dy : (float or numpy.ndarray)
y-coordinates to rot... | python | {
"resource": ""
} |
q19990 | Vario2d.covariance_points | train | def covariance_points(self,x0,y0,xother,yother):
""" get the covariance between base point x0,y0 and
other points xother,yother implied by Vario2d
Parameters
----------
x0 : (float)
x-coordinate of base point
y0 : (float)
y-coordinate of base poin... | python | {
"resource": ""
} |
q19991 | Vario2d.covariance | train | def covariance(self,pt0,pt1):
""" get the covarince between two points implied by Vario2d
Parameters
----------
pt0 : (iterable of len 2)
first point x and y
pt1 : (iterable of len 2)
second point x and y
Returns
-------
cov : flo... | python | {
"resource": ""
} |
q19992 | ExpVario._h_function | train | def _h_function(self,h):
""" private method exponential variogram "h" function
Parameters
----------
h : (float or numpy.ndarray)
distance(s)
Returns
-------
h_function : float or numpy.ndarray
the value of the "h" function implied by the... | python | {
"resource": ""
} |
q19993 | GauVario._h_function | train | def _h_function(self,h):
""" private method for the gaussian variogram "h" function
Parameters
----------
h : (float or numpy.ndarray)
distance(s)
Returns
-------
h_function : float or numpy.ndarray
the value of the "h" function implied b... | python | {
"resource": ""
} |
q19994 | SphVario._h_function | train | def _h_function(self,h):
""" private method for the spherical variogram "h" function
Parameters
----------
h : (float or numpy.ndarray)
distance(s)
Returns
-------
h_function : float or numpy.ndarray
the value of the "h" function implied ... | python | {
"resource": ""
} |
q19995 | Logger.statement | train | def statement(self,phrase):
""" log a one time statement
Parameters
----------
phrase : str
statement to log
"""
t = datetime.now()
s = str(t) + ' ' + str(phrase) + '\n'
if self.echo:
print(s,end='')
if self.filename:
... | python | {
"resource": ""
} |
q19996 | Logger.log | train | def log(self,phrase):
"""log something that happened. The first time phrase is passed the
start time is saved. The second time the phrase is logged, the
elapsed time is written
Parameters
----------
phrase : str
the thing that happened
"""
... | python | {
"resource": ""
} |
q19997 | Logger.warn | train | def warn(self,message):
"""write a warning to the log file.
Parameters
----------
message : str
the warning text
"""
s = str(datetime.now()) + " WARNING: " + message + '\n'
if self.echo:
print(s,end='')
if self.filename:
... | python | {
"resource": ""
} |
q19998 | Logger.lraise | train | def lraise(self,message):
"""log an exception, close the log file, then raise the exception
Parameters
----------
message : str
the exception message
Raises
------
exception with message
"""
s = str(datetime.now()) + " ERROR: " + ... | python | {
"resource": ""
} |
q19999 | modflow_pval_to_template_file | train | def modflow_pval_to_template_file(pval_file,tpl_file=None):
"""write a template file for a modflow parameter value file.
Uses names in the first column in the pval file as par names.
Parameters
----------
pval_file : str
parameter value file
tpl_file : str, optional
template fil... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.