repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._set_subset_indices | def _set_subset_indices(self, y_min, y_max, x_min, x_max):
"""
load subset based on extent
"""
y_coords, x_coords = self.xd.lsm.coords
dx = self.xd.lsm.dx
dy = self.xd.lsm.dy
lsm_y_indices_from_y, lsm_x_indices_from_y = \
np.where((y_coords >= (y_min ... | python | def _set_subset_indices(self, y_min, y_max, x_min, x_max):
"""
load subset based on extent
"""
y_coords, x_coords = self.xd.lsm.coords
dx = self.xd.lsm.dx
dy = self.xd.lsm.dy
lsm_y_indices_from_y, lsm_x_indices_from_y = \
np.where((y_coords >= (y_min ... | [
"def",
"_set_subset_indices",
"(",
"self",
",",
"y_min",
",",
"y_max",
",",
"x_min",
",",
"x_max",
")",
":",
"y_coords",
",",
"x_coords",
"=",
"self",
".",
"xd",
".",
"lsm",
".",
"coords",
"dx",
"=",
"self",
".",
"xd",
".",
"lsm",
".",
"dx",
"dy",
... | load subset based on extent | [
"load",
"subset",
"based",
"on",
"extent"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L608-L631 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._time_to_string | def _time_to_string(self, dt, conversion_string="%Y %m %d %H %M"):
"""
This converts a UTC time integer to a string
"""
if self.output_timezone is not None:
dt = dt.replace(tzinfo=utc) \
.astimezone(self.output_timezone)
return dt.strftime(conversio... | python | def _time_to_string(self, dt, conversion_string="%Y %m %d %H %M"):
"""
This converts a UTC time integer to a string
"""
if self.output_timezone is not None:
dt = dt.replace(tzinfo=utc) \
.astimezone(self.output_timezone)
return dt.strftime(conversio... | [
"def",
"_time_to_string",
"(",
"self",
",",
"dt",
",",
"conversion_string",
"=",
"\"%Y %m %d %H %M\"",
")",
":",
"if",
"self",
".",
"output_timezone",
"is",
"not",
"None",
":",
"dt",
"=",
"dt",
".",
"replace",
"(",
"tzinfo",
"=",
"utc",
")",
".",
"astime... | This converts a UTC time integer to a string | [
"This",
"converts",
"a",
"UTC",
"time",
"integer",
"to",
"a",
"string"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L651-L658 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._load_lsm_data | def _load_lsm_data(self, data_var,
conversion_factor=1,
calc_4d_method=None,
calc_4d_dim=None,
time_step=None):
"""
This extracts the LSM data from a folder of netcdf files
"""
data = self.xd.lsm.... | python | def _load_lsm_data(self, data_var,
conversion_factor=1,
calc_4d_method=None,
calc_4d_dim=None,
time_step=None):
"""
This extracts the LSM data from a folder of netcdf files
"""
data = self.xd.lsm.... | [
"def",
"_load_lsm_data",
"(",
"self",
",",
"data_var",
",",
"conversion_factor",
"=",
"1",
",",
"calc_4d_method",
"=",
"None",
",",
"calc_4d_dim",
"=",
"None",
",",
"time_step",
"=",
"None",
")",
":",
"data",
"=",
"self",
".",
"xd",
".",
"lsm",
".",
"g... | This extracts the LSM data from a folder of netcdf files | [
"This",
"extracts",
"the",
"LSM",
"data",
"from",
"a",
"folder",
"of",
"netcdf",
"files"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L660-L679 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._check_lsm_input | def _check_lsm_input(self, data_var_map_array):
"""
This function checks the input var map array
to ensure the required input variables exist
"""
REQUIRED_HMET_VAR_LIST = ['Prcp', 'Pres', 'Temp', 'Clod',
'RlHm', 'Drad', 'Grad', 'WndS']
#... | python | def _check_lsm_input(self, data_var_map_array):
"""
This function checks the input var map array
to ensure the required input variables exist
"""
REQUIRED_HMET_VAR_LIST = ['Prcp', 'Pres', 'Temp', 'Clod',
'RlHm', 'Drad', 'Grad', 'WndS']
#... | [
"def",
"_check_lsm_input",
"(",
"self",
",",
"data_var_map_array",
")",
":",
"REQUIRED_HMET_VAR_LIST",
"=",
"[",
"'Prcp'",
",",
"'Pres'",
",",
"'Temp'",
",",
"'Clod'",
",",
"'RlHm'",
",",
"'Drad'",
",",
"'Grad'",
",",
"'WndS'",
"]",
"given_hmet_var_list",
"=",... | This function checks the input var map array
to ensure the required input variables exist | [
"This",
"function",
"checks",
"the",
"input",
"var",
"map",
"array",
"to",
"ensure",
"the",
"required",
"input",
"variables",
"exist"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L808-L830 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._resample_data | def _resample_data(self, gssha_var):
"""
This function resamples the data to match the GSSHA grid
IN TESTING MODE
"""
self.data = self.data.lsm.resample(gssha_var, self.gssha_grid) | python | def _resample_data(self, gssha_var):
"""
This function resamples the data to match the GSSHA grid
IN TESTING MODE
"""
self.data = self.data.lsm.resample(gssha_var, self.gssha_grid) | [
"def",
"_resample_data",
"(",
"self",
",",
"gssha_var",
")",
":",
"self",
".",
"data",
"=",
"self",
".",
"data",
".",
"lsm",
".",
"resample",
"(",
"gssha_var",
",",
"self",
".",
"gssha_grid",
")"
] | This function resamples the data to match the GSSHA grid
IN TESTING MODE | [
"This",
"function",
"resamples",
"the",
"data",
"to",
"match",
"the",
"GSSHA",
"grid",
"IN",
"TESTING",
"MODE"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L832-L837 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._convert_data_to_hourly | def _convert_data_to_hourly(self, gssha_data_var):
"""
This function converts the data to hourly data
and then puts it into the data_np_array
USED WHEN GENERATING HMET DATA ONLY
"""
time_step_hours = np.diff(self.data.time)[0]/np.timedelta64(1, 'h')
calc_function ... | python | def _convert_data_to_hourly(self, gssha_data_var):
"""
This function converts the data to hourly data
and then puts it into the data_np_array
USED WHEN GENERATING HMET DATA ONLY
"""
time_step_hours = np.diff(self.data.time)[0]/np.timedelta64(1, 'h')
calc_function ... | [
"def",
"_convert_data_to_hourly",
"(",
"self",
",",
"gssha_data_var",
")",
":",
"time_step_hours",
"=",
"np",
".",
"diff",
"(",
"self",
".",
"data",
".",
"time",
")",
"[",
"0",
"]",
"/",
"np",
".",
"timedelta64",
"(",
"1",
",",
"'h'",
")",
"calc_functi... | This function converts the data to hourly data
and then puts it into the data_np_array
USED WHEN GENERATING HMET DATA ONLY | [
"This",
"function",
"converts",
"the",
"data",
"to",
"hourly",
"data",
"and",
"then",
"puts",
"it",
"into",
"the",
"data_np_array",
"USED",
"WHEN",
"GENERATING",
"HMET",
"DATA",
"ONLY"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L853-L908 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA.lsm_var_to_grid | def lsm_var_to_grid(self, out_grid_file, lsm_data_var, gssha_convert_var, time_step=0, ascii_format='grass'):
"""This function takes array data and writes out a GSSHA ascii grid.
Parameters:
out_grid_file(str): Location of ASCII file to generate.
lsm_data_var(str or list): This ... | python | def lsm_var_to_grid(self, out_grid_file, lsm_data_var, gssha_convert_var, time_step=0, ascii_format='grass'):
"""This function takes array data and writes out a GSSHA ascii grid.
Parameters:
out_grid_file(str): Location of ASCII file to generate.
lsm_data_var(str or list): This ... | [
"def",
"lsm_var_to_grid",
"(",
"self",
",",
"out_grid_file",
",",
"lsm_data_var",
",",
"gssha_convert_var",
",",
"time_step",
"=",
"0",
",",
"ascii_format",
"=",
"'grass'",
")",
":",
"self",
".",
"_load_converted_gssha_data_from_lsm",
"(",
"gssha_convert_var",
",",
... | This function takes array data and writes out a GSSHA ascii grid.
Parameters:
out_grid_file(str): Location of ASCII file to generate.
lsm_data_var(str or list): This is the variable name for precipitation in the LSM files.
gssha_convert_var(str): This is the name of the vari... | [
"This",
"function",
"takes",
"array",
"data",
"and",
"writes",
"out",
"a",
"GSSHA",
"ascii",
"grid",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L911-L962 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA._write_hmet_card_file | def _write_hmet_card_file(self, hmet_card_file_path, main_output_folder):
"""
This function writes the HMET_ASCII card file
with ASCII file list for input to GSSHA
"""
with io_open(hmet_card_file_path, 'w') as out_hmet_list_file:
for hour_time in self.data.lsm.datetim... | python | def _write_hmet_card_file(self, hmet_card_file_path, main_output_folder):
"""
This function writes the HMET_ASCII card file
with ASCII file list for input to GSSHA
"""
with io_open(hmet_card_file_path, 'w') as out_hmet_list_file:
for hour_time in self.data.lsm.datetim... | [
"def",
"_write_hmet_card_file",
"(",
"self",
",",
"hmet_card_file_path",
",",
"main_output_folder",
")",
":",
"with",
"io_open",
"(",
"hmet_card_file_path",
",",
"'w'",
")",
"as",
"out_hmet_list_file",
":",
"for",
"hour_time",
"in",
"self",
".",
"data",
".",
"ls... | This function writes the HMET_ASCII card file
with ASCII file list for input to GSSHA | [
"This",
"function",
"writes",
"the",
"HMET_ASCII",
"card",
"file",
"with",
"ASCII",
"file",
"list",
"for",
"input",
"to",
"GSSHA"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L1061-L1069 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA.lsm_data_to_arc_ascii | def lsm_data_to_arc_ascii(self, data_var_map_array,
main_output_folder=""):
"""Writes extracted data to Arc ASCII file format into folder
to be read in by GSSHA. Also generates the HMET_ASCII card file
for GSSHA in the folder named 'hmet_file_list.txt'.
... | python | def lsm_data_to_arc_ascii(self, data_var_map_array,
main_output_folder=""):
"""Writes extracted data to Arc ASCII file format into folder
to be read in by GSSHA. Also generates the HMET_ASCII card file
for GSSHA in the folder named 'hmet_file_list.txt'.
... | [
"def",
"lsm_data_to_arc_ascii",
"(",
"self",
",",
"data_var_map_array",
",",
"main_output_folder",
"=",
"\"\"",
")",
":",
"self",
".",
"_check_lsm_input",
"(",
"data_var_map_array",
")",
"if",
"not",
"main_output_folder",
":",
"main_output_folder",
"=",
"path",
".",... | Writes extracted data to Arc ASCII file format into folder
to be read in by GSSHA. Also generates the HMET_ASCII card file
for GSSHA in the folder named 'hmet_file_list.txt'.
.. warning:: For GSSHA 6 Versions, for GSSHA 7 or greater, use lsm_data_to_subset_netcdf.
.. note::
... | [
"Writes",
"extracted",
"data",
"to",
"Arc",
"ASCII",
"file",
"format",
"into",
"folder",
"to",
"be",
"read",
"in",
"by",
"GSSHA",
".",
"Also",
"generates",
"the",
"HMET_ASCII",
"card",
"file",
"for",
"GSSHA",
"in",
"the",
"folder",
"named",
"hmet_file_list",... | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L1072-L1191 | train |
CI-WATER/gsshapy | gsshapy/grid/grid_to_gssha.py | GRIDtoGSSHA.lsm_data_to_subset_netcdf | def lsm_data_to_subset_netcdf(self, netcdf_file_path,
data_var_map_array,
resample_method=None):
"""Writes extracted data to the NetCDF file format
.. todo:: NetCDF output data time is always in UTC time. Need to convert to... | python | def lsm_data_to_subset_netcdf(self, netcdf_file_path,
data_var_map_array,
resample_method=None):
"""Writes extracted data to the NetCDF file format
.. todo:: NetCDF output data time is always in UTC time. Need to convert to... | [
"def",
"lsm_data_to_subset_netcdf",
"(",
"self",
",",
"netcdf_file_path",
",",
"data_var_map_array",
",",
"resample_method",
"=",
"None",
")",
":",
"self",
".",
"_check_lsm_input",
"(",
"data_var_map_array",
")",
"output_datasets",
"=",
"[",
"]",
"for",
"gssha_var",... | Writes extracted data to the NetCDF file format
.. todo:: NetCDF output data time is always in UTC time. Need to convert to local timezone for GSSHA.
.. warning:: The NetCDF GSSHA file is only supported in GSSHA 7 or greater.
.. note::
GSSHA CARDS:
* HMET_NETCDF po... | [
"Writes",
"extracted",
"data",
"to",
"the",
"NetCDF",
"file",
"format"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L1193-L1307 | train |
Losant/losant-rest-python | losantrest/data.py | Data.export | def export(self, **kwargs):
"""
Creates a csv file from a query of devices and attributes over a time range.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
... | python | def export(self, **kwargs):
"""
Creates a csv file from a query of devices and attributes over a time range.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
... | [
"def",
"export",
"(",
"self",
",",
"**",
"kwargs",
")",
":",
"query_params",
"=",
"{",
"\"_actions\"",
":",
"\"false\"",
",",
"\"_links\"",
":",
"\"true\"",
",",
"\"_embedded\"",
":",
"\"true\"",
"}",
"path_params",
"=",
"{",
"}",
"headers",
"=",
"{",
"}... | Creates a csv file from a query of devices and attributes over a time range.
Authentication:
The client must be configured with a valid api
access token to call this action. The token
must include at least one of the following scopes:
all.Application, all.Application.read, all.D... | [
"Creates",
"a",
"csv",
"file",
"from",
"a",
"query",
"of",
"devices",
"and",
"attributes",
"over",
"a",
"time",
"range",
"."
] | 75b20decda0e999002f21811c3508f087e7f13b5 | https://github.com/Losant/losant-rest-python/blob/75b20decda0e999002f21811c3508f087e7f13b5/losantrest/data.py#L34-L80 | train |
gooofy/py-marytts | marytts/__init__.py | MaryTTS._generate | def _generate(self, message):
"""Given a message in message,
return a response in the appropriate
format."""
raw_params = {"INPUT_TEXT" : message.encode('UTF8'),
"INPUT_TYPE" : self.input_type,
"OUTPUT_TYPE" : self.output_type,
... | python | def _generate(self, message):
"""Given a message in message,
return a response in the appropriate
format."""
raw_params = {"INPUT_TEXT" : message.encode('UTF8'),
"INPUT_TYPE" : self.input_type,
"OUTPUT_TYPE" : self.output_type,
... | [
"def",
"_generate",
"(",
"self",
",",
"message",
")",
":",
"raw_params",
"=",
"{",
"\"INPUT_TEXT\"",
":",
"message",
".",
"encode",
"(",
"'UTF8'",
")",
",",
"\"INPUT_TYPE\"",
":",
"self",
".",
"input_type",
",",
"\"OUTPUT_TYPE\"",
":",
"self",
".",
"output... | Given a message in message,
return a response in the appropriate
format. | [
"Given",
"a",
"message",
"in",
"message",
"return",
"a",
"response",
"in",
"the",
"appropriate",
"format",
"."
] | f2693531ea841d21a7b94be0304c3dc8f1d9e5f7 | https://github.com/gooofy/py-marytts/blob/f2693531ea841d21a7b94be0304c3dc8f1d9e5f7/marytts/__init__.py#L84-L110 | train |
pedrotgn/pyactor | pyactor/thread/actor.py | Actor.receive | def receive(self, msg):
'''
The message received from the queue specify a method of the
class the actor represents. This invokes it. If the
communication is an ASK, sends the result back
to the channel included in the message as an
ASKRESPONSE.
If it is a FUTURE,... | python | def receive(self, msg):
'''
The message received from the queue specify a method of the
class the actor represents. This invokes it. If the
communication is an ASK, sends the result back
to the channel included in the message as an
ASKRESPONSE.
If it is a FUTURE,... | [
"def",
"receive",
"(",
"self",
",",
"msg",
")",
":",
"if",
"msg",
"[",
"TYPE",
"]",
"==",
"TELL",
"and",
"msg",
"[",
"METHOD",
"]",
"==",
"'stop'",
":",
"self",
".",
"running",
"=",
"False",
"self",
".",
"future_manager",
".",
"stop",
"(",
")",
"... | The message received from the queue specify a method of the
class the actor represents. This invokes it. If the
communication is an ASK, sends the result back
to the channel included in the message as an
ASKRESPONSE.
If it is a FUTURE, generates a FUTURERESPONSE
to send ... | [
"The",
"message",
"received",
"from",
"the",
"queue",
"specify",
"a",
"method",
"of",
"the",
"class",
"the",
"actor",
"represents",
".",
"This",
"invokes",
"it",
".",
"If",
"the",
"communication",
"is",
"an",
"ASK",
"sends",
"the",
"result",
"back",
"to",
... | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/actor.py#L100-L128 | train |
timofurrer/ramlient | ramlient/utils.py | download_file | def download_file(url):
"""
Downloads a file from the specified URL.
:param str url: The URL to the file to be downloaded
:returns: the downloaded file's content
:rtype: str
"""
response = requests.get(url)
if response.status_code is not 200:
return None
ret... | python | def download_file(url):
"""
Downloads a file from the specified URL.
:param str url: The URL to the file to be downloaded
:returns: the downloaded file's content
:rtype: str
"""
response = requests.get(url)
if response.status_code is not 200:
return None
ret... | [
"def",
"download_file",
"(",
"url",
")",
":",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"if",
"response",
".",
"status_code",
"is",
"not",
"200",
":",
"return",
"None",
"return",
"response",
".",
"text"
] | Downloads a file from the specified URL.
:param str url: The URL to the file to be downloaded
:returns: the downloaded file's content
:rtype: str | [
"Downloads",
"a",
"file",
"from",
"the",
"specified",
"URL",
"."
] | e93092252635a6b3b0aca2c390b9f820368b791c | https://github.com/timofurrer/ramlient/blob/e93092252635a6b3b0aca2c390b9f820368b791c/ramlient/utils.py#L34-L46 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.get_sub_dsp | def get_sub_dsp(self, nodes_bunch, edges_bunch=None):
"""
Returns the sub-dispatcher induced by given node and edge bunches.
The induced sub-dispatcher contains the available nodes in nodes_bunch
and edges between those nodes, excluding those that are in edges_bunch.
The availa... | python | def get_sub_dsp(self, nodes_bunch, edges_bunch=None):
"""
Returns the sub-dispatcher induced by given node and edge bunches.
The induced sub-dispatcher contains the available nodes in nodes_bunch
and edges between those nodes, excluding those that are in edges_bunch.
The availa... | [
"def",
"get_sub_dsp",
"(",
"self",
",",
"nodes_bunch",
",",
"edges_bunch",
"=",
"None",
")",
":",
"nodes_bunch",
"=",
"[",
"self",
".",
"get_node",
"(",
"u",
")",
"[",
"1",
"]",
"[",
"0",
"]",
"for",
"u",
"in",
"nodes_bunch",
"]",
"sub_dsp",
"=",
"... | Returns the sub-dispatcher induced by given node and edge bunches.
The induced sub-dispatcher contains the available nodes in nodes_bunch
and edges between those nodes, excluding those that are in edges_bunch.
The available nodes are non isolated nodes and function nodes that have
all ... | [
"Returns",
"the",
"sub",
"-",
"dispatcher",
"induced",
"by",
"given",
"node",
"and",
"edge",
"bunches",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1048-L1146 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.data_nodes | def data_nodes(self):
"""
Returns all data nodes of the dispatcher.
:return:
All data nodes of the dispatcher.
:rtype: dict[str, dict]
"""
return {k: v for k, v in self.nodes.items() if v['type'] == 'data'} | python | def data_nodes(self):
"""
Returns all data nodes of the dispatcher.
:return:
All data nodes of the dispatcher.
:rtype: dict[str, dict]
"""
return {k: v for k, v in self.nodes.items() if v['type'] == 'data'} | [
"def",
"data_nodes",
"(",
"self",
")",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"nodes",
".",
"items",
"(",
")",
"if",
"v",
"[",
"'type'",
"]",
"==",
"'data'",
"}"
] | Returns all data nodes of the dispatcher.
:return:
All data nodes of the dispatcher.
:rtype: dict[str, dict] | [
"Returns",
"all",
"data",
"nodes",
"of",
"the",
"dispatcher",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1384-L1393 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.function_nodes | def function_nodes(self):
"""
Returns all function nodes of the dispatcher.
:return:
All data function of the dispatcher.
:rtype: dict[str, dict]
"""
return {k: v for k, v in self.nodes.items() if v['type'] == 'function'} | python | def function_nodes(self):
"""
Returns all function nodes of the dispatcher.
:return:
All data function of the dispatcher.
:rtype: dict[str, dict]
"""
return {k: v for k, v in self.nodes.items() if v['type'] == 'function'} | [
"def",
"function_nodes",
"(",
"self",
")",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"nodes",
".",
"items",
"(",
")",
"if",
"v",
"[",
"'type'",
"]",
"==",
"'function'",
"}"
] | Returns all function nodes of the dispatcher.
:return:
All data function of the dispatcher.
:rtype: dict[str, dict] | [
"Returns",
"all",
"function",
"nodes",
"of",
"the",
"dispatcher",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1396-L1405 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.sub_dsp_nodes | def sub_dsp_nodes(self):
"""
Returns all sub-dispatcher nodes of the dispatcher.
:return:
All sub-dispatcher nodes of the dispatcher.
:rtype: dict[str, dict]
"""
return {k: v for k, v in self.nodes.items() if
v['type'] == 'dispatcher'} | python | def sub_dsp_nodes(self):
"""
Returns all sub-dispatcher nodes of the dispatcher.
:return:
All sub-dispatcher nodes of the dispatcher.
:rtype: dict[str, dict]
"""
return {k: v for k, v in self.nodes.items() if
v['type'] == 'dispatcher'} | [
"def",
"sub_dsp_nodes",
"(",
"self",
")",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"nodes",
".",
"items",
"(",
")",
"if",
"v",
"[",
"'type'",
"]",
"==",
"'dispatcher'",
"}"
] | Returns all sub-dispatcher nodes of the dispatcher.
:return:
All sub-dispatcher nodes of the dispatcher.
:rtype: dict[str, dict] | [
"Returns",
"all",
"sub",
"-",
"dispatcher",
"nodes",
"of",
"the",
"dispatcher",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1408-L1418 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.blue | def blue(self, memo=None):
"""
Constructs a BlueDispatcher out of the current object.
:param memo:
A dictionary to cache Blueprints.
:type memo: dict[T,schedula.utils.blue.Blueprint]
:return:
A BlueDispatcher of the current object.
:rtype: schedu... | python | def blue(self, memo=None):
"""
Constructs a BlueDispatcher out of the current object.
:param memo:
A dictionary to cache Blueprints.
:type memo: dict[T,schedula.utils.blue.Blueprint]
:return:
A BlueDispatcher of the current object.
:rtype: schedu... | [
"def",
"blue",
"(",
"self",
",",
"memo",
"=",
"None",
")",
":",
"memo",
"=",
"{",
"}",
"if",
"memo",
"is",
"None",
"else",
"memo",
"if",
"self",
"in",
"memo",
":",
"return",
"memo",
"[",
"self",
"]",
"from",
".",
"utils",
".",
"dsp",
"import",
... | Constructs a BlueDispatcher out of the current object.
:param memo:
A dictionary to cache Blueprints.
:type memo: dict[T,schedula.utils.blue.Blueprint]
:return:
A BlueDispatcher of the current object.
:rtype: schedula.utils.blue.BlueDispatcher | [
"Constructs",
"a",
"BlueDispatcher",
"out",
"of",
"the",
"current",
"object",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1437-L1485 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.extend | def extend(self, *blues, memo=None):
"""
Extends Dispatcher calling each deferred operation of given Blueprints.
:param blues:
Blueprints or Dispatchers to extend deferred operations.
:type blues: Blueprint | schedula.dispatcher.Dispatcher
:param memo:
A... | python | def extend(self, *blues, memo=None):
"""
Extends Dispatcher calling each deferred operation of given Blueprints.
:param blues:
Blueprints or Dispatchers to extend deferred operations.
:type blues: Blueprint | schedula.dispatcher.Dispatcher
:param memo:
A... | [
"def",
"extend",
"(",
"self",
",",
"*",
"blues",
",",
"memo",
"=",
"None",
")",
":",
"from",
".",
"utils",
".",
"blue",
"import",
"BlueDispatcher",
"as",
"Blue",
"return",
"Blue",
"(",
")",
".",
"extend",
"(",
"*",
"blues",
",",
"memo",
"=",
"memo"... | Extends Dispatcher calling each deferred operation of given Blueprints.
:param blues:
Blueprints or Dispatchers to extend deferred operations.
:type blues: Blueprint | schedula.dispatcher.Dispatcher
:param memo:
A dictionary to cache Blueprints and Dispatchers.
... | [
"Extends",
"Dispatcher",
"calling",
"each",
"deferred",
"operation",
"of",
"given",
"Blueprints",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1487-L1519 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.dispatch | def dispatch(self, inputs=None, outputs=None, cutoff=None, inputs_dist=None,
wildcard=False, no_call=False, shrink=False,
rm_unused_nds=False, select_output_kw=None, _wait_in=None,
stopper=None, executor=False, sol_name=()):
"""
Evaluates the minimum wo... | python | def dispatch(self, inputs=None, outputs=None, cutoff=None, inputs_dist=None,
wildcard=False, no_call=False, shrink=False,
rm_unused_nds=False, select_output_kw=None, _wait_in=None,
stopper=None, executor=False, sol_name=()):
"""
Evaluates the minimum wo... | [
"def",
"dispatch",
"(",
"self",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"cutoff",
"=",
"None",
",",
"inputs_dist",
"=",
"None",
",",
"wildcard",
"=",
"False",
",",
"no_call",
"=",
"False",
",",
"shrink",
"=",
"False",
",",
"rm_u... | Evaluates the minimum workflow and data outputs of the dispatcher
model from given inputs.
:param inputs:
Input data values.
:type inputs: dict[str, T], list[str], iterable, optional
:param outputs:
Ending data nodes.
:type outputs: list[str], iterable, ... | [
"Evaluates",
"the",
"minimum",
"workflow",
"and",
"data",
"outputs",
"of",
"the",
"dispatcher",
"model",
"from",
"given",
"inputs",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1521-L1679 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher.shrink_dsp | def shrink_dsp(self, inputs=None, outputs=None, cutoff=None,
inputs_dist=None, wildcard=True):
"""
Returns a reduced dispatcher.
:param inputs:
Input data nodes.
:type inputs: list[str], iterable, optional
:param outputs:
Ending data n... | python | def shrink_dsp(self, inputs=None, outputs=None, cutoff=None,
inputs_dist=None, wildcard=True):
"""
Returns a reduced dispatcher.
:param inputs:
Input data nodes.
:type inputs: list[str], iterable, optional
:param outputs:
Ending data n... | [
"def",
"shrink_dsp",
"(",
"self",
",",
"inputs",
"=",
"None",
",",
"outputs",
"=",
"None",
",",
"cutoff",
"=",
"None",
",",
"inputs_dist",
"=",
"None",
",",
"wildcard",
"=",
"True",
")",
":",
"bfs",
"=",
"None",
"if",
"inputs",
":",
"wait_in",
"=",
... | Returns a reduced dispatcher.
:param inputs:
Input data nodes.
:type inputs: list[str], iterable, optional
:param outputs:
Ending data nodes.
:type outputs: list[str], iterable, optional
:param cutoff:
Depth to stop the search.
:type... | [
"Returns",
"a",
"reduced",
"dispatcher",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1684-L1823 | train |
vinci1it2000/schedula | schedula/dispatcher.py | Dispatcher._get_dsp_from_bfs | def _get_dsp_from_bfs(self, outputs, bfs_graphs=None):
"""
Returns the sub-dispatcher induced by the workflow from outputs.
:param outputs:
Ending data nodes.
:type outputs: list[str], iterable, optional
:param bfs_graphs:
A dictionary with directed grap... | python | def _get_dsp_from_bfs(self, outputs, bfs_graphs=None):
"""
Returns the sub-dispatcher induced by the workflow from outputs.
:param outputs:
Ending data nodes.
:type outputs: list[str], iterable, optional
:param bfs_graphs:
A dictionary with directed grap... | [
"def",
"_get_dsp_from_bfs",
"(",
"self",
",",
"outputs",
",",
"bfs_graphs",
"=",
"None",
")",
":",
"bfs",
"=",
"bfs_graphs",
"[",
"NONE",
"]",
"if",
"bfs_graphs",
"is",
"not",
"None",
"else",
"self",
".",
"dmap",
"dsp",
"=",
"self",
".",
"get_sub_dsp_fro... | Returns the sub-dispatcher induced by the workflow from outputs.
:param outputs:
Ending data nodes.
:type outputs: list[str], iterable, optional
:param bfs_graphs:
A dictionary with directed graphs where evaluate the
breadth-first-search.
:type bfs_g... | [
"Returns",
"the",
"sub",
"-",
"dispatcher",
"induced",
"by",
"the",
"workflow",
"from",
"outputs",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1825-L1868 | train |
pedrotgn/pyactor | pyactor/thread/future.py | Future.add_callback | def add_callback(self, method):
"""
Attaches a mehtod that will be called when the future finishes.
:param method: A callable from an actor that will be called
when the future completes. The only argument for that
method must be the future itself from wich you can get th... | python | def add_callback(self, method):
"""
Attaches a mehtod that will be called when the future finishes.
:param method: A callable from an actor that will be called
when the future completes. The only argument for that
method must be the future itself from wich you can get th... | [
"def",
"add_callback",
"(",
"self",
",",
"method",
")",
":",
"from_actor",
"=",
"get_current",
"(",
")",
"if",
"from_actor",
"is",
"not",
"None",
":",
"callback",
"=",
"(",
"method",
",",
"from_actor",
".",
"channel",
",",
"from_actor",
".",
"url",
")",
... | Attaches a mehtod that will be called when the future finishes.
:param method: A callable from an actor that will be called
when the future completes. The only argument for that
method must be the future itself from wich you can get the
result though `future.:meth:`result()`... | [
"Attaches",
"a",
"mehtod",
"that",
"will",
"be",
"called",
"when",
"the",
"future",
"finishes",
"."
] | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L60-L88 | train |
pedrotgn/pyactor | pyactor/thread/future.py | Future.send_work | def send_work(self):
'''Sends the query to the actor for it to start executing the
work.
It is possible to execute once again a future that has finished
if necessary (overwriting the results), but only one execution
at a time.
'''
if self.__set_running():
... | python | def send_work(self):
'''Sends the query to the actor for it to start executing the
work.
It is possible to execute once again a future that has finished
if necessary (overwriting the results), but only one execution
at a time.
'''
if self.__set_running():
... | [
"def",
"send_work",
"(",
"self",
")",
":",
"if",
"self",
".",
"__set_running",
"(",
")",
":",
"msg",
"=",
"{",
"TYPE",
":",
"FUTURE",
",",
"METHOD",
":",
"self",
".",
"__method",
",",
"PARAMS",
":",
"self",
".",
"__params",
",",
"CHANNEL",
":",
"se... | Sends the query to the actor for it to start executing the
work.
It is possible to execute once again a future that has finished
if necessary (overwriting the results), but only one execution
at a time. | [
"Sends",
"the",
"query",
"to",
"the",
"actor",
"for",
"it",
"to",
"start",
"executing",
"the",
"work",
"."
] | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L144-L160 | train |
pedrotgn/pyactor | pyactor/thread/future.py | Future.set_result | def set_result(self, result):
"""Sets the return value of work associated with the future.
Only called internally.
"""
with self.__condition:
self.__result = result
self.__state = FINISHED
self.__condition.notify_all()
self._invoke_callbacks() | python | def set_result(self, result):
"""Sets the return value of work associated with the future.
Only called internally.
"""
with self.__condition:
self.__result = result
self.__state = FINISHED
self.__condition.notify_all()
self._invoke_callbacks() | [
"def",
"set_result",
"(",
"self",
",",
"result",
")",
":",
"with",
"self",
".",
"__condition",
":",
"self",
".",
"__result",
"=",
"result",
"self",
".",
"__state",
"=",
"FINISHED",
"self",
".",
"__condition",
".",
"notify_all",
"(",
")",
"self",
".",
"... | Sets the return value of work associated with the future.
Only called internally. | [
"Sets",
"the",
"return",
"value",
"of",
"work",
"associated",
"with",
"the",
"future",
".",
"Only",
"called",
"internally",
"."
] | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L173-L181 | train |
pedrotgn/pyactor | pyactor/thread/future.py | Future.set_exception | def set_exception(self, exception):
"""Sets the result of the future as being the given exception.
Only called internally.
"""
with self.__condition:
self.__exception = exception
self.__state = FINISHED
self.__condition.notify_all()
self._invok... | python | def set_exception(self, exception):
"""Sets the result of the future as being the given exception.
Only called internally.
"""
with self.__condition:
self.__exception = exception
self.__state = FINISHED
self.__condition.notify_all()
self._invok... | [
"def",
"set_exception",
"(",
"self",
",",
"exception",
")",
":",
"with",
"self",
".",
"__condition",
":",
"self",
".",
"__exception",
"=",
"exception",
"self",
".",
"__state",
"=",
"FINISHED",
"self",
".",
"__condition",
".",
"notify_all",
"(",
")",
"self"... | Sets the result of the future as being the given exception.
Only called internally. | [
"Sets",
"the",
"result",
"of",
"the",
"future",
"as",
"being",
"the",
"given",
"exception",
".",
"Only",
"called",
"internally",
"."
] | 24d98d134dd4228f2ba38e83611e9c3f50ec2fd4 | https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L183-L191 | train |
theodoregoetz/wernher | sandbox/Flight.py | angle_between_vectors | def angle_between_vectors(x, y):
""" Compute the angle between vector x and y """
dp = dot_product(x, y)
if dp == 0:
return 0
xm = magnitude(x)
ym = magnitude(y)
return math.acos(dp / (xm*ym)) * (180. / math.pi) | python | def angle_between_vectors(x, y):
""" Compute the angle between vector x and y """
dp = dot_product(x, y)
if dp == 0:
return 0
xm = magnitude(x)
ym = magnitude(y)
return math.acos(dp / (xm*ym)) * (180. / math.pi) | [
"def",
"angle_between_vectors",
"(",
"x",
",",
"y",
")",
":",
"dp",
"=",
"dot_product",
"(",
"x",
",",
"y",
")",
"if",
"dp",
"==",
"0",
":",
"return",
"0",
"xm",
"=",
"magnitude",
"(",
"x",
")",
"ym",
"=",
"magnitude",
"(",
"y",
")",
"return",
... | Compute the angle between vector x and y | [
"Compute",
"the",
"angle",
"between",
"vector",
"x",
"and",
"y"
] | ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e | https://github.com/theodoregoetz/wernher/blob/ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e/sandbox/Flight.py#L31-L38 | train |
dsoprea/PySecure | pysecure/adapters/ssha.py | _ssh_forward_accept | def _ssh_forward_accept(ssh_session, timeout_ms):
"""Waiting for an incoming connection from a reverse forwarded port. Note
that this results in a kernel block until a connection is received.
"""
ssh_channel = c_ssh_forward_accept(c_void_p(ssh_session),
c_int(tim... | python | def _ssh_forward_accept(ssh_session, timeout_ms):
"""Waiting for an incoming connection from a reverse forwarded port. Note
that this results in a kernel block until a connection is received.
"""
ssh_channel = c_ssh_forward_accept(c_void_p(ssh_session),
c_int(tim... | [
"def",
"_ssh_forward_accept",
"(",
"ssh_session",
",",
"timeout_ms",
")",
":",
"ssh_channel",
"=",
"c_ssh_forward_accept",
"(",
"c_void_p",
"(",
"ssh_session",
")",
",",
"c_int",
"(",
"timeout_ms",
")",
")",
"if",
"ssh_channel",
"is",
"None",
":",
"raise",
"Ss... | Waiting for an incoming connection from a reverse forwarded port. Note
that this results in a kernel block until a connection is received. | [
"Waiting",
"for",
"an",
"incoming",
"connection",
"from",
"a",
"reverse",
"forwarded",
"port",
".",
"Note",
"that",
"this",
"results",
"in",
"a",
"kernel",
"block",
"until",
"a",
"connection",
"is",
"received",
"."
] | ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0 | https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/ssha.py#L249-L260 | train |
dsoprea/PySecure | pysecure/adapters/ssha.py | SshSession.execute | def execute(self, cmd, block_size=DEFAULT_EXECUTE_READ_BLOCK_SIZE):
"""Execute a remote command. This functionality does not support more
than one command to be executed on the same channel, so we create a
dedicated channel at the session level than allowing direct access at
the channe... | python | def execute(self, cmd, block_size=DEFAULT_EXECUTE_READ_BLOCK_SIZE):
"""Execute a remote command. This functionality does not support more
than one command to be executed on the same channel, so we create a
dedicated channel at the session level than allowing direct access at
the channe... | [
"def",
"execute",
"(",
"self",
",",
"cmd",
",",
"block_size",
"=",
"DEFAULT_EXECUTE_READ_BLOCK_SIZE",
")",
":",
"with",
"SshChannel",
"(",
"self",
")",
"as",
"sc",
":",
"self",
".",
"__log",
".",
"debug",
"(",
"\"Executing command: %s\"",
"%",
"(",
"cmd",
... | Execute a remote command. This functionality does not support more
than one command to be executed on the same channel, so we create a
dedicated channel at the session level than allowing direct access at
the channel level. | [
"Execute",
"a",
"remote",
"command",
".",
"This",
"functionality",
"does",
"not",
"support",
"more",
"than",
"one",
"command",
"to",
"be",
"executed",
"on",
"the",
"same",
"channel",
"so",
"we",
"create",
"a",
"dedicated",
"channel",
"at",
"the",
"session",
... | ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0 | https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/ssha.py#L476-L495 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._read | def _read(self, directory, filename, session, path, name, extension,
spatial, spatialReferenceID, replaceParamFile,
force_relative=True):
"""
Project File Read from File Method
"""
self.project_directory = directory
with tmp_chdir(directory):
... | python | def _read(self, directory, filename, session, path, name, extension,
spatial, spatialReferenceID, replaceParamFile,
force_relative=True):
"""
Project File Read from File Method
"""
self.project_directory = directory
with tmp_chdir(directory):
... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
",",
"force_relative",
"=",
"True",
")",
":",
"self",
".",
"proj... | Project File Read from File Method | [
"Project",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L244-L296 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Project File Write to File Method
"""
# Enforce cards that must be written in certain order
PRIORITY_CARDS = ('WMS', 'MASK_WATERSHED', 'REPLACE_LINE',
'REPLACE_PARAMS', 'REPLACE_VALS', 'REPLACE_F... | python | def _write(self, session, openFile, replaceParamFile):
"""
Project File Write to File Method
"""
# Enforce cards that must be written in certain order
PRIORITY_CARDS = ('WMS', 'MASK_WATERSHED', 'REPLACE_LINE',
'REPLACE_PARAMS', 'REPLACE_VALS', 'REPLACE_F... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"PRIORITY_CARDS",
"=",
"(",
"'WMS'",
",",
"'MASK_WATERSHED'",
",",
"'REPLACE_LINE'",
",",
"'REPLACE_PARAMS'",
",",
"'REPLACE_VALS'",
",",
"'REPLACE_FOLDER'",
")",
"... | Project File Write to File Method | [
"Project",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L298-L323 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.appendDirectory | def appendDirectory(self, directory, projectFilePath):
"""
Append directory to relative paths in project file. By default, the project file paths are read and written as
relative paths. Use this method to prepend a directory to all the paths in the project file.
Args:
direct... | python | def appendDirectory(self, directory, projectFilePath):
"""
Append directory to relative paths in project file. By default, the project file paths are read and written as
relative paths. Use this method to prepend a directory to all the paths in the project file.
Args:
direct... | [
"def",
"appendDirectory",
"(",
"self",
",",
"directory",
",",
"projectFilePath",
")",
":",
"lines",
"=",
"[",
"]",
"with",
"open",
"(",
"projectFilePath",
",",
"'r'",
")",
"as",
"original",
":",
"for",
"l",
"in",
"original",
":",
"lines",
".",
"append",
... | Append directory to relative paths in project file. By default, the project file paths are read and written as
relative paths. Use this method to prepend a directory to all the paths in the project file.
Args:
directory (str): Directory path to prepend to file paths in project file.
... | [
"Append",
"directory",
"to",
"relative",
"paths",
"in",
"project",
"file",
".",
"By",
"default",
"the",
"project",
"file",
"paths",
"are",
"read",
"and",
"written",
"as",
"relative",
"paths",
".",
"Use",
"this",
"method",
"to",
"prepend",
"a",
"directory",
... | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L325-L369 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.readProject | def readProject(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read all files for a GSSHA project into the database.
This method will read all the files, both input and output files, that are supported by GsshaPy into a database.
To use GsshaPy m... | python | def readProject(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read all files for a GSSHA project into the database.
This method will read all the files, both input and output files, that are supported by GsshaPy into a database.
To use GsshaPy m... | [
"def",
"readProject",
"(",
"self",
",",
"directory",
",",
"projectFileName",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"None",
")",
":",
"self",
".",
"project_directory",
"=",
"directory",
"with",
"tmp_chdir",
"(",
"director... | Read all files for a GSSHA project into the database.
This method will read all the files, both input and output files, that are supported by GsshaPy into a database.
To use GsshaPy more efficiently, it is recommended that you use the readInput method when performing
pre-processing tasks and re... | [
"Read",
"all",
"files",
"for",
"a",
"GSSHA",
"project",
"into",
"the",
"database",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L371-L421 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.readInput | def readInput(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read only input files for a GSSHA project into the database.
Use this method to read a project when only pre-processing tasks need to be performed.
Args:
directory (str): D... | python | def readInput(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read only input files for a GSSHA project into the database.
Use this method to read a project when only pre-processing tasks need to be performed.
Args:
directory (str): D... | [
"def",
"readInput",
"(",
"self",
",",
"directory",
",",
"projectFileName",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"None",
")",
":",
"self",
".",
"project_directory",
"=",
"directory",
"with",
"tmp_chdir",
"(",
"directory"... | Read only input files for a GSSHA project into the database.
Use this method to read a project when only pre-processing tasks need to be performed.
Args:
directory (str): Directory containing all GSSHA model files. This method assumes that all files are located
in the same ... | [
"Read",
"only",
"input",
"files",
"for",
"a",
"GSSHA",
"project",
"into",
"the",
"database",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L423-L462 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.readOutput | def readOutput(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read only output files for a GSSHA project to the database.
Use this method to read a project when only post-processing tasks need to be performed.
Args:
directory (str): ... | python | def readOutput(self, directory, projectFileName, session, spatial=False, spatialReferenceID=None):
"""
Read only output files for a GSSHA project to the database.
Use this method to read a project when only post-processing tasks need to be performed.
Args:
directory (str): ... | [
"def",
"readOutput",
"(",
"self",
",",
"directory",
",",
"projectFileName",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"None",
")",
":",
"self",
".",
"project_directory",
"=",
"directory",
"with",
"tmp_chdir",
"(",
"directory... | Read only output files for a GSSHA project to the database.
Use this method to read a project when only post-processing tasks need to be performed.
Args:
directory (str): Directory containing all GSSHA model files. This method assumes that all files are located
in the same ... | [
"Read",
"only",
"output",
"files",
"for",
"a",
"GSSHA",
"project",
"to",
"the",
"database",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L464-L509 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._readXputFile | def _readXputFile(self, file_cards, card_name, directory, session,
spatial=False, spatialReferenceID=None,
replaceParamFile=None, **kwargs):
"""
Read specific IO file for a GSSHA project to the database.
"""
# Automatically derive the spatial r... | python | def _readXputFile(self, file_cards, card_name, directory, session,
spatial=False, spatialReferenceID=None,
replaceParamFile=None, **kwargs):
"""
Read specific IO file for a GSSHA project to the database.
"""
# Automatically derive the spatial r... | [
"def",
"_readXputFile",
"(",
"self",
",",
"file_cards",
",",
"card_name",
",",
"directory",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"None",
",",
"replaceParamFile",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"sp... | Read specific IO file for a GSSHA project to the database. | [
"Read",
"specific",
"IO",
"file",
"for",
"a",
"GSSHA",
"project",
"to",
"the",
"database",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L511-L534 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.writeProject | def writeProject(self, session, directory, name):
"""
Write all files for a project from the database to file.
Use this method to write all GsshaPy supported files back into their native file formats. If writing to execute
the model, increase efficiency by using the writeInput method to... | python | def writeProject(self, session, directory, name):
"""
Write all files for a project from the database to file.
Use this method to write all GsshaPy supported files back into their native file formats. If writing to execute
the model, increase efficiency by using the writeInput method to... | [
"def",
"writeProject",
"(",
"self",
",",
"session",
",",
"directory",
",",
"name",
")",
":",
"self",
".",
"project_directory",
"=",
"directory",
"with",
"tmp_chdir",
"(",
"directory",
")",
":",
"batchDirectory",
"=",
"self",
".",
"_getBatchDirectory",
"(",
"... | Write all files for a project from the database to file.
Use this method to write all GsshaPy supported files back into their native file formats. If writing to execute
the model, increase efficiency by using the writeInput method to write only the file needed to run the model.
Args:
... | [
"Write",
"all",
"files",
"for",
"a",
"project",
"from",
"the",
"database",
"to",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L587-L626 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.writeInput | def writeInput(self, session, directory, name):
"""
Write only input files for a GSSHA project from the database to file.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
directory (str): Directory where t... | python | def writeInput(self, session, directory, name):
"""
Write only input files for a GSSHA project from the database to file.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
directory (str): Directory where t... | [
"def",
"writeInput",
"(",
"self",
",",
"session",
",",
"directory",
",",
"name",
")",
":",
"self",
".",
"project_directory",
"=",
"directory",
"with",
"tmp_chdir",
"(",
"directory",
")",
":",
"replaceParamFile",
"=",
"self",
".",
"replaceParamFile",
"self",
... | Write only input files for a GSSHA project from the database to file.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
directory (str): Directory where the files will be written.
name (str): Name that will be ... | [
"Write",
"only",
"input",
"files",
"for",
"a",
"GSSHA",
"project",
"from",
"the",
"database",
"to",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L628-L652 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.writeOutput | def writeOutput(self, session, directory, name):
"""
Write only output files for a GSSHA project from the database to file.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
directory (str): Directory where... | python | def writeOutput(self, session, directory, name):
"""
Write only output files for a GSSHA project from the database to file.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
directory (str): Directory where... | [
"def",
"writeOutput",
"(",
"self",
",",
"session",
",",
"directory",
",",
"name",
")",
":",
"self",
".",
"project_directory",
"=",
"directory",
"with",
"tmp_chdir",
"(",
"directory",
")",
":",
"batchDirectory",
"=",
"self",
".",
"_getBatchDirectory",
"(",
"d... | Write only output files for a GSSHA project from the database to file.
Args:
session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database
directory (str): Directory where the files will be written.
name (str): Name that will be... | [
"Write",
"only",
"output",
"files",
"for",
"a",
"GSSHA",
"project",
"from",
"the",
"database",
"to",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L656-L683 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getFileKeys | def getFileKeys(self):
"""
Retrieve a list of file keys that have been read into the database.
This is a utility method that can be used to programmatically access the GsshaPy file objects. Use these keys
in conjunction with the dictionary returned by the getFileObjects method.
... | python | def getFileKeys(self):
"""
Retrieve a list of file keys that have been read into the database.
This is a utility method that can be used to programmatically access the GsshaPy file objects. Use these keys
in conjunction with the dictionary returned by the getFileObjects method.
... | [
"def",
"getFileKeys",
"(",
"self",
")",
":",
"files",
"=",
"self",
".",
"getFileObjects",
"(",
")",
"files_list",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"files",
".",
"iteritems",
"(",
")",
":",
"if",
"value",
":",
"files_list",
".",
"appen... | Retrieve a list of file keys that have been read into the database.
This is a utility method that can be used to programmatically access the GsshaPy file objects. Use these keys
in conjunction with the dictionary returned by the getFileObjects method.
Returns:
list: List of keys re... | [
"Retrieve",
"a",
"list",
"of",
"file",
"keys",
"that",
"have",
"been",
"read",
"into",
"the",
"database",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L685-L703 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getFileObjects | def getFileObjects(self):
"""
Retrieve a dictionary of file objects.
This is a utility method that can be used to programmatically access the GsshaPy file objects. Use this method
in conjunction with the getFileKeys method to access only files that have been read into the database.
... | python | def getFileObjects(self):
"""
Retrieve a dictionary of file objects.
This is a utility method that can be used to programmatically access the GsshaPy file objects. Use this method
in conjunction with the getFileKeys method to access only files that have been read into the database.
... | [
"def",
"getFileObjects",
"(",
"self",
")",
":",
"files",
"=",
"{",
"'project-file'",
":",
"self",
",",
"'mapping-table-file'",
":",
"self",
".",
"mapTableFile",
",",
"'channel-input-file'",
":",
"self",
".",
"channelInputFile",
",",
"'precipitation-file'",
":",
... | Retrieve a dictionary of file objects.
This is a utility method that can be used to programmatically access the GsshaPy file objects. Use this method
in conjunction with the getFileKeys method to access only files that have been read into the database.
Returns:
dict: Dictionary wit... | [
"Retrieve",
"a",
"dictionary",
"of",
"file",
"objects",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L705-L735 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getCard | def getCard(self, name):
"""
Retrieve card object for given card name.
Args:
name (str): Name of card to be retrieved.
Returns:
:class:`.ProjectCard` or None: Project card object. Will return None if the card is not available.
"""
cards = self.pr... | python | def getCard(self, name):
"""
Retrieve card object for given card name.
Args:
name (str): Name of card to be retrieved.
Returns:
:class:`.ProjectCard` or None: Project card object. Will return None if the card is not available.
"""
cards = self.pr... | [
"def",
"getCard",
"(",
"self",
",",
"name",
")",
":",
"cards",
"=",
"self",
".",
"projectCards",
"for",
"card",
"in",
"cards",
":",
"if",
"card",
".",
"name",
".",
"upper",
"(",
")",
"==",
"name",
".",
"upper",
"(",
")",
":",
"return",
"card",
"r... | Retrieve card object for given card name.
Args:
name (str): Name of card to be retrieved.
Returns:
:class:`.ProjectCard` or None: Project card object. Will return None if the card is not available. | [
"Retrieve",
"card",
"object",
"for",
"given",
"card",
"name",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L737-L753 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.deleteCard | def deleteCard(self, card_name, db_session):
"""
Removes card from gssha project file
"""
card_name = card_name.upper()
gssha_card = self.getCard(card_name)
if gssha_card is not None:
db_session.delete(gssha_card)
db_session.commit() | python | def deleteCard(self, card_name, db_session):
"""
Removes card from gssha project file
"""
card_name = card_name.upper()
gssha_card = self.getCard(card_name)
if gssha_card is not None:
db_session.delete(gssha_card)
db_session.commit() | [
"def",
"deleteCard",
"(",
"self",
",",
"card_name",
",",
"db_session",
")",
":",
"card_name",
"=",
"card_name",
".",
"upper",
"(",
")",
"gssha_card",
"=",
"self",
".",
"getCard",
"(",
"card_name",
")",
"if",
"gssha_card",
"is",
"not",
"None",
":",
"db_se... | Removes card from gssha project file | [
"Removes",
"card",
"from",
"gssha",
"project",
"file"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L776-L784 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getGridByCard | def getGridByCard(self, gssha_card_name):
"""
Returns GDALGrid object of GSSHA grid
Paramters:
gssha_card_name(str): Name of GSSHA project card for grid.
Returns:
GDALGrid
"""
with tmp_chdir(self.project_directory):
if gssha_card_name... | python | def getGridByCard(self, gssha_card_name):
"""
Returns GDALGrid object of GSSHA grid
Paramters:
gssha_card_name(str): Name of GSSHA project card for grid.
Returns:
GDALGrid
"""
with tmp_chdir(self.project_directory):
if gssha_card_name... | [
"def",
"getGridByCard",
"(",
"self",
",",
"gssha_card_name",
")",
":",
"with",
"tmp_chdir",
"(",
"self",
".",
"project_directory",
")",
":",
"if",
"gssha_card_name",
"not",
"in",
"(",
"self",
".",
"INPUT_MAPS",
"+",
"self",
".",
"WMS_DATASETS",
")",
":",
"... | Returns GDALGrid object of GSSHA grid
Paramters:
gssha_card_name(str): Name of GSSHA project card for grid.
Returns:
GDALGrid | [
"Returns",
"GDALGrid",
"object",
"of",
"GSSHA",
"grid"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1136-L1161 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getGrid | def getGrid(self, use_mask=True):
"""
Returns GDALGrid object of GSSHA model bounds
Paramters:
use_mask(bool): If True, uses watershed mask. Otherwise, it uses the elevaiton grid.
Returns:
GDALGrid
"""
grid_card_name = "WATERSHED_MASK"
i... | python | def getGrid(self, use_mask=True):
"""
Returns GDALGrid object of GSSHA model bounds
Paramters:
use_mask(bool): If True, uses watershed mask. Otherwise, it uses the elevaiton grid.
Returns:
GDALGrid
"""
grid_card_name = "WATERSHED_MASK"
i... | [
"def",
"getGrid",
"(",
"self",
",",
"use_mask",
"=",
"True",
")",
":",
"grid_card_name",
"=",
"\"WATERSHED_MASK\"",
"if",
"not",
"use_mask",
":",
"grid_card_name",
"=",
"\"ELEVATION\"",
"return",
"self",
".",
"getGridByCard",
"(",
"grid_card_name",
")"
] | Returns GDALGrid object of GSSHA model bounds
Paramters:
use_mask(bool): If True, uses watershed mask. Otherwise, it uses the elevaiton grid.
Returns:
GDALGrid | [
"Returns",
"GDALGrid",
"object",
"of",
"GSSHA",
"model",
"bounds"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1163-L1178 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getIndexGrid | def getIndexGrid(self, name):
"""
Returns GDALGrid object of index map
Paramters:
name(str): Name of index map in 'cmt' file.
Returns:
GDALGrid
"""
index_map = self.mapTableFile.indexMaps.filter_by(name=name).one()
gssha_pro_card = self.... | python | def getIndexGrid(self, name):
"""
Returns GDALGrid object of index map
Paramters:
name(str): Name of index map in 'cmt' file.
Returns:
GDALGrid
"""
index_map = self.mapTableFile.indexMaps.filter_by(name=name).one()
gssha_pro_card = self.... | [
"def",
"getIndexGrid",
"(",
"self",
",",
"name",
")",
":",
"index_map",
"=",
"self",
".",
"mapTableFile",
".",
"indexMaps",
".",
"filter_by",
"(",
"name",
"=",
"name",
")",
".",
"one",
"(",
")",
"gssha_pro_card",
"=",
"self",
".",
"getCard",
"(",
"\"#P... | Returns GDALGrid object of index map
Paramters:
name(str): Name of index map in 'cmt' file.
Returns:
GDALGrid | [
"Returns",
"GDALGrid",
"object",
"of",
"index",
"map"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1180-L1199 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getWkt | def getWkt(self):
"""
Returns GSSHA projection WKT string
"""
gssha_pro_card = self.getCard("#PROJECTION_FILE")
if gssha_pro_card is None:
raise ValueError("#PROJECTION_FILE card not found ...")
with tmp_chdir(self.project_directory):
gssha_prj_fi... | python | def getWkt(self):
"""
Returns GSSHA projection WKT string
"""
gssha_pro_card = self.getCard("#PROJECTION_FILE")
if gssha_pro_card is None:
raise ValueError("#PROJECTION_FILE card not found ...")
with tmp_chdir(self.project_directory):
gssha_prj_fi... | [
"def",
"getWkt",
"(",
"self",
")",
":",
"gssha_pro_card",
"=",
"self",
".",
"getCard",
"(",
"\"#PROJECTION_FILE\"",
")",
"if",
"gssha_pro_card",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"#PROJECTION_FILE card not found ...\"",
")",
"with",
"tmp_chdir",
"("... | Returns GSSHA projection WKT string | [
"Returns",
"GSSHA",
"projection",
"WKT",
"string"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1201-L1213 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.getOutlet | def getOutlet(self):
"""
Gets the outlet latitude and longitude.
Returns:
latitude(float): Latitude of grid cell center.
longitude(float): Longitude of grid cell center.
"""
# OUTROW, OUTCOL
outrow = int(self.getCard(name='OUTROW').value)-1
... | python | def getOutlet(self):
"""
Gets the outlet latitude and longitude.
Returns:
latitude(float): Latitude of grid cell center.
longitude(float): Longitude of grid cell center.
"""
# OUTROW, OUTCOL
outrow = int(self.getCard(name='OUTROW').value)-1
... | [
"def",
"getOutlet",
"(",
"self",
")",
":",
"outrow",
"=",
"int",
"(",
"self",
".",
"getCard",
"(",
"name",
"=",
"'OUTROW'",
")",
".",
"value",
")",
"-",
"1",
"outcol",
"=",
"int",
"(",
"self",
".",
"getCard",
"(",
"name",
"=",
"'OUTCOL'",
")",
".... | Gets the outlet latitude and longitude.
Returns:
latitude(float): Latitude of grid cell center.
longitude(float): Longitude of grid cell center. | [
"Gets",
"the",
"outlet",
"latitude",
"and",
"longitude",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1215-L1227 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.setOutlet | def setOutlet(self, col, row, outslope=None):
"""
Sets the outlet grid cell information in the project file.
Parameters:
col(float): 1-based column index.
row(float): 1-based row index.
outslope(Optional[float]): River slope at outlet.
"""
#OU... | python | def setOutlet(self, col, row, outslope=None):
"""
Sets the outlet grid cell information in the project file.
Parameters:
col(float): 1-based column index.
row(float): 1-based row index.
outslope(Optional[float]): River slope at outlet.
"""
#OU... | [
"def",
"setOutlet",
"(",
"self",
",",
"col",
",",
"row",
",",
"outslope",
"=",
"None",
")",
":",
"gssha_grid",
"=",
"self",
".",
"getGrid",
"(",
")",
"self",
".",
"setCard",
"(",
"name",
"=",
"'OUTROW'",
",",
"value",
"=",
"str",
"(",
"row",
")",
... | Sets the outlet grid cell information in the project file.
Parameters:
col(float): 1-based column index.
row(float): 1-based row index.
outslope(Optional[float]): River slope at outlet. | [
"Sets",
"the",
"outlet",
"grid",
"cell",
"information",
"in",
"the",
"project",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1229-L1247 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.findOutlet | def findOutlet(self, shapefile_path):
"""
Calculate outlet location
"""
# determine outlet from shapefile
# by getting outlet from first point in polygon
# make sure the boundary geometry is valid
check_watershed_boundary_geometry(shapefile_path)
shapefi... | python | def findOutlet(self, shapefile_path):
"""
Calculate outlet location
"""
# determine outlet from shapefile
# by getting outlet from first point in polygon
# make sure the boundary geometry is valid
check_watershed_boundary_geometry(shapefile_path)
shapefi... | [
"def",
"findOutlet",
"(",
"self",
",",
"shapefile_path",
")",
":",
"check_watershed_boundary_geometry",
"(",
"shapefile_path",
")",
"shapefile",
"=",
"ogr",
".",
"Open",
"(",
"shapefile_path",
")",
"source_layer",
"=",
"shapefile",
".",
"GetLayer",
"(",
"0",
")"... | Calculate outlet location | [
"Calculate",
"outlet",
"location"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1249-L1319 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.calculateOutletSlope | def calculateOutletSlope(self):
"""
Attempt to determine the slope at the OUTLET
"""
try:
mask_grid = self.getGrid()
elevation_grid = self.getGrid(use_mask=False)
outrow = int(self.getCard("OUTROW").value)-1
outcol = int(self.getCard("OUTC... | python | def calculateOutletSlope(self):
"""
Attempt to determine the slope at the OUTLET
"""
try:
mask_grid = self.getGrid()
elevation_grid = self.getGrid(use_mask=False)
outrow = int(self.getCard("OUTROW").value)-1
outcol = int(self.getCard("OUTC... | [
"def",
"calculateOutletSlope",
"(",
"self",
")",
":",
"try",
":",
"mask_grid",
"=",
"self",
".",
"getGrid",
"(",
")",
"elevation_grid",
"=",
"self",
".",
"getGrid",
"(",
"use_mask",
"=",
"False",
")",
"outrow",
"=",
"int",
"(",
"self",
".",
"getCard",
... | Attempt to determine the slope at the OUTLET | [
"Attempt",
"to",
"determine",
"the",
"slope",
"at",
"the",
"OUTLET"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1321-L1359 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile.timezone | def timezone(self):
"""
timezone of GSSHA model
"""
if self._tz is None:
# GET CENTROID FROM GSSHA GRID
cen_lat, cen_lon = self.centerLatLon()
# update time zone
tf = TimezoneFinder()
tz_name = tf.timezone_at(lng=cen_lon, lat=ce... | python | def timezone(self):
"""
timezone of GSSHA model
"""
if self._tz is None:
# GET CENTROID FROM GSSHA GRID
cen_lat, cen_lon = self.centerLatLon()
# update time zone
tf = TimezoneFinder()
tz_name = tf.timezone_at(lng=cen_lon, lat=ce... | [
"def",
"timezone",
"(",
"self",
")",
":",
"if",
"self",
".",
"_tz",
"is",
"None",
":",
"cen_lat",
",",
"cen_lon",
"=",
"self",
".",
"centerLatLon",
"(",
")",
"tf",
"=",
"TimezoneFinder",
"(",
")",
"tz_name",
"=",
"tf",
".",
"timezone_at",
"(",
"lng",... | timezone of GSSHA model | [
"timezone",
"of",
"GSSHA",
"model"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1362-L1374 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._getBatchDirectory | def _getBatchDirectory(self, projectRootDirectory):
"""
Check the project file for the REPLACE_FOLDER card. If it exists, append it's value to create the batch directory path.
This is the directory output is written to when run in batch mode.
"""
# Set output directory to main di... | python | def _getBatchDirectory(self, projectRootDirectory):
"""
Check the project file for the REPLACE_FOLDER card. If it exists, append it's value to create the batch directory path.
This is the directory output is written to when run in batch mode.
"""
# Set output directory to main di... | [
"def",
"_getBatchDirectory",
"(",
"self",
",",
"projectRootDirectory",
")",
":",
"batchDirectory",
"=",
"projectRootDirectory",
"replaceFolderCard",
"=",
"self",
".",
"getCard",
"(",
"'REPLACE_FOLDER'",
")",
"if",
"replaceFolderCard",
":",
"replaceDir",
"=",
"replaceF... | Check the project file for the REPLACE_FOLDER card. If it exists, append it's value to create the batch directory path.
This is the directory output is written to when run in batch mode. | [
"Check",
"the",
"project",
"file",
"for",
"the",
"REPLACE_FOLDER",
"card",
".",
"If",
"it",
"exists",
"append",
"it",
"s",
"value",
"to",
"create",
"the",
"batch",
"directory",
"path",
".",
"This",
"is",
"the",
"directory",
"output",
"is",
"written",
"to",... | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1426-L1446 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._readXput | def _readXput(self, fileCards, directory, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None):
"""
GSSHAPY Project Read Files from File Method
"""
## NOTE: This function is dependent on the project file being read first
# Read Input/Output Files
for ca... | python | def _readXput(self, fileCards, directory, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None):
"""
GSSHAPY Project Read Files from File Method
"""
## NOTE: This function is dependent on the project file being read first
# Read Input/Output Files
for ca... | [
"def",
"_readXput",
"(",
"self",
",",
"fileCards",
",",
"directory",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"4236",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"for",
"card",
"in",
"self",
".",
"projectCards",
":"... | GSSHAPY Project Read Files from File Method | [
"GSSHAPY",
"Project",
"Read",
"Files",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1448-L1466 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._readXputMaps | def _readXputMaps(self, mapCards, directory, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None):
"""
GSSHA Project Read Map Files from File Method
"""
if self.mapType in self.MAP_TYPES_SUPPORTED:
for card in self.projectCards:
if (card.nam... | python | def _readXputMaps(self, mapCards, directory, session, spatial=False, spatialReferenceID=4236, replaceParamFile=None):
"""
GSSHA Project Read Map Files from File Method
"""
if self.mapType in self.MAP_TYPES_SUPPORTED:
for card in self.projectCards:
if (card.nam... | [
"def",
"_readXputMaps",
"(",
"self",
",",
"mapCards",
",",
"directory",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"4236",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"if",
"self",
".",
"mapType",
"in",
"self",
".",
... | GSSHA Project Read Map Files from File Method | [
"GSSHA",
"Project",
"Read",
"Map",
"Files",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1468-L1501 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._readWMSDatasets | def _readWMSDatasets(self, datasetCards, directory, session, spatial=False, spatialReferenceID=4236):
"""
Method to handle the special case of WMS Dataset Files. WMS Dataset Files
cannot be read in independently as other types of file can. They rely on
the Mask Map file for some paramete... | python | def _readWMSDatasets(self, datasetCards, directory, session, spatial=False, spatialReferenceID=4236):
"""
Method to handle the special case of WMS Dataset Files. WMS Dataset Files
cannot be read in independently as other types of file can. They rely on
the Mask Map file for some paramete... | [
"def",
"_readWMSDatasets",
"(",
"self",
",",
"datasetCards",
",",
"directory",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"4236",
")",
":",
"if",
"self",
".",
"mapType",
"in",
"self",
".",
"MAP_TYPES_SUPPORTED",
":",
"maskM... | Method to handle the special case of WMS Dataset Files. WMS Dataset Files
cannot be read in independently as other types of file can. They rely on
the Mask Map file for some parameters. | [
"Method",
"to",
"handle",
"the",
"special",
"case",
"of",
"WMS",
"Dataset",
"Files",
".",
"WMS",
"Dataset",
"Files",
"cannot",
"be",
"read",
"in",
"independently",
"as",
"other",
"types",
"of",
"file",
"can",
".",
"They",
"rely",
"on",
"the",
"Mask",
"Ma... | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1503-L1533 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._readBatchOutputForFile | def _readBatchOutputForFile(self, directory, fileIO, filename, session, spatial, spatialReferenceID,
replaceParamFile=None, maskMap=None):
"""
When batch mode is run in GSSHA, the files of the same type are
prepended with an integer to avoid filename conflicts.
... | python | def _readBatchOutputForFile(self, directory, fileIO, filename, session, spatial, spatialReferenceID,
replaceParamFile=None, maskMap=None):
"""
When batch mode is run in GSSHA, the files of the same type are
prepended with an integer to avoid filename conflicts.
... | [
"def",
"_readBatchOutputForFile",
"(",
"self",
",",
"directory",
",",
"fileIO",
",",
"filename",
",",
"session",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
"=",
"None",
",",
"maskMap",
"=",
"None",
")",
":",
"directoryList",
"=",
"os",... | When batch mode is run in GSSHA, the files of the same type are
prepended with an integer to avoid filename conflicts.
This will attempt to read files in this format and
throw warnings if the files aren't found. | [
"When",
"batch",
"mode",
"is",
"run",
"in",
"GSSHA",
"the",
"files",
"of",
"the",
"same",
"type",
"are",
"prepended",
"with",
"an",
"integer",
"to",
"avoid",
"filename",
"conflicts",
".",
"This",
"will",
"attempt",
"to",
"read",
"files",
"in",
"this",
"f... | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1577-L1621 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._invokeRead | def _invokeRead(self, fileIO, directory, filename, session, spatial=False,
spatialReferenceID=4236, replaceParamFile=None, **kwargs):
"""
Invoke File Read Method on Other Files
"""
path = os.path.join(directory, filename)
if os.path.isfile(path):
... | python | def _invokeRead(self, fileIO, directory, filename, session, spatial=False,
spatialReferenceID=4236, replaceParamFile=None, **kwargs):
"""
Invoke File Read Method on Other Files
"""
path = os.path.join(directory, filename)
if os.path.isfile(path):
... | [
"def",
"_invokeRead",
"(",
"self",
",",
"fileIO",
",",
"directory",
",",
"filename",
",",
"session",
",",
"spatial",
"=",
"False",
",",
"spatialReferenceID",
"=",
"4236",
",",
"replaceParamFile",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"path",
"=",
"... | Invoke File Read Method on Other Files | [
"Invoke",
"File",
"Read",
"Method",
"on",
"Other",
"Files"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1623-L1639 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._writeXput | def _writeXput(self, session, directory, fileCards,
name=None, replaceParamFile=None):
"""
GSSHA Project Write Files to File Method
"""
for card in self.projectCards:
if (card.name in fileCards) and self._noneOrNumValue(card.value) \
and... | python | def _writeXput(self, session, directory, fileCards,
name=None, replaceParamFile=None):
"""
GSSHA Project Write Files to File Method
"""
for card in self.projectCards:
if (card.name in fileCards) and self._noneOrNumValue(card.value) \
and... | [
"def",
"_writeXput",
"(",
"self",
",",
"session",
",",
"directory",
",",
"fileCards",
",",
"name",
"=",
"None",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"for",
"card",
"in",
"self",
".",
"projectCards",
":",
"if",
"(",
"card",
".",
"name",
"in",... | GSSHA Project Write Files to File Method | [
"GSSHA",
"Project",
"Write",
"Files",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1642-L1669 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._writeXputMaps | def _writeXputMaps(self, session, directory, mapCards,
name=None, replaceParamFile=None):
"""
GSSHAPY Project Write Map Files to File Method
"""
if self.mapType in self.MAP_TYPES_SUPPORTED:
for card in self.projectCards:
if (card.name in... | python | def _writeXputMaps(self, session, directory, mapCards,
name=None, replaceParamFile=None):
"""
GSSHAPY Project Write Map Files to File Method
"""
if self.mapType in self.MAP_TYPES_SUPPORTED:
for card in self.projectCards:
if (card.name in... | [
"def",
"_writeXputMaps",
"(",
"self",
",",
"session",
",",
"directory",
",",
"mapCards",
",",
"name",
"=",
"None",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"if",
"self",
".",
"mapType",
"in",
"self",
".",
"MAP_TYPES_SUPPORTED",
":",
"for",
"card",
... | GSSHAPY Project Write Map Files to File Method | [
"GSSHAPY",
"Project",
"Write",
"Map",
"Files",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1671-L1709 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._writeWMSDatasets | def _writeWMSDatasets(self, session, directory, wmsDatasetCards, name=None):
"""
GSSHAPY Project Write WMS Datasets to File Method
"""
if self.mapType in self.MAP_TYPES_SUPPORTED:
for card in self.projectCards:
if (card.name in wmsDatasetCards) and self._noneO... | python | def _writeWMSDatasets(self, session, directory, wmsDatasetCards, name=None):
"""
GSSHAPY Project Write WMS Datasets to File Method
"""
if self.mapType in self.MAP_TYPES_SUPPORTED:
for card in self.projectCards:
if (card.name in wmsDatasetCards) and self._noneO... | [
"def",
"_writeWMSDatasets",
"(",
"self",
",",
"session",
",",
"directory",
",",
"wmsDatasetCards",
",",
"name",
"=",
"None",
")",
":",
"if",
"self",
".",
"mapType",
"in",
"self",
".",
"MAP_TYPES_SUPPORTED",
":",
"for",
"card",
"in",
"self",
".",
"projectCa... | GSSHAPY Project Write WMS Datasets to File Method | [
"GSSHAPY",
"Project",
"Write",
"WMS",
"Datasets",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1711-L1761 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._writeReplacementFiles | def _writeReplacementFiles(self, session, directory, name):
"""
Write the replacement files
"""
if self.replaceParamFile:
self.replaceParamFile.write(session=session, directory=directory,
name=name)
if self.replaceValFile:
... | python | def _writeReplacementFiles(self, session, directory, name):
"""
Write the replacement files
"""
if self.replaceParamFile:
self.replaceParamFile.write(session=session, directory=directory,
name=name)
if self.replaceValFile:
... | [
"def",
"_writeReplacementFiles",
"(",
"self",
",",
"session",
",",
"directory",
",",
"name",
")",
":",
"if",
"self",
".",
"replaceParamFile",
":",
"self",
".",
"replaceParamFile",
".",
"write",
"(",
"session",
"=",
"session",
",",
"directory",
"=",
"director... | Write the replacement files | [
"Write",
"the",
"replacement",
"files"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1763-L1773 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectFile._invokeWrite | def _invokeWrite(self, fileIO, session, directory, filename, replaceParamFile):
"""
Invoke File Write Method on Other Files
"""
# Default value for instance
instance = None
try:
# Handle case where fileIO interfaces with single file
# Retrieve Fil... | python | def _invokeWrite(self, fileIO, session, directory, filename, replaceParamFile):
"""
Invoke File Write Method on Other Files
"""
# Default value for instance
instance = None
try:
# Handle case where fileIO interfaces with single file
# Retrieve Fil... | [
"def",
"_invokeWrite",
"(",
"self",
",",
"fileIO",
",",
"session",
",",
"directory",
",",
"filename",
",",
"replaceParamFile",
")",
":",
"instance",
"=",
"None",
"try",
":",
"instance",
"=",
"session",
".",
"query",
"(",
"fileIO",
")",
".",
"filter",
"("... | Invoke File Write Method on Other Files | [
"Invoke",
"File",
"Write",
"Method",
"on",
"Other",
"Files"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1802-L1842 | train |
CI-WATER/gsshapy | gsshapy/orm/prj.py | ProjectCard.write | def write(self, originalPrefix, newPrefix=None):
"""
Write project card to string.
Args:
originalPrefix (str): Original name to give to files that follow the project naming convention
(e.g: prefix.gag).
newPrefix (str, optional): If new prefix is desired,... | python | def write(self, originalPrefix, newPrefix=None):
"""
Write project card to string.
Args:
originalPrefix (str): Original name to give to files that follow the project naming convention
(e.g: prefix.gag).
newPrefix (str, optional): If new prefix is desired,... | [
"def",
"write",
"(",
"self",
",",
"originalPrefix",
",",
"newPrefix",
"=",
"None",
")",
":",
"numSpaces",
"=",
"max",
"(",
"2",
",",
"25",
"-",
"len",
"(",
"self",
".",
"name",
")",
")",
"if",
"self",
".",
"value",
"is",
"None",
":",
"line",
"=",... | Write project card to string.
Args:
originalPrefix (str): Original name to give to files that follow the project naming convention
(e.g: prefix.gag).
newPrefix (str, optional): If new prefix is desired, pass in this parameter. Defaults to None.
Returns:
... | [
"Write",
"project",
"card",
"to",
"string",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L2024-L2051 | train |
Robpol86/etaprogress | etaprogress/eta.py | ETA.elapsed | def elapsed(self):
"""Returns the number of seconds it has been since the start until the latest entry."""
if not self.started or self._start_time is None:
return 0.0
return self._timing_data[-1][0] - self._start_time | python | def elapsed(self):
"""Returns the number of seconds it has been since the start until the latest entry."""
if not self.started or self._start_time is None:
return 0.0
return self._timing_data[-1][0] - self._start_time | [
"def",
"elapsed",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"started",
"or",
"self",
".",
"_start_time",
"is",
"None",
":",
"return",
"0.0",
"return",
"self",
".",
"_timing_data",
"[",
"-",
"1",
"]",
"[",
"0",
"]",
"-",
"self",
".",
"_start_... | Returns the number of seconds it has been since the start until the latest entry. | [
"Returns",
"the",
"number",
"of",
"seconds",
"it",
"has",
"been",
"since",
"the",
"start",
"until",
"the",
"latest",
"entry",
"."
] | 224e8a248c2bf820bad218763281914ad3983fff | https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L83-L87 | train |
Robpol86/etaprogress | etaprogress/eta.py | ETA.rate_unstable | def rate_unstable(self):
"""Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute."""
if not self.started or self.stalled:
return 0.0
x1, y1 = self._timing_data[-2]
x2, y2 = self._timing_data[-1]
return (y2 - y1) / (x2 - ... | python | def rate_unstable(self):
"""Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute."""
if not self.started or self.stalled:
return 0.0
x1, y1 = self._timing_data[-2]
x2, y2 = self._timing_data[-1]
return (y2 - y1) / (x2 - ... | [
"def",
"rate_unstable",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"started",
"or",
"self",
".",
"stalled",
":",
"return",
"0.0",
"x1",
",",
"y1",
"=",
"self",
".",
"_timing_data",
"[",
"-",
"2",
"]",
"x2",
",",
"y2",
"=",
"self",
".",
"_ti... | Returns an unstable rate based on the last two entries in the timing data. Less intensive to compute. | [
"Returns",
"an",
"unstable",
"rate",
"based",
"on",
"the",
"last",
"two",
"entries",
"in",
"the",
"timing",
"data",
".",
"Less",
"intensive",
"to",
"compute",
"."
] | 224e8a248c2bf820bad218763281914ad3983fff | https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L90-L96 | train |
Robpol86/etaprogress | etaprogress/eta.py | ETA.rate_overall | def rate_overall(self):
"""Returns the overall average rate based on the start time."""
elapsed = self.elapsed
return self.rate if not elapsed else self.numerator / self.elapsed | python | def rate_overall(self):
"""Returns the overall average rate based on the start time."""
elapsed = self.elapsed
return self.rate if not elapsed else self.numerator / self.elapsed | [
"def",
"rate_overall",
"(",
"self",
")",
":",
"elapsed",
"=",
"self",
".",
"elapsed",
"return",
"self",
".",
"rate",
"if",
"not",
"elapsed",
"else",
"self",
".",
"numerator",
"/",
"self",
".",
"elapsed"
] | Returns the overall average rate based on the start time. | [
"Returns",
"the",
"overall",
"average",
"rate",
"based",
"on",
"the",
"start",
"time",
"."
] | 224e8a248c2bf820bad218763281914ad3983fff | https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L99-L102 | train |
Robpol86/etaprogress | etaprogress/eta.py | ETA._calculate | def _calculate(self):
"""Perform the ETA and rate calculation.
Two linear lines are used to calculate the ETA: the linear regression (line through a scatter-plot), and the
fitted line (a line that runs through the latest data point in _timing_data but parallel to the linear
regression l... | python | def _calculate(self):
"""Perform the ETA and rate calculation.
Two linear lines are used to calculate the ETA: the linear regression (line through a scatter-plot), and the
fitted line (a line that runs through the latest data point in _timing_data but parallel to the linear
regression l... | [
"def",
"_calculate",
"(",
"self",
")",
":",
"mean_x",
"=",
"sum",
"(",
"i",
"[",
"0",
"]",
"for",
"i",
"in",
"self",
".",
"_timing_data",
")",
"/",
"len",
"(",
"self",
".",
"_timing_data",
")",
"mean_y",
"=",
"sum",
"(",
"i",
"[",
"1",
"]",
"fo... | Perform the ETA and rate calculation.
Two linear lines are used to calculate the ETA: the linear regression (line through a scatter-plot), and the
fitted line (a line that runs through the latest data point in _timing_data but parallel to the linear
regression line).
As the percentage ... | [
"Perform",
"the",
"ETA",
"and",
"rate",
"calculation",
"."
] | 224e8a248c2bf820bad218763281914ad3983fff | https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/eta.py#L128-L169 | train |
CI-WATER/gsshapy | gsshapy/orm/hmet.py | HmetFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Read HMET WES from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse into HmetRecords
with op... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Read HMET WES from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse into HmetRecords
with op... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"self",
".",
"fileExtension",
"=",
"extension",
"with",
... | Read HMET WES from File Method | [
"Read",
"HMET",
"WES",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/hmet.py#L56-L87 | train |
CI-WATER/gsshapy | gsshapy/orm/hmet.py | HmetFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Write HMET WES to File Method
"""
## TODO: Ensure Other HMET Formats are supported
hmetRecords = self.hmetRecords
for record in hmetRecords:
openFile.write('%s\t%s\t%s\t%s\t%.3f\t%s\t%s\t%s\t%s\t%.2f\... | python | def _write(self, session, openFile, replaceParamFile):
"""
Write HMET WES to File Method
"""
## TODO: Ensure Other HMET Formats are supported
hmetRecords = self.hmetRecords
for record in hmetRecords:
openFile.write('%s\t%s\t%s\t%s\t%.3f\t%s\t%s\t%s\t%s\t%.2f\... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"hmetRecords",
"=",
"self",
".",
"hmetRecords",
"for",
"record",
"in",
"hmetRecords",
":",
"openFile",
".",
"write",
"(",
"'%s\\t%s\\t%s\\t%s\\t%.3f\\t%s\\t%s\\t%s\\t... | Write HMET WES to File Method | [
"Write",
"HMET",
"WES",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/hmet.py#L89-L108 | train |
CI-WATER/gsshapy | gsshapy/orm/evt.py | ProjectFileEventManager._read | def _read(self, directory, filename, session, path, name, extension,
spatial=None, spatialReferenceID=None, replaceParamFile=None):
"""
ProjectFileEvent Read from File Method
"""
yml_events = []
with open(path) as fo:
yml_events = yaml.load(fo)
... | python | def _read(self, directory, filename, session, path, name, extension,
spatial=None, spatialReferenceID=None, replaceParamFile=None):
"""
ProjectFileEvent Read from File Method
"""
yml_events = []
with open(path) as fo:
yml_events = yaml.load(fo)
... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
"=",
"None",
",",
"spatialReferenceID",
"=",
"None",
",",
"replaceParamFile",
"=",
"None",
")",
":",
"yml_events",
... | ProjectFileEvent Read from File Method | [
"ProjectFileEvent",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L30-L46 | train |
CI-WATER/gsshapy | gsshapy/orm/evt.py | ProjectFileEvent.as_yml | def as_yml(self):
"""
Return yml compatible version of self
"""
return YmlFileEvent(name=str(self.name),
subfolder=str(self.subfolder)) | python | def as_yml(self):
"""
Return yml compatible version of self
"""
return YmlFileEvent(name=str(self.name),
subfolder=str(self.subfolder)) | [
"def",
"as_yml",
"(",
"self",
")",
":",
"return",
"YmlFileEvent",
"(",
"name",
"=",
"str",
"(",
"self",
".",
"name",
")",
",",
"subfolder",
"=",
"str",
"(",
"self",
".",
"subfolder",
")",
")"
] | Return yml compatible version of self | [
"Return",
"yml",
"compatible",
"version",
"of",
"self"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/evt.py#L115-L120 | train |
timofurrer/ramlient | ramlient/request.py | prepare_request | def prepare_request(node):
"""
Prepare request to node's API route
:param Node node: the RAML node object
"""
if node.resource.method not in AVAILABLE_METHODS:
raise UnsupportedHTTPMethodError(node.resource.method)
def request(data=None, json=None, **kwargs):
"""
... | python | def prepare_request(node):
"""
Prepare request to node's API route
:param Node node: the RAML node object
"""
if node.resource.method not in AVAILABLE_METHODS:
raise UnsupportedHTTPMethodError(node.resource.method)
def request(data=None, json=None, **kwargs):
"""
... | [
"def",
"prepare_request",
"(",
"node",
")",
":",
"if",
"node",
".",
"resource",
".",
"method",
"not",
"in",
"AVAILABLE_METHODS",
":",
"raise",
"UnsupportedHTTPMethodError",
"(",
"node",
".",
"resource",
".",
"method",
")",
"def",
"request",
"(",
"data",
"=",... | Prepare request to node's API route
:param Node node: the RAML node object | [
"Prepare",
"request",
"to",
"node",
"s",
"API",
"route"
] | e93092252635a6b3b0aca2c390b9f820368b791c | https://github.com/timofurrer/ramlient/blob/e93092252635a6b3b0aca2c390b9f820368b791c/ramlient/request.py#L20-L47 | train |
vinci1it2000/schedula | examples/processing_chain/utils/plot.py | define_plot_data | def define_plot_data(data, x_name, *y_names):
"""
Defines the data to be plotted.
:param data:
All data.
:type data: dict
:param x_name:
x-axes name.
:type x_name: str
:param y_names:
y-axes names to be plotted.
:type y_names: str
:return:
Data to ... | python | def define_plot_data(data, x_name, *y_names):
"""
Defines the data to be plotted.
:param data:
All data.
:type data: dict
:param x_name:
x-axes name.
:type x_name: str
:param y_names:
y-axes names to be plotted.
:type y_names: str
:return:
Data to ... | [
"def",
"define_plot_data",
"(",
"data",
",",
"x_name",
",",
"*",
"y_names",
")",
":",
"it",
"=",
"[",
"]",
"for",
"k",
"in",
"y_names",
":",
"it",
".",
"append",
"(",
"{",
"'x'",
":",
"data",
"[",
"x_name",
"]",
",",
"'y'",
":",
"data",
"[",
"k... | Defines the data to be plotted.
:param data:
All data.
:type data: dict
:param x_name:
x-axes name.
:type x_name: str
:param y_names:
y-axes names to be plotted.
:type y_names: str
:return:
Data to be plotted.
:rtype: list | [
"Defines",
"the",
"data",
"to",
"be",
"plotted",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/utils/plot.py#L9-L36 | train |
vinci1it2000/schedula | examples/processing_chain/utils/plot.py | plot_lines | def plot_lines(it):
"""
Plotting lines.
:param it:
Data to plot where key value is the name of the series.
:type it: list[dict]
:return:
The plot.
:rtype: plotly.plotly.iplot
"""
data = [go.Scatter(mode='lines', **d) for d in it]
return py.iplot(data, filename='scat... | python | def plot_lines(it):
"""
Plotting lines.
:param it:
Data to plot where key value is the name of the series.
:type it: list[dict]
:return:
The plot.
:rtype: plotly.plotly.iplot
"""
data = [go.Scatter(mode='lines', **d) for d in it]
return py.iplot(data, filename='scat... | [
"def",
"plot_lines",
"(",
"it",
")",
":",
"data",
"=",
"[",
"go",
".",
"Scatter",
"(",
"mode",
"=",
"'lines'",
",",
"**",
"d",
")",
"for",
"d",
"in",
"it",
"]",
"return",
"py",
".",
"iplot",
"(",
"data",
",",
"filename",
"=",
"'scatter-mode'",
")... | Plotting lines.
:param it:
Data to plot where key value is the name of the series.
:type it: list[dict]
:return:
The plot.
:rtype: plotly.plotly.iplot | [
"Plotting",
"lines",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/utils/plot.py#L39-L52 | train |
dsoprea/PySecure | pysecure/adapters/channela.py | _ssh_channel_read | def _ssh_channel_read(ssh_channel_int, count, is_stderr):
"""Do a read on a channel."""
buffer_ = create_string_buffer(count)
while 1:
received_bytes = c_ssh_channel_read(ssh_channel_int,
cast(buffer_, c_void_p),
... | python | def _ssh_channel_read(ssh_channel_int, count, is_stderr):
"""Do a read on a channel."""
buffer_ = create_string_buffer(count)
while 1:
received_bytes = c_ssh_channel_read(ssh_channel_int,
cast(buffer_, c_void_p),
... | [
"def",
"_ssh_channel_read",
"(",
"ssh_channel_int",
",",
"count",
",",
"is_stderr",
")",
":",
"buffer_",
"=",
"create_string_buffer",
"(",
"count",
")",
"while",
"1",
":",
"received_bytes",
"=",
"c_ssh_channel_read",
"(",
"ssh_channel_int",
",",
"cast",
"(",
"bu... | Do a read on a channel. | [
"Do",
"a",
"read",
"on",
"a",
"channel",
"."
] | ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0 | https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/channela.py#L79-L106 | train |
CI-WATER/gsshapy | gsshapy/lib/gag_chunk.py | eventChunk | def eventChunk(key, lines):
"""
Parse EVENT chunks
"""
## NOTE: RADAR file format not supported currently.
## TODO: Add Support for RADAR file format type values
# Contants
KEYWORDS = ('EVENT',
'NRPDS',
'NRGAG',
'COORD',
'GAGES... | python | def eventChunk(key, lines):
"""
Parse EVENT chunks
"""
## NOTE: RADAR file format not supported currently.
## TODO: Add Support for RADAR file format type values
# Contants
KEYWORDS = ('EVENT',
'NRPDS',
'NRGAG',
'COORD',
'GAGES... | [
"def",
"eventChunk",
"(",
"key",
",",
"lines",
")",
":",
"KEYWORDS",
"=",
"(",
"'EVENT'",
",",
"'NRPDS'",
",",
"'NRGAG'",
",",
"'COORD'",
",",
"'GAGES'",
",",
"'ACCUM'",
",",
"'RATES'",
",",
"'RADAR'",
")",
"NUM_CARDS",
"=",
"(",
"'NRPDS'",
",",
"'NRGA... | Parse EVENT chunks | [
"Parse",
"EVENT",
"chunks"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/lib/gag_chunk.py#L15-L102 | train |
Losant/losant-rest-python | losantrest/client.py | Client.request | def request(self, method, path, params=None, headers=None, body=None):
""" Base method for making a Losant API request """
if not headers:
headers = {}
if not params:
params = {}
headers["Accept"] = "application/json"
headers["Accept-Version"] = "^1.15.0"... | python | def request(self, method, path, params=None, headers=None, body=None):
""" Base method for making a Losant API request """
if not headers:
headers = {}
if not params:
params = {}
headers["Accept"] = "application/json"
headers["Accept-Version"] = "^1.15.0"... | [
"def",
"request",
"(",
"self",
",",
"method",
",",
"path",
",",
"params",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"body",
"=",
"None",
")",
":",
"if",
"not",
"headers",
":",
"headers",
"=",
"{",
"}",
"if",
"not",
"params",
":",
"params",
"... | Base method for making a Losant API request | [
"Base",
"method",
"for",
"making",
"a",
"Losant",
"API",
"request"
] | 75b20decda0e999002f21811c3508f087e7f13b5 | https://github.com/Losant/losant-rest-python/blob/75b20decda0e999002f21811c3508f087e7f13b5/losantrest/client.py#L165-L190 | train |
Losant/losant-rest-python | losantrest/client.py | Client.flatten_params | def flatten_params(self, data, base_key=None):
""" Flatten out nested arrays and dicts in query params into correct format """
result = {}
if data is None:
return result
map_data = None
if not isinstance(data, collections.Mapping):
map_data = []
... | python | def flatten_params(self, data, base_key=None):
""" Flatten out nested arrays and dicts in query params into correct format """
result = {}
if data is None:
return result
map_data = None
if not isinstance(data, collections.Mapping):
map_data = []
... | [
"def",
"flatten_params",
"(",
"self",
",",
"data",
",",
"base_key",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"if",
"data",
"is",
"None",
":",
"return",
"result",
"map_data",
"=",
"None",
"if",
"not",
"isinstance",
"(",
"data",
",",
"collections"... | Flatten out nested arrays and dicts in query params into correct format | [
"Flatten",
"out",
"nested",
"arrays",
"and",
"dicts",
"in",
"query",
"params",
"into",
"correct",
"format"
] | 75b20decda0e999002f21811c3508f087e7f13b5 | https://github.com/Losant/losant-rest-python/blob/75b20decda0e999002f21811c3508f087e7f13b5/losantrest/client.py#L192-L216 | train |
vinci1it2000/schedula | examples/processing_chain/process.py | read_excel | def read_excel(input_fpath):
"""
Reads the excel file.
:param input_fpath:
Input file path.
:type input_fpath: str
:return:
Raw Data.
:rtype: dict
"""
return {k: v.values for k, v in pd.read_excel(input_fpath).items()} | python | def read_excel(input_fpath):
"""
Reads the excel file.
:param input_fpath:
Input file path.
:type input_fpath: str
:return:
Raw Data.
:rtype: dict
"""
return {k: v.values for k, v in pd.read_excel(input_fpath).items()} | [
"def",
"read_excel",
"(",
"input_fpath",
")",
":",
"return",
"{",
"k",
":",
"v",
".",
"values",
"for",
"k",
",",
"v",
"in",
"pd",
".",
"read_excel",
"(",
"input_fpath",
")",
".",
"items",
"(",
")",
"}"
] | Reads the excel file.
:param input_fpath:
Input file path.
:type input_fpath: str
:return:
Raw Data.
:rtype: dict | [
"Reads",
"the",
"excel",
"file",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/process.py#L13-L25 | train |
vinci1it2000/schedula | examples/processing_chain/process.py | save_outputs | def save_outputs(outputs, output_fpath):
"""
Save model outputs in an Excel file.
:param outputs:
Model outputs.
:type outputs: dict
:param output_fpath:
Output file path.
:type output_fpath: str
"""
df = pd.DataFrame(outputs)
with pd.ExcelWriter(output_fpath) as wr... | python | def save_outputs(outputs, output_fpath):
"""
Save model outputs in an Excel file.
:param outputs:
Model outputs.
:type outputs: dict
:param output_fpath:
Output file path.
:type output_fpath: str
"""
df = pd.DataFrame(outputs)
with pd.ExcelWriter(output_fpath) as wr... | [
"def",
"save_outputs",
"(",
"outputs",
",",
"output_fpath",
")",
":",
"df",
"=",
"pd",
".",
"DataFrame",
"(",
"outputs",
")",
"with",
"pd",
".",
"ExcelWriter",
"(",
"output_fpath",
")",
"as",
"writer",
":",
"df",
".",
"to_excel",
"(",
"writer",
")"
] | Save model outputs in an Excel file.
:param outputs:
Model outputs.
:type outputs: dict
:param output_fpath:
Output file path.
:type output_fpath: str | [
"Save",
"model",
"outputs",
"in",
"an",
"Excel",
"file",
"."
] | addb9fd685be81544b796c51383ac00a31543ce9 | https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/examples/processing_chain/process.py#L51-L65 | train |
CI-WATER/gsshapy | gsshapy/orm/gag.py | PrecipFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Precipitation Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and parse function... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Precipitation Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and parse function... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"self",
".",
"fileExtension",
"=",
"extension",
"KEYWORD... | Precipitation Read from File Method | [
"Precipitation",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L62-L84 | train |
CI-WATER/gsshapy | gsshapy/orm/gag.py | PrecipFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Precipitation File Write to File Method
"""
# Retrieve the events associated with this PrecipFile
events = self.precipEvents
# Write each event to file
for event in events:
openFile.write('EVE... | python | def _write(self, session, openFile, replaceParamFile):
"""
Precipitation File Write to File Method
"""
# Retrieve the events associated with this PrecipFile
events = self.precipEvents
# Write each event to file
for event in events:
openFile.write('EVE... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"events",
"=",
"self",
".",
"precipEvents",
"for",
"event",
"in",
"events",
":",
"openFile",
".",
"write",
"(",
"'EVENT \"%s\"\\nNRGAG %s\\nNRPDS %s\\n'",
"%",
"(... | Precipitation File Write to File Method | [
"Precipitation",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L86-L148 | train |
CI-WATER/gsshapy | gsshapy/orm/gag.py | PrecipFile._createGsshaPyObjects | def _createGsshaPyObjects(self, eventChunk):
"""
Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method
"""
## TODO: Add Support for RADAR file format type values
# Create GSSHAPY PrecipEvent
event = PrecipEvent(description=eventChunk['description'],
... | python | def _createGsshaPyObjects(self, eventChunk):
"""
Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method
"""
## TODO: Add Support for RADAR file format type values
# Create GSSHAPY PrecipEvent
event = PrecipEvent(description=eventChunk['description'],
... | [
"def",
"_createGsshaPyObjects",
"(",
"self",
",",
"eventChunk",
")",
":",
"event",
"=",
"PrecipEvent",
"(",
"description",
"=",
"eventChunk",
"[",
"'description'",
"]",
",",
"nrGag",
"=",
"eventChunk",
"[",
"'nrgag'",
"]",
",",
"nrPds",
"=",
"eventChunk",
"[... | Create GSSHAPY PrecipEvent, PrecipValue, and PrecipGage Objects Method | [
"Create",
"GSSHAPY",
"PrecipEvent",
"PrecipValue",
"and",
"PrecipGage",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/gag.py#L150-L186 | train |
CI-WATER/gsshapy | gsshapy/orm/pro.py | ProjectionFile.lookupSpatialReferenceID | def lookupSpatialReferenceID(cls, directory, filename):
"""
Look up spatial reference system using the projection file.
Args:
directory (str):
filename (str):
Return:
int: Spatial Reference ID
"""
path = os.path.join(directory, filen... | python | def lookupSpatialReferenceID(cls, directory, filename):
"""
Look up spatial reference system using the projection file.
Args:
directory (str):
filename (str):
Return:
int: Spatial Reference ID
"""
path = os.path.join(directory, filen... | [
"def",
"lookupSpatialReferenceID",
"(",
"cls",
",",
"directory",
",",
"filename",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"filename",
")",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"f",
":",
"srid",
"="... | Look up spatial reference system using the projection file.
Args:
directory (str):
filename (str):
Return:
int: Spatial Reference ID | [
"Look",
"up",
"spatial",
"reference",
"system",
"using",
"the",
"projection",
"file",
"."
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/pro.py#L61-L78 | train |
CI-WATER/gsshapy | gsshapy/orm/pro.py | ProjectionFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Projection File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse into a data structure
... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Projection File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Open file and parse into a data structure
... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"self",
".",
"fileExtension",
"=",
"extension",
"with",
... | Projection File Read from File Method | [
"Projection",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/pro.py#L81-L90 | train |
CI-WATER/gsshapy | gsshapy/orm/pro.py | ProjectionFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Projection File Write to File Method
"""
# Write lines
openFile.write(text(self.projection)) | python | def _write(self, session, openFile, replaceParamFile):
"""
Projection File Write to File Method
"""
# Write lines
openFile.write(text(self.projection)) | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"openFile",
".",
"write",
"(",
"text",
"(",
"self",
".",
"projection",
")",
")"
] | Projection File Write to File Method | [
"Projection",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/pro.py#L92-L97 | train |
Robpol86/etaprogress | etaprogress/components/base_progress_bar.py | BaseProgressBar.numerator | def numerator(self, value):
"""Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator."""
# If ETA is every iteration, don't do anything fancy.
if self.eta_every <= 1:
self._eta.numerator = value
self._eta_string = self._generate_e... | python | def numerator(self, value):
"""Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator."""
# If ETA is every iteration, don't do anything fancy.
if self.eta_every <= 1:
self._eta.numerator = value
self._eta_string = self._generate_e... | [
"def",
"numerator",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"eta_every",
"<=",
"1",
":",
"self",
".",
"_eta",
".",
"numerator",
"=",
"value",
"self",
".",
"_eta_string",
"=",
"self",
".",
"_generate_eta",
"(",
"self",
".",
"_eta",
"."... | Sets a new numerator and generates the ETA. Must be greater than or equal to previous numerator. | [
"Sets",
"a",
"new",
"numerator",
"and",
"generates",
"the",
"ETA",
".",
"Must",
"be",
"greater",
"than",
"or",
"equal",
"to",
"previous",
"numerator",
"."
] | 224e8a248c2bf820bad218763281914ad3983fff | https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/base_progress_bar.py#L40-L61 | train |
Robpol86/etaprogress | etaprogress/components/base_progress_bar.py | BaseProgressBar.rate | def rate(self):
"""Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance."""
return float(self._eta.rate_unstable if self.eta_every > 1 else self._eta.rate) | python | def rate(self):
"""Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance."""
return float(self._eta.rate_unstable if self.eta_every > 1 else self._eta.rate) | [
"def",
"rate",
"(",
"self",
")",
":",
"return",
"float",
"(",
"self",
".",
"_eta",
".",
"rate_unstable",
"if",
"self",
".",
"eta_every",
">",
"1",
"else",
"self",
".",
"_eta",
".",
"rate",
")"
] | Returns the rate of the progress as a float. Selects the unstable rate if eta_every > 1 for performance. | [
"Returns",
"the",
"rate",
"of",
"the",
"progress",
"as",
"a",
"float",
".",
"Selects",
"the",
"unstable",
"rate",
"if",
"eta_every",
">",
"1",
"for",
"performance",
"."
] | 224e8a248c2bf820bad218763281914ad3983fff | https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/base_progress_bar.py#L69-L71 | train |
CI-WATER/gsshapy | gsshapy/orm/ele.py | ElevationGridFile.generateFromRaster | def generateFromRaster(self,
elevation_raster,
shapefile_path=None,
out_elevation_grid=None,
resample_method=gdalconst.GRA_Average,
load_raster_to_db=True):
"""
Generate... | python | def generateFromRaster(self,
elevation_raster,
shapefile_path=None,
out_elevation_grid=None,
resample_method=gdalconst.GRA_Average,
load_raster_to_db=True):
"""
Generate... | [
"def",
"generateFromRaster",
"(",
"self",
",",
"elevation_raster",
",",
"shapefile_path",
"=",
"None",
",",
"out_elevation_grid",
"=",
"None",
",",
"resample_method",
"=",
"gdalconst",
".",
"GRA_Average",
",",
"load_raster_to_db",
"=",
"True",
")",
":",
"if",
"n... | Generates an elevation grid for the GSSHA simulation
from an elevation raster
Example::
from gsshapy.orm import ProjectFile, ElevationGridFile
from gsshapy.lib import db_tools as dbt
gssha_directory = '/gsshapy/tests/grid_standard/gssha_project'
elevat... | [
"Generates",
"an",
"elevation",
"grid",
"for",
"the",
"GSSHA",
"simulation",
"from",
"an",
"elevation",
"raster"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/ele.py#L42-L111 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._read | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Storm Pipe Network File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and pars... | python | def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile):
"""
Storm Pipe Network File Read from File Method
"""
# Set file extension property
self.fileExtension = extension
# Dictionary of keywords/cards and pars... | [
"def",
"_read",
"(",
"self",
",",
"directory",
",",
"filename",
",",
"session",
",",
"path",
",",
"name",
",",
"extension",
",",
"spatial",
",",
"spatialReferenceID",
",",
"replaceParamFile",
")",
":",
"self",
".",
"fileExtension",
"=",
"extension",
"KEYWORD... | Storm Pipe Network File Read from File Method | [
"Storm",
"Pipe",
"Network",
"File",
"Read",
"from",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L65-L103 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._write | def _write(self, session, openFile, replaceParamFile):
"""
Storm Pipe Network File Write to File Method
"""
# Retrieve Connection objects and write to file
connections = self.connections
self._writeConnections(connections=connections,
fileOb... | python | def _write(self, session, openFile, replaceParamFile):
"""
Storm Pipe Network File Write to File Method
"""
# Retrieve Connection objects and write to file
connections = self.connections
self._writeConnections(connections=connections,
fileOb... | [
"def",
"_write",
"(",
"self",
",",
"session",
",",
"openFile",
",",
"replaceParamFile",
")",
":",
"connections",
"=",
"self",
".",
"connections",
"self",
".",
"_writeConnections",
"(",
"connections",
"=",
"connections",
",",
"fileObject",
"=",
"openFile",
")",... | Storm Pipe Network File Write to File Method | [
"Storm",
"Pipe",
"Network",
"File",
"Write",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L105-L122 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._createConnection | def _createConnection(self, connections):
"""
Create GSSHAPY Connection Objects Method
"""
for c in connections:
# Create GSSHAPY Connection object
connection = Connection(slinkNumber=c['slinkNumber'],
upSjuncNumber=c['upSjunc'... | python | def _createConnection(self, connections):
"""
Create GSSHAPY Connection Objects Method
"""
for c in connections:
# Create GSSHAPY Connection object
connection = Connection(slinkNumber=c['slinkNumber'],
upSjuncNumber=c['upSjunc'... | [
"def",
"_createConnection",
"(",
"self",
",",
"connections",
")",
":",
"for",
"c",
"in",
"connections",
":",
"connection",
"=",
"Connection",
"(",
"slinkNumber",
"=",
"c",
"[",
"'slinkNumber'",
"]",
",",
"upSjuncNumber",
"=",
"c",
"[",
"'upSjunc'",
"]",
",... | Create GSSHAPY Connection Objects Method | [
"Create",
"GSSHAPY",
"Connection",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L124-L136 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._createSlink | def _createSlink(self, slinks):
"""
Create GSSHAPY SuperLink, Pipe, and SuperNode Objects Method
"""
for slink in slinks:
# Create GSSHAPY SuperLink object
superLink = SuperLink(slinkNumber=slink['slinkNumber'],
numPipes=slink['n... | python | def _createSlink(self, slinks):
"""
Create GSSHAPY SuperLink, Pipe, and SuperNode Objects Method
"""
for slink in slinks:
# Create GSSHAPY SuperLink object
superLink = SuperLink(slinkNumber=slink['slinkNumber'],
numPipes=slink['n... | [
"def",
"_createSlink",
"(",
"self",
",",
"slinks",
")",
":",
"for",
"slink",
"in",
"slinks",
":",
"superLink",
"=",
"SuperLink",
"(",
"slinkNumber",
"=",
"slink",
"[",
"'slinkNumber'",
"]",
",",
"numPipes",
"=",
"slink",
"[",
"'numPipes'",
"]",
")",
"sup... | Create GSSHAPY SuperLink, Pipe, and SuperNode Objects Method | [
"Create",
"GSSHAPY",
"SuperLink",
"Pipe",
"and",
"SuperNode",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L138-L179 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._createSjunc | def _createSjunc(self, sjuncs):
"""
Create GSSHAPY SuperJunction Objects Method
"""
for sjunc in sjuncs:
# Create GSSHAPY SuperJunction object
superJunction = SuperJunction(sjuncNumber=sjunc['sjuncNumber'],
groundSurfaceE... | python | def _createSjunc(self, sjuncs):
"""
Create GSSHAPY SuperJunction Objects Method
"""
for sjunc in sjuncs:
# Create GSSHAPY SuperJunction object
superJunction = SuperJunction(sjuncNumber=sjunc['sjuncNumber'],
groundSurfaceE... | [
"def",
"_createSjunc",
"(",
"self",
",",
"sjuncs",
")",
":",
"for",
"sjunc",
"in",
"sjuncs",
":",
"superJunction",
"=",
"SuperJunction",
"(",
"sjuncNumber",
"=",
"sjunc",
"[",
"'sjuncNumber'",
"]",
",",
"groundSurfaceElev",
"=",
"sjunc",
"[",
"'groundSurfaceEl... | Create GSSHAPY SuperJunction Objects Method | [
"Create",
"GSSHAPY",
"SuperJunction",
"Objects",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L181-L199 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._writeConnections | def _writeConnections(self, connections, fileObject):
"""
Write Connections to File Method
"""
for connection in connections:
fileObject.write('CONNECT %s %s %s\n' % (
connection.slinkNumber,
connection.upSjuncNumber,
connect... | python | def _writeConnections(self, connections, fileObject):
"""
Write Connections to File Method
"""
for connection in connections:
fileObject.write('CONNECT %s %s %s\n' % (
connection.slinkNumber,
connection.upSjuncNumber,
connect... | [
"def",
"_writeConnections",
"(",
"self",
",",
"connections",
",",
"fileObject",
")",
":",
"for",
"connection",
"in",
"connections",
":",
"fileObject",
".",
"write",
"(",
"'CONNECT %s %s %s\\n'",
"%",
"(",
"connection",
".",
"slinkNumber",
",",
"connection",
"... | Write Connections to File Method | [
"Write",
"Connections",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L201-L209 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._writeSuperJunctions | def _writeSuperJunctions(self, superJunctions, fileObject):
"""
Write SuperJunctions to File Method
"""
for sjunc in superJunctions:
fileObject.write('SJUNC %s %.2f %.2f %.6f %s %s %s %.6f %.6f\n' % (
sjunc.sjuncNumber,
sjunc.groundSur... | python | def _writeSuperJunctions(self, superJunctions, fileObject):
"""
Write SuperJunctions to File Method
"""
for sjunc in superJunctions:
fileObject.write('SJUNC %s %.2f %.2f %.6f %s %s %s %.6f %.6f\n' % (
sjunc.sjuncNumber,
sjunc.groundSur... | [
"def",
"_writeSuperJunctions",
"(",
"self",
",",
"superJunctions",
",",
"fileObject",
")",
":",
"for",
"sjunc",
"in",
"superJunctions",
":",
"fileObject",
".",
"write",
"(",
"'SJUNC %s %.2f %.2f %.6f %s %s %s %.6f %.6f\\n'",
"%",
"(",
"sjunc",
".",
"sjuncNumb... | Write SuperJunctions to File Method | [
"Write",
"SuperJunctions",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L211-L225 | train |
CI-WATER/gsshapy | gsshapy/orm/spn.py | StormPipeNetworkFile._writeSuperLinks | def _writeSuperLinks(self, superLinks, fileObject):
"""
Write SuperLinks to File Method
"""
for slink in superLinks:
fileObject.write('SLINK %s %s\n' % (
slink.slinkNumber,
slink.numPipes))
for node in slink.superNodes:
... | python | def _writeSuperLinks(self, superLinks, fileObject):
"""
Write SuperLinks to File Method
"""
for slink in superLinks:
fileObject.write('SLINK %s %s\n' % (
slink.slinkNumber,
slink.numPipes))
for node in slink.superNodes:
... | [
"def",
"_writeSuperLinks",
"(",
"self",
",",
"superLinks",
",",
"fileObject",
")",
":",
"for",
"slink",
"in",
"superLinks",
":",
"fileObject",
".",
"write",
"(",
"'SLINK %s %s\\n'",
"%",
"(",
"slink",
".",
"slinkNumber",
",",
"slink",
".",
"numPipes",
... | Write SuperLinks to File Method | [
"Write",
"SuperLinks",
"to",
"File",
"Method"
] | 00fd4af0fd65f1614d75a52fe950a04fb0867f4c | https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/spn.py#L227-L257 | train |
theodoregoetz/wernher | wernher/pid_control.py | Controller.ziegler_nichols | def ziegler_nichols(self,ku,tu,control_type='pid'):
'''
ku = ultimate gain
tu = period of oscillation at ultimate gain
'''
converter = dict(
p = lambda ku,tu: (.5*ku, 0, 0),
pi = lambda ku,tu: (.45*ku, 1.2*(.45*ku)/tu, 0),
pd = lambda k... | python | def ziegler_nichols(self,ku,tu,control_type='pid'):
'''
ku = ultimate gain
tu = period of oscillation at ultimate gain
'''
converter = dict(
p = lambda ku,tu: (.5*ku, 0, 0),
pi = lambda ku,tu: (.45*ku, 1.2*(.45*ku)/tu, 0),
pd = lambda k... | [
"def",
"ziegler_nichols",
"(",
"self",
",",
"ku",
",",
"tu",
",",
"control_type",
"=",
"'pid'",
")",
":",
"converter",
"=",
"dict",
"(",
"p",
"=",
"lambda",
"ku",
",",
"tu",
":",
"(",
".5",
"*",
"ku",
",",
"0",
",",
"0",
")",
",",
"pi",
"=",
... | ku = ultimate gain
tu = period of oscillation at ultimate gain | [
"ku",
"=",
"ultimate",
"gain",
"tu",
"=",
"period",
"of",
"oscillation",
"at",
"ultimate",
"gain"
] | ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e | https://github.com/theodoregoetz/wernher/blob/ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e/wernher/pid_control.py#L110-L124 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.