repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
3 values
summary
stringlengths
4
350
Robpol86/etaprogress
etaprogress/components/units.py
UnitByte.auto
def auto(self): """Returns the highest whole-number unit.""" if self._value >= 1099511627776: return self.TiB, 'TiB' if self._value >= 1073741824: return self.GiB, 'GiB' if self._value >= 1048576: return self.MiB, 'MiB' if self._value >= 1024: ...
python
def auto(self): """Returns the highest whole-number unit.""" if self._value >= 1099511627776: return self.TiB, 'TiB' if self._value >= 1073741824: return self.GiB, 'GiB' if self._value >= 1048576: return self.MiB, 'MiB' if self._value >= 1024: ...
[ "def", "auto", "(", "self", ")", ":", "if", "self", ".", "_value", ">=", "1099511627776", ":", "return", "self", ".", "TiB", ",", "'TiB'", "if", "self", ".", "_value", ">=", "1073741824", ":", "return", "self", ".", "GiB", ",", "'GiB'", "if", "self",...
Returns the highest whole-number unit.
[ "Returns", "the", "highest", "whole", "-", "number", "unit", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/units.py#L82-L93
train
Returns the highest whole - number unit.
Robpol86/etaprogress
etaprogress/components/units.py
UnitByte.auto_no_thousands
def auto_no_thousands(self): """Like self.auto but calculates the next unit if >999.99.""" if self._value >= 1000000000000: return self.TiB, 'TiB' if self._value >= 1000000000: return self.GiB, 'GiB' if self._value >= 1000000: return self.MiB, 'MiB' ...
python
def auto_no_thousands(self): """Like self.auto but calculates the next unit if >999.99.""" if self._value >= 1000000000000: return self.TiB, 'TiB' if self._value >= 1000000000: return self.GiB, 'GiB' if self._value >= 1000000: return self.MiB, 'MiB' ...
[ "def", "auto_no_thousands", "(", "self", ")", ":", "if", "self", ".", "_value", ">=", "1000000000000", ":", "return", "self", ".", "TiB", ",", "'TiB'", "if", "self", ".", "_value", ">=", "1000000000", ":", "return", "self", ".", "GiB", ",", "'GiB'", "i...
Like self.auto but calculates the next unit if >999.99.
[ "Like", "self", ".", "auto", "but", "calculates", "the", "next", "unit", "if", ">", "999", ".", "99", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/etaprogress/components/units.py#L96-L107
train
Like self. auto but calculates the next unit if > 999. 99.
Robpol86/etaprogress
example_colors.py
error
def error(message, code=1): """Prints an error message to stderr and exits with a status of 1 by default.""" if message: print('ERROR: {0}'.format(message), file=sys.stderr) else: print(file=sys.stderr) sys.exit(code)
python
def error(message, code=1): """Prints an error message to stderr and exits with a status of 1 by default.""" if message: print('ERROR: {0}'.format(message), file=sys.stderr) else: print(file=sys.stderr) sys.exit(code)
[ "def", "error", "(", "message", ",", "code", "=", "1", ")", ":", "if", "message", ":", "print", "(", "'ERROR: {0}'", ".", "format", "(", "message", ")", ",", "file", "=", "sys", ".", "stderr", ")", "else", ":", "print", "(", "file", "=", "sys", "...
Prints an error message to stderr and exits with a status of 1 by default.
[ "Prints", "an", "error", "message", "to", "stderr", "and", "exits", "with", "a", "status", "of", "1", "by", "default", "." ]
224e8a248c2bf820bad218763281914ad3983fff
https://github.com/Robpol86/etaprogress/blob/224e8a248c2bf820bad218763281914ad3983fff/example_colors.py#L30-L36
train
Prints an error message to stderr and exits with a status of 1 by default.
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
update_hmet_card_file
def update_hmet_card_file(hmet_card_file_path, new_hmet_data_path): """This function updates the paths in the HMET card file to the new location of the HMET data. This is necessary because the file paths are absolute and will need to be updated if moved. Args: hmet_card_file_path(str): Location...
python
def update_hmet_card_file(hmet_card_file_path, new_hmet_data_path): """This function updates the paths in the HMET card file to the new location of the HMET data. This is necessary because the file paths are absolute and will need to be updated if moved. Args: hmet_card_file_path(str): Location...
[ "def", "update_hmet_card_file", "(", "hmet_card_file_path", ",", "new_hmet_data_path", ")", ":", "hmet_card_file_path_temp", "=", "\"{0}_tmp\"", ".", "format", "(", "hmet_card_file_path", ")", "try", ":", "remove", "(", "hmet_card_file_path_temp", ")", "except", "OSErro...
This function updates the paths in the HMET card file to the new location of the HMET data. This is necessary because the file paths are absolute and will need to be updated if moved. Args: hmet_card_file_path(str): Location of the file used for the HMET_ASCII card. new_hmet_data_path(str):...
[ "This", "function", "updates", "the", "paths", "in", "the", "HMET", "card", "file", "to", "the", "new", "location", "of", "the", "HMET", "data", ".", "This", "is", "necessary", "because", "the", "file", "paths", "are", "absolute", "and", "will", "need", ...
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L32-L67
train
This function updates the paths in the HMET card file to the new location of the HMET ASCII file.
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
GRIDtoGSSHA.xd
def xd(self): """get xarray dataset file handle to LSM files""" if self._xd is None: path_to_lsm_files = path.join(self.lsm_input_folder_path, self.lsm_search_card) self._xd = pa.open_mfdataset(path_to_lsm_files, ...
python
def xd(self): """get xarray dataset file handle to LSM files""" if self._xd is None: path_to_lsm_files = path.join(self.lsm_input_folder_path, self.lsm_search_card) self._xd = pa.open_mfdataset(path_to_lsm_files, ...
[ "def", "xd", "(", "self", ")", ":", "if", "self", ".", "_xd", "is", "None", ":", "path_to_lsm_files", "=", "path", ".", "join", "(", "self", ".", "lsm_input_folder_path", ",", "self", ".", "lsm_search_card", ")", "self", ".", "_xd", "=", "pa", ".", "...
get xarray dataset file handle to LSM files
[ "get", "xarray", "dataset", "file", "handle", "to", "LSM", "files" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L589-L606
train
get xarray dataset file handle to LSM files
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
Set subset indices based on extent
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
GRIDtoGSSHA._load_modeling_extent
def _load_modeling_extent(self): """ # Get extent from GSSHA Grid in LSM coordinates # Determine range within LSM Grid """ #### # STEP 1: Get extent from GSSHA Grid in LSM coordinates #### # reproject GSSHA grid and get bounds min_x, max_x, min_y, ...
python
def _load_modeling_extent(self): """ # Get extent from GSSHA Grid in LSM coordinates # Determine range within LSM Grid """ #### # STEP 1: Get extent from GSSHA Grid in LSM coordinates #### # reproject GSSHA grid and get bounds min_x, max_x, min_y, ...
[ "def", "_load_modeling_extent", "(", "self", ")", ":", "####", "# STEP 1: Get extent from GSSHA Grid in LSM coordinates", "####", "# reproject GSSHA grid and get bounds", "min_x", ",", "max_x", ",", "min_y", ",", "max_y", "=", "self", ".", "gssha_grid", ".", "bounds", "...
# Get extent from GSSHA Grid in LSM coordinates # Determine range within LSM Grid
[ "#", "Get", "extent", "from", "GSSHA", "Grid", "in", "LSM", "coordinates", "#", "Determine", "range", "within", "LSM", "Grid" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L633-L648
train
Load modeling extent from GSSHA grid and set subset indices
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
This converts a UTC time integer to a string
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
This function loads the LSM data from a netcdf file.
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
GRIDtoGSSHA._load_converted_gssha_data_from_lsm
def _load_converted_gssha_data_from_lsm(self, gssha_var, lsm_var, load_type, time_step=None): """ This function loads data from LSM and converts to GSSHA format """ if 'radiation' in gssha_var: conversion_factor = self.netcdf_attributes[gssha_var]['conversion_factor'][load_ty...
python
def _load_converted_gssha_data_from_lsm(self, gssha_var, lsm_var, load_type, time_step=None): """ This function loads data from LSM and converts to GSSHA format """ if 'radiation' in gssha_var: conversion_factor = self.netcdf_attributes[gssha_var]['conversion_factor'][load_ty...
[ "def", "_load_converted_gssha_data_from_lsm", "(", "self", ",", "gssha_var", ",", "lsm_var", ",", "load_type", ",", "time_step", "=", "None", ")", ":", "if", "'radiation'", "in", "gssha_var", ":", "conversion_factor", "=", "self", ".", "netcdf_attributes", "[", ...
This function loads data from LSM and converts to GSSHA format
[ "This", "function", "loads", "data", "from", "LSM", "and", "converts", "to", "GSSHA", "format" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L681-L806
train
This function loads data from LSM and converts to GSSHA format
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'", "]", "# make sure all required var...
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
This function checks the input var map array to ensure all required input variables exist and that all required input variables exist.
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
Resample the data to match the GSSHA grid
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
This function converts the data to hourly data and puts it into the data_np_array_unused when generating HMET DATA ONLY
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
This function takes array data and writes out a GSSHA ascii grid.
CI-WATER/gsshapy
gsshapy/grid/grid_to_gssha.py
GRIDtoGSSHA.lsm_precip_to_gssha_precip_gage
def lsm_precip_to_gssha_precip_gage(self, out_gage_file, lsm_data_var, precip_type="RADAR"): """This function takes array data and writes out a GSSHA precip gage file. See: http://www.gsshawiki.com/Precipitation:Spatially_and_Temporally_Varied_Precipitation .. note:: GSSHA CARDS: ...
python
def lsm_precip_to_gssha_precip_gage(self, out_gage_file, lsm_data_var, precip_type="RADAR"): """This function takes array data and writes out a GSSHA precip gage file. See: http://www.gsshawiki.com/Precipitation:Spatially_and_Temporally_Varied_Precipitation .. note:: GSSHA CARDS: ...
[ "def", "lsm_precip_to_gssha_precip_gage", "(", "self", ",", "out_gage_file", ",", "lsm_data_var", ",", "precip_type", "=", "\"RADAR\"", ")", ":", "VALID_TYPES", "=", "[", "\"ACCUM\"", ",", "\"RADAR\"", ",", "\"GAGES\"", "]", "#NOTE: \"RATES\" currently not supported", ...
This function takes array data and writes out a GSSHA precip gage file. See: http://www.gsshawiki.com/Precipitation:Spatially_and_Temporally_Varied_Precipitation .. note:: GSSHA CARDS: * PRECIP_FILE card with path to gage file * RAIN_INV_DISTANCE or RAIN_THIE...
[ "This", "function", "takes", "array", "data", "and", "writes", "out", "a", "GSSHA", "precip", "gage", "file", ".", "See", ":", "http", ":", "//", "www", ".", "gsshawiki", ".", "com", "/", "Precipitation", ":", "Spatially_and_Temporally_Varied_Precipitation" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/grid/grid_to_gssha.py#L965-L1058
train
This function takes array data and writes out a GSSHA precip file.
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
This function writes the HMET_ASCII card file with ASCII file list for input to GSSHA
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
Writes extracted data to Arc ASCII file format into folder containing the HMET_ASCII card file.
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", "=", "[", "]", "#DATA", "for", "...
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
Writes extracted data to the NetCDF file format
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
This function returns a CSV file from a query of devices and attributes over a time range.
CI-WATER/gsshapy
gsshapy/base/geom.py
GeometricObjectBase.getAsKml
def getAsKml(self, session): """ Retrieve the geometry in KML format. This method is a veneer for an SQL query that calls the ``ST_AsKml()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS en...
python
def getAsKml(self, session): """ Retrieve the geometry in KML format. This method is a veneer for an SQL query that calls the ``ST_AsKml()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS en...
[ "def", "getAsKml", "(", "self", ",", "session", ")", ":", "statement", "=", "\"\"\"\n SELECT ST_AsKml({0}) AS kml\n FROM {1}\n WHERE id={2};\n \"\"\"", ".", "format", "(", "self", ".", "geometryColumnName", ...
Retrieve the geometry in KML format. This method is a veneer for an SQL query that calls the ``ST_AsKml()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. Returns: str...
[ "Retrieve", "the", "geometry", "in", "KML", "format", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/geom.py#L24-L47
train
Retrieve the geometry in KML format.
CI-WATER/gsshapy
gsshapy/base/geom.py
GeometricObjectBase.getAsWkt
def getAsWkt(self, session): """ Retrieve the geometry in Well Known Text format. This method is a veneer for an SQL query that calls the ``ST_AsText()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound ...
python
def getAsWkt(self, session): """ Retrieve the geometry in Well Known Text format. This method is a veneer for an SQL query that calls the ``ST_AsText()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound ...
[ "def", "getAsWkt", "(", "self", ",", "session", ")", ":", "statement", "=", "\"\"\"\n SELECT ST_AsText({0}) AS wkt\n FROM {1}\n WHERE id={2};\n \"\"\"", ".", "format", "(", "self", ".", "geometryColumnName", ...
Retrieve the geometry in Well Known Text format. This method is a veneer for an SQL query that calls the ``ST_AsText()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. Returns: ...
[ "Retrieve", "the", "geometry", "in", "Well", "Known", "Text", "format", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/geom.py#L49-L72
train
Retrieve the geometry in Well Known Text format.
CI-WATER/gsshapy
gsshapy/base/geom.py
GeometricObjectBase.getAsGeoJson
def getAsGeoJson(self, session): """ Retrieve the geometry in GeoJSON format. This method is a veneer for an SQL query that calls the ``ST_AsGeoJSON()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound t...
python
def getAsGeoJson(self, session): """ Retrieve the geometry in GeoJSON format. This method is a veneer for an SQL query that calls the ``ST_AsGeoJSON()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound t...
[ "def", "getAsGeoJson", "(", "self", ",", "session", ")", ":", "statement", "=", "\"\"\"\n SELECT ST_AsGeoJSON({0}) AS json\n FROM {1}\n WHERE id={2};\n \"\"\"", ".", "format", "(", "self", ".", "geometryColum...
Retrieve the geometry in GeoJSON format. This method is a veneer for an SQL query that calls the ``ST_AsGeoJSON()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. Returns: ...
[ "Retrieve", "the", "geometry", "in", "GeoJSON", "format", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/geom.py#L74-L97
train
Retrieve the geometry in GeoJSON format.
CI-WATER/gsshapy
gsshapy/base/geom.py
GeometricObjectBase.getSpatialReferenceId
def getSpatialReferenceId(self, session): """ Retrieve the spatial reference id by which the geometry column is registered. This method is a veneer for an SQL query that calls the ``ST_SRID()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Ses...
python
def getSpatialReferenceId(self, session): """ Retrieve the spatial reference id by which the geometry column is registered. This method is a veneer for an SQL query that calls the ``ST_SRID()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Ses...
[ "def", "getSpatialReferenceId", "(", "self", ",", "session", ")", ":", "statement", "=", "\"\"\"\n SELECT ST_SRID({0}) AS srid\n FROM {1}\n WHERE id={2};\n \"\"\"", ".", "format", "(", "self", ".", "geometryC...
Retrieve the spatial reference id by which the geometry column is registered. This method is a veneer for an SQL query that calls the ``ST_SRID()`` function on the geometry column. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled dat...
[ "Retrieve", "the", "spatial", "reference", "id", "by", "which", "the", "geometry", "column", "is", "registered", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/geom.py#L99-L122
train
Returns the spatial reference id by which the geometry column is registered.
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
Generate a new object from a message in message and return a response in the appropriate format.
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
This method is called when a message is received from the queue.
pedrotgn/pyactor
pyactor/thread/actor.py
Actor.run
def run(self): ''' Creates the actor thread wich will process the channel queue while the actor :meth:`is_alive`, making it able to receive queries. ''' self.thread = Thread(target=self.__processQueue) self.thread.start()
python
def run(self): ''' Creates the actor thread wich will process the channel queue while the actor :meth:`is_alive`, making it able to receive queries. ''' self.thread = Thread(target=self.__processQueue) self.thread.start()
[ "def", "run", "(", "self", ")", ":", "self", ".", "thread", "=", "Thread", "(", "target", "=", "self", ".", "__processQueue", ")", "self", ".", "thread", ".", "start", "(", ")" ]
Creates the actor thread wich will process the channel queue while the actor :meth:`is_alive`, making it able to receive queries.
[ "Creates", "the", "actor", "thread", "wich", "will", "process", "the", "channel", "queue", "while", "the", "actor", ":", "meth", ":", "is_alive", "making", "it", "able", "to", "receive", "queries", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/actor.py#L141-L148
train
Creates the actor thread wich will process the channel queue while the actor is alive.
theodoregoetz/wernher
wernher/celestial_body.py
CelestialBody.right_ascension_at_time
def right_ascension_at_time(self,t): '''RA of prime meridian''' α0 = self.right_ascension_at_epoch t0 = self.epoch ω = self.rotational_speed return (α0 + ω * (t - t0)) % (2*π)
python
def right_ascension_at_time(self,t): '''RA of prime meridian''' α0 = self.right_ascension_at_epoch t0 = self.epoch ω = self.rotational_speed return (α0 + ω * (t - t0)) % (2*π)
[ "def", "right_ascension_at_time", "(", "self", ",", "t", ")", ":", "α0 ", " ", "elf.", "r", "ight_ascension_at_epoch", "t0", "=", "self", ".", "epoch", "ω ", " ", "elf.", "r", "otational_speed", "return", "(", "α0 ", " ", " *", "(", " ", "-", "t", "))"...
RA of prime meridian
[ "RA", "of", "prime", "meridian" ]
ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e
https://github.com/theodoregoetz/wernher/blob/ef5d3aabe24e532b5eab33cd0212b2dbc2c9022e/wernher/celestial_body.py#L56-L61
train
RA of prime meridian
tjvr/skip
skip/pygame_screen.py
blit_alpha
def blit_alpha(dest, source, pos, opacity): """Hack: blit per-pixel alpha source onto dest with surface opacity.""" # http://www.nerdparadise.com/tech/python/pygame/blitopacity/ (x, y) = pos temp = pygame.Surface((source.get_width(), source.get_height())).convert() temp.bl...
python
def blit_alpha(dest, source, pos, opacity): """Hack: blit per-pixel alpha source onto dest with surface opacity.""" # http://www.nerdparadise.com/tech/python/pygame/blitopacity/ (x, y) = pos temp = pygame.Surface((source.get_width(), source.get_height())).convert() temp.bl...
[ "def", "blit_alpha", "(", "dest", ",", "source", ",", "pos", ",", "opacity", ")", ":", "# http://www.nerdparadise.com/tech/python/pygame/blitopacity/", "(", "x", ",", "y", ")", "=", "pos", "temp", "=", "pygame", ".", "Surface", "(", "(", "source", ".", "get_...
Hack: blit per-pixel alpha source onto dest with surface opacity.
[ "Hack", ":", "blit", "per", "-", "pixel", "alpha", "source", "onto", "dest", "with", "surface", "opacity", "." ]
ac84f7198079732bf22c3b8cbc0dc1a073b1d539
https://github.com/tjvr/skip/blob/ac84f7198079732bf22c3b8cbc0dc1a073b1d539/skip/pygame_screen.py#L34-L43
train
blit per - pixel alpha source onto dest with surface opacity.
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
Downloads a file from the specified URL and returns the content of the downloaded file.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.add_data
def add_data(self, data_id=None, default_value=EMPTY, initial_dist=0.0, wait_inputs=False, wildcard=None, function=None, callback=None, description=None, filters=None, await_result=None, **kwargs): """ Add a single data node to the dispatcher. :param data_id: ...
python
def add_data(self, data_id=None, default_value=EMPTY, initial_dist=0.0, wait_inputs=False, wildcard=None, function=None, callback=None, description=None, filters=None, await_result=None, **kwargs): """ Add a single data node to the dispatcher. :param data_id: ...
[ "def", "add_data", "(", "self", ",", "data_id", "=", "None", ",", "default_value", "=", "EMPTY", ",", "initial_dist", "=", "0.0", ",", "wait_inputs", "=", "False", ",", "wildcard", "=", "None", ",", "function", "=", "None", ",", "callback", "=", "None", ...
Add a single data node to the dispatcher. :param data_id: Data node id. If None will be assigned automatically ('unknown<%d>') not in dmap. :type data_id: str, optional :param default_value: Data node default value. This will be used as input if it is not ...
[ "Add", "a", "single", "data", "node", "to", "the", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L222-L398
train
This method adds a single data node to the dispatcher.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.add_function
def add_function(self, function_id=None, function=None, inputs=None, outputs=None, input_domain=None, weight=None, inp_weight=None, out_weight=None, description=None, filters=None, await_domain=None, await_result=None, **kwargs): ...
python
def add_function(self, function_id=None, function=None, inputs=None, outputs=None, input_domain=None, weight=None, inp_weight=None, out_weight=None, description=None, filters=None, await_domain=None, await_result=None, **kwargs): ...
[ "def", "add_function", "(", "self", ",", "function_id", "=", "None", ",", "function", "=", "None", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "input_domain", "=", "None", ",", "weight", "=", "None", ",", "inp_weight", "=", "None", ",...
Add a single function node to dispatcher. :param function_id: Function node id. If None will be assigned as <fun.__name__>. :type function_id: str, optional :param function: Data node estimation function. :type function: callable, optional :...
[ "Add", "a", "single", "function", "node", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L400-L584
train
This method adds a function node to the dispatcher.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.add_func
def add_func(self, function, outputs=None, weight=None, inputs_defaults=False, inputs_kwargs=False, filters=None, input_domain=None, await_domain=None, await_result=None, inp_weight=None, out_weight=None, description=None, inputs=None, function_id=None...
python
def add_func(self, function, outputs=None, weight=None, inputs_defaults=False, inputs_kwargs=False, filters=None, input_domain=None, await_domain=None, await_result=None, inp_weight=None, out_weight=None, description=None, inputs=None, function_id=None...
[ "def", "add_func", "(", "self", ",", "function", ",", "outputs", "=", "None", ",", "weight", "=", "None", ",", "inputs_defaults", "=", "False", ",", "inputs_kwargs", "=", "False", ",", "filters", "=", "None", ",", "input_domain", "=", "None", ",", "await...
Add a single function node to dispatcher. :param inputs_kwargs: Do you want to include kwargs as inputs? :type inputs_kwargs: bool :param inputs_defaults: Do you want to set default values? :type inputs_defaults: bool :param function_id: Fun...
[ "Add", "a", "single", "function", "node", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L586-L724
train
Adds a function to the dispatcher.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.add_dispatcher
def add_dispatcher(self, dsp, inputs, outputs, dsp_id=None, input_domain=None, weight=None, inp_weight=None, description=None, include_defaults=False, await_domain=None, **kwargs): """ Add a single sub-dispatcher node to dispatcher. ...
python
def add_dispatcher(self, dsp, inputs, outputs, dsp_id=None, input_domain=None, weight=None, inp_weight=None, description=None, include_defaults=False, await_domain=None, **kwargs): """ Add a single sub-dispatcher node to dispatcher. ...
[ "def", "add_dispatcher", "(", "self", ",", "dsp", ",", "inputs", ",", "outputs", ",", "dsp_id", "=", "None", ",", "input_domain", "=", "None", ",", "weight", "=", "None", ",", "inp_weight", "=", "None", ",", "description", "=", "None", ",", "include_defa...
Add a single sub-dispatcher node to dispatcher. :param dsp: Child dispatcher that is added as sub-dispatcher node to the parent dispatcher. :type dsp: Dispatcher | dict[str, list] :param inputs: Inputs mapping. Data node ids from parent dispatcher to child ...
[ "Add", "a", "single", "sub", "-", "dispatcher", "node", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L726-L903
train
Adds a single sub - dispatcher node to the dispatcher.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.add_from_lists
def add_from_lists(self, data_list=None, fun_list=None, dsp_list=None): """ Add multiple function and data nodes to dispatcher. :param data_list: It is a list of data node kwargs to be loaded. :type data_list: list[dict], optional :param fun_list: It is ...
python
def add_from_lists(self, data_list=None, fun_list=None, dsp_list=None): """ Add multiple function and data nodes to dispatcher. :param data_list: It is a list of data node kwargs to be loaded. :type data_list: list[dict], optional :param fun_list: It is ...
[ "def", "add_from_lists", "(", "self", ",", "data_list", "=", "None", ",", "fun_list", "=", "None", ",", "dsp_list", "=", "None", ")", ":", "if", "data_list", ":", "# Add data nodes.", "data_ids", "=", "[", "self", ".", "add_data", "(", "*", "*", "v", "...
Add multiple function and data nodes to dispatcher. :param data_list: It is a list of data node kwargs to be loaded. :type data_list: list[dict], optional :param fun_list: It is a list of function node kwargs to be loaded. :type fun_list: list[dict], optional ...
[ "Add", "multiple", "function", "and", "data", "nodes", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L905-L989
train
Add multiple function and data nodes to dispatcher.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.set_default_value
def set_default_value(self, data_id, value=EMPTY, initial_dist=0.0): """ Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the...
python
def set_default_value(self, data_id, value=EMPTY, initial_dist=0.0): """ Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the...
[ "def", "set_default_value", "(", "self", ",", "data_id", ",", "value", "=", "EMPTY", ",", "initial_dist", "=", "0.0", ")", ":", "try", ":", "if", "self", ".", "dmap", ".", "nodes", "[", "data_id", "]", "[", "'type'", "]", "==", "'data'", ":", "# Is d...
Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the previous default value is removed. :type value: T, optional :param init...
[ "Set", "the", "default", "value", "of", "a", "data", "node", "in", "the", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L991-L1046
train
Set the default value of a data node in the dispatcher.
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", ")", ":", "# Get real paths.", "nodes_bunch", "=", "[", "self", ".", "get_node", "(", "u", ")", "[", "1", "]", "[", "0", "]", "for", "u", "in", "nodes_bunch", "]", ...
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
Returns the sub - dispatcher for given node and edge bunches.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher.get_sub_dsp_from_workflow
def get_sub_dsp_from_workflow( self, sources, graph=None, reverse=False, add_missing=False, check_inputs=True, blockers=None, wildcard=False, _update_links=True): """ Returns the sub-dispatcher induced by the workflow from sources. The induced sub-dispatcher ...
python
def get_sub_dsp_from_workflow( self, sources, graph=None, reverse=False, add_missing=False, check_inputs=True, blockers=None, wildcard=False, _update_links=True): """ Returns the sub-dispatcher induced by the workflow from sources. The induced sub-dispatcher ...
[ "def", "get_sub_dsp_from_workflow", "(", "self", ",", "sources", ",", "graph", "=", "None", ",", "reverse", "=", "False", ",", "add_missing", "=", "False", ",", "check_inputs", "=", "True", ",", "blockers", "=", "None", ",", "wildcard", "=", "False", ",", ...
Returns the sub-dispatcher induced by the workflow from sources. The induced sub-dispatcher of the dsp contains the reachable nodes and edges evaluated with breadth-first-search on the workflow graph from source nodes. :param sources: Source nodes for the breadth-first-sear...
[ "Returns", "the", "sub", "-", "dispatcher", "induced", "by", "the", "workflow", "from", "sources", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1148-L1381
train
This method returns the sub - dispatcher induced by the workflow graph from the given sources.
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
Returns all data nodes of the dispatcher.
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
Returns all function nodes of the dispatcher.
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
Returns all sub - dispatcher nodes of the dispatcher.
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
Constructs a BlueDispatcher out of the current object.
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
Extends Dispatcher calling each deferred operation of given Blueprints or Dispatchers.
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
Evaluate the dispatcher for the minimum workflow and data outputs of the data node.
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", ":", "# Get all data nod...
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
Returns a reduced dispatcher.
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", "# Get sub dispatcher breadth-first-search graph....
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
Returns the sub - dispatcher induced by the workflow from outputs.
vinci1it2000/schedula
schedula/dispatcher.py
Dispatcher._get_wait_in
def _get_wait_in(self, flag=True, all_domain=True): """ Set `wait_inputs` flags for data nodes that: - are estimated from functions with a domain function, and - are waiting inputs. :param flag: Value to be set. If None `wait_inputs` are just cleaned. ...
python
def _get_wait_in(self, flag=True, all_domain=True): """ Set `wait_inputs` flags for data nodes that: - are estimated from functions with a domain function, and - are waiting inputs. :param flag: Value to be set. If None `wait_inputs` are just cleaned. ...
[ "def", "_get_wait_in", "(", "self", ",", "flag", "=", "True", ",", "all_domain", "=", "True", ")", ":", "wait_in", "=", "{", "}", "for", "n", ",", "a", "in", "self", ".", "data_nodes", ".", "items", "(", ")", ":", "if", "n", "is", "not", "SINK", ...
Set `wait_inputs` flags for data nodes that: - are estimated from functions with a domain function, and - are waiting inputs. :param flag: Value to be set. If None `wait_inputs` are just cleaned. :type flag: bool, None, optional :param all_domain: ...
[ "Set", "wait_inputs", "flags", "for", "data", "nodes", "that", ":" ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/dispatcher.py#L1890-L1931
train
Get the wait_in dictionary for all data nodes that are not SINK and have a domain function and that are waiting inputs.
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
Adds a callback to the current object.
pedrotgn/pyactor
pyactor/thread/future.py
Future.result
def result(self, timeout=None): """Returns the result of the call that the future represents. :param timeout: The number of seconds to wait for the result if the future has not been completed. None, the default, sets no limit. :returns: The result of the call that the fu...
python
def result(self, timeout=None): """Returns the result of the call that the future represents. :param timeout: The number of seconds to wait for the result if the future has not been completed. None, the default, sets no limit. :returns: The result of the call that the fu...
[ "def", "result", "(", "self", ",", "timeout", "=", "None", ")", ":", "with", "self", ".", "__condition", ":", "if", "self", ".", "__state", "==", "FINISHED", ":", "return", "self", ".", "__get__result", "(", ")", "lock", "=", "get_lock", "(", ")", "i...
Returns the result of the call that the future represents. :param timeout: The number of seconds to wait for the result if the future has not been completed. None, the default, sets no limit. :returns: The result of the call that the future represents. :raises: TimeoutEr...
[ "Returns", "the", "result", "of", "the", "call", "that", "the", "future", "represents", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L90-L115
train
Returns the result of the call that the future represents.
pedrotgn/pyactor
pyactor/thread/future.py
Future.exception
def exception(self, timeout=None): """Return a exception raised by the call that the future represents. :param timeout: The number of seconds to wait for the exception if the future has not been completed. None, the default, sets no limit. :returns: The exception ...
python
def exception(self, timeout=None): """Return a exception raised by the call that the future represents. :param timeout: The number of seconds to wait for the exception if the future has not been completed. None, the default, sets no limit. :returns: The exception ...
[ "def", "exception", "(", "self", ",", "timeout", "=", "None", ")", ":", "with", "self", ".", "__condition", ":", "if", "self", ".", "__state", "==", "FINISHED", ":", "return", "self", ".", "__exception", "lock", "=", "get_lock", "(", ")", "if", "lock",...
Return a exception raised by the call that the future represents. :param timeout: The number of seconds to wait for the exception if the future has not been completed. None, the default, sets no limit. :returns: The exception raised by the call that the future ...
[ "Return", "a", "exception", "raised", "by", "the", "call", "that", "the", "future", "represents", ".", ":", "param", "timeout", ":", "The", "number", "of", "seconds", "to", "wait", "for", "the", "exception", "if", "the", "future", "has", "not", "been", "...
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L117-L142
train
Return a exception raised by the future that the future has not completed.
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 = FutureRequest(FUTURE, self.__method, self.__params,", "# self.__channel, self.__target, self.__id)", "msg", "=", "{", "TYPE", ":", "FUTURE", ",", "ME...
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
Sends the work to the actor for it to start executing the work.
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
Sets the result of the work associated with the future.
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
Sets the result of the future as being the given exception.
pedrotgn/pyactor
pyactor/thread/future.py
FutureRef.result
def result(self, timeout=None): """Returns the result of the call that the future represents. :param timeout: The number of seconds to wait for the result if the future has not been completed. None, the default, sets no limit. :returns: The result of the call that the fu...
python
def result(self, timeout=None): """Returns the result of the call that the future represents. :param timeout: The number of seconds to wait for the result if the future has not been completed. None, the default, sets no limit. :returns: The result of the call that the fu...
[ "def", "result", "(", "self", ",", "timeout", "=", "None", ")", ":", "result", "=", "super", "(", "FutureRef", ",", "self", ")", ".", "result", "(", "timeout", ")", "return", "get_host", "(", ")", ".", "loads", "(", "result", ")" ]
Returns the result of the call that the future represents. :param timeout: The number of seconds to wait for the result if the future has not been completed. None, the default, sets no limit. :returns: The result of the call that the future represents. :raises: TimeoutEr...
[ "Returns", "the", "result", "of", "the", "call", "that", "the", "future", "represents", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/future.py#L195-L207
train
Returns the result of the call that the future represents.
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
Compute the angle between vectors x and y
pedrotgn/pyactor
pyactor/thread/intervals.py
later
def later(timeout, f, *args, **kwargs): ''' Sets a timer that will call the *f* function past *timeout* seconds. See example in :ref:`sample_inter` :return: :class:`Timer` ''' t = Timer(timeout, f, args, kwargs) t.start() return t
python
def later(timeout, f, *args, **kwargs): ''' Sets a timer that will call the *f* function past *timeout* seconds. See example in :ref:`sample_inter` :return: :class:`Timer` ''' t = Timer(timeout, f, args, kwargs) t.start() return t
[ "def", "later", "(", "timeout", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "t", "=", "Timer", "(", "timeout", ",", "f", ",", "args", ",", "kwargs", ")", "t", ".", "start", "(", ")", "return", "t" ]
Sets a timer that will call the *f* function past *timeout* seconds. See example in :ref:`sample_inter` :return: :class:`Timer`
[ "Sets", "a", "timer", "that", "will", "call", "the", "*", "f", "*", "function", "past", "*", "timeout", "*", "seconds", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/intervals.py#L15-L25
train
Sets a timer that will call the f function past timeout seconds.
pedrotgn/pyactor
pyactor/thread/intervals.py
interval_host
def interval_host(host, time, f, *args, **kwargs): ''' Creates an Event attached to the *host* that will execute the *f* function every *time* seconds. See example in :ref:`sample_inter` :param Proxy host: proxy of the host. Can be obtained from inside a class with ``self.host``. :para...
python
def interval_host(host, time, f, *args, **kwargs): ''' Creates an Event attached to the *host* that will execute the *f* function every *time* seconds. See example in :ref:`sample_inter` :param Proxy host: proxy of the host. Can be obtained from inside a class with ``self.host``. :para...
[ "def", "interval_host", "(", "host", ",", "time", ",", "f", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "def", "wrap", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "thread", "=", "currentThread", "(", ")", "args", "=", "list", ...
Creates an Event attached to the *host* that will execute the *f* function every *time* seconds. See example in :ref:`sample_inter` :param Proxy host: proxy of the host. Can be obtained from inside a class with ``self.host``. :param int time: seconds for the intervals. :param func f: funct...
[ "Creates", "an", "Event", "attached", "to", "the", "*", "host", "*", "that", "will", "execute", "the", "*", "f", "*", "function", "every", "*", "time", "*", "seconds", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/thread/intervals.py#L28-L60
train
A function that will execute the function f every time seconds.
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
Wait for an incoming connection from a forward forwarded port.
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
Execute a remote command and yield the result.
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
Method to read from file and create GSSHAPY Project File
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", ")", ":", "# Enforce cards that must be written in certain order", "PRIORITY_CARDS", "=", "(", "'WMS'", ",", "'MASK_WATERSHED'", ",", "'REPLACE_LINE'", ",", "'REPLACE_PARAMS'", ",", ...
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
Method to write to File Method to File Method
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
Append a directory to all the paths in the project file.
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
Reads all files for a GSSHA project into the database.
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
Reads all input files for a GSSHA project into the database.
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
Reads all output files for a GSSHA project file and writes them to the database.
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", ")", ":", "# Au...
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
Read a specific IO file for a GSSHA project to the database.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.readInputFile
def readInputFile(self, card_name, directory, session, spatial=False, spatialReferenceID=None, **kwargs): """ Read specific input file for a GSSHA project to the database. Args: card_name(str): Name of GSSHA project card. directory (str): Directory ...
python
def readInputFile(self, card_name, directory, session, spatial=False, spatialReferenceID=None, **kwargs): """ Read specific input file for a GSSHA project to the database. Args: card_name(str): Name of GSSHA project card. directory (str): Directory ...
[ "def", "readInputFile", "(", "self", ",", "card_name", ",", "directory", ",", "session", ",", "spatial", "=", "False", ",", "spatialReferenceID", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "project_directory", "=", "directory", "with", "t...
Read specific input file for a GSSHA project to the database. Args: card_name(str): Name of GSSHA project card. directory (str): Directory containing all GSSHA model files. This method assumes that all files are located in the same directory. session (:mod:`s...
[ "Read", "specific", "input", "file", "for", "a", "GSSHA", "project", "to", "the", "database", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L536-L561
train
Reads a specific input file for a GSSHA project card.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.readOutputFile
def readOutputFile(self, card_name, directory, session, spatial=False, spatialReferenceID=None, **kwargs): """ Read specific input file for a GSSHA project to the database. Args: card_name(str): Name of GSSHA project card. directory (str): Directory...
python
def readOutputFile(self, card_name, directory, session, spatial=False, spatialReferenceID=None, **kwargs): """ Read specific input file for a GSSHA project to the database. Args: card_name(str): Name of GSSHA project card. directory (str): Directory...
[ "def", "readOutputFile", "(", "self", ",", "card_name", ",", "directory", ",", "session", ",", "spatial", "=", "False", ",", "spatialReferenceID", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "project_directory", "=", "directory", "with", "...
Read specific input file for a GSSHA project to the database. Args: card_name(str): Name of GSSHA project card. directory (str): Directory containing all GSSHA model files. This method assumes that all files are located in the same directory. session (:mod:`s...
[ "Read", "specific", "input", "file", "for", "a", "GSSHA", "project", "to", "the", "database", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L563-L585
train
Reads a specific output file for a GSSHA project card.
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", ")", ":", "# Get the batch directory for output", "batchDirectory", "=", "self",...
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
Writes all files for a specific project to file.
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", ")", ":", "# Get param file for writing", "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
Writes the input files for a GSSHA project to file.
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", ")", ":", "# Get the batch directory for output", "batchDirectory", "=", "self", ...
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
Writes the output files for a GSSHA project to file.
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
Retrieves a list of file keys that have been read into the database.
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
Returns a dictionary of file objects that can be accessed by the getFileKeys method of the GsshaPy object.
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
Retrieves a project card object for given name. Returns None if the card is not available.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.setCard
def setCard(self, name, value, add_quotes=False): """ Adds/updates card for gssha project file Args: name (str): Name of card to be updated/added. value (str): Value to attach to the card. add_quotes (Optional[bool]): If True, will add quotes around string. D...
python
def setCard(self, name, value, add_quotes=False): """ Adds/updates card for gssha project file Args: name (str): Name of card to be updated/added. value (str): Value to attach to the card. add_quotes (Optional[bool]): If True, will add quotes around string. D...
[ "def", "setCard", "(", "self", ",", "name", ",", "value", ",", "add_quotes", "=", "False", ")", ":", "gssha_card", "=", "self", ".", "getCard", "(", "name", ")", "if", "add_quotes", ":", "value", "=", "'\"{0}\"'", ".", "format", "(", "value", ")", "i...
Adds/updates card for gssha project file Args: name (str): Name of card to be updated/added. value (str): Value to attach to the card. add_quotes (Optional[bool]): If True, will add quotes around string. Default is False.
[ "Adds", "/", "updates", "card", "for", "gssha", "project", "file" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L755-L774
train
Adds or updates a GSSHA project file card with the given name and value.
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
Removes a card from gssha project file
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.getModelSummaryAsKml
def getModelSummaryAsKml(self, session, path=None, documentName=None, withStreamNetwork=True, withNodes=False, styles={}): """ Retrieve a KML representation of the model. Includes polygonized mask map and vector stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): ...
python
def getModelSummaryAsKml(self, session, path=None, documentName=None, withStreamNetwork=True, withNodes=False, styles={}): """ Retrieve a KML representation of the model. Includes polygonized mask map and vector stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): ...
[ "def", "getModelSummaryAsKml", "(", "self", ",", "session", ",", "path", "=", "None", ",", "documentName", "=", "None", ",", "withStreamNetwork", "=", "True", ",", "withNodes", "=", "False", ",", "styles", "=", "{", "}", ")", ":", "# Get mask map", "waters...
Retrieve a KML representation of the model. Includes polygonized mask map and vector stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database path (str, optional): Path to file where KML file will be written. Defa...
[ "Retrieve", "a", "KML", "representation", "of", "the", "model", ".", "Includes", "polygonized", "mask", "map", "and", "vector", "stream", "network", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L786-L1007
train
Retrieve a KML representation of the model. Includes polygonized mask map vector stream network.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.getModelSummaryAsWkt
def getModelSummaryAsWkt(self, session, withStreamNetwork=True, withNodes=False): """ Retrieve a Well Known Text representation of the model. Includes polygonized mask map and vector stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bou...
python
def getModelSummaryAsWkt(self, session, withStreamNetwork=True, withNodes=False): """ Retrieve a Well Known Text representation of the model. Includes polygonized mask map and vector stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bou...
[ "def", "getModelSummaryAsWkt", "(", "self", ",", "session", ",", "withStreamNetwork", "=", "True", ",", "withNodes", "=", "False", ")", ":", "# Get mask map", "watershedMaskCard", "=", "self", ".", "getCard", "(", "'WATERSHED_MASK'", ")", "maskFilename", "=", "w...
Retrieve a Well Known Text representation of the model. Includes polygonized mask map and vector stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database withStreamNetwork (bool, optional): Include stream network....
[ "Retrieve", "a", "Well", "Known", "Text", "representation", "of", "the", "model", ".", "Includes", "polygonized", "mask", "map", "and", "vector", "stream", "network", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1009-L1066
train
Returns a Well Known Text representation of the model.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.getModelSummaryAsGeoJson
def getModelSummaryAsGeoJson(self, session, withStreamNetwork=True, withNodes=False): """ Retrieve a GeoJSON representation of the model. Includes vectorized mask map and stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGI...
python
def getModelSummaryAsGeoJson(self, session, withStreamNetwork=True, withNodes=False): """ Retrieve a GeoJSON representation of the model. Includes vectorized mask map and stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGI...
[ "def", "getModelSummaryAsGeoJson", "(", "self", ",", "session", ",", "withStreamNetwork", "=", "True", ",", "withNodes", "=", "False", ")", ":", "# Get mask map", "watershedMaskCard", "=", "self", ".", "getCard", "(", "'WATERSHED_MASK'", ")", "maskFilename", "=", ...
Retrieve a GeoJSON representation of the model. Includes vectorized mask map and stream network. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database withStreamNetwork (bool, optional): Include stream network. Defaults to Tru...
[ "Retrieve", "a", "GeoJSON", "representation", "of", "the", "model", ".", "Includes", "vectorized", "mask", "map", "and", "stream", "network", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1068-L1134
train
Returns a GeoJSON representation of the model.
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
Returns GDALGrid object of GSSHA project card.
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
Returns GDALGrid object of GSSHA model bounds
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
Returns GDALGrid object of index map with given name
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
Returns GSSHA projection WKT string
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, OUTCOL", "outrow", "=", "int", "(", "self", ".", "getCard", "(", "name", "=", "'OUTROW'", ")", ".", "value", ")", "-", "1", "outcol", "=", "int", "(", "self", ".", "getCard", "(", "name", "=", "...
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
Gets the outlet latitude and longitude of the grid cell center.
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", ")", ":", "#OUTROW, OUTCOL, OUTSLOPE", "gssha_grid", "=", "self", ".", "getGrid", "(", ")", "# col, row = gssha_grid.lonlat2pixel(longitude, latitude)", "# add 1 to row & col becasue ...
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
Sets the outlet grid cell information in the project file.
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", ")", ":", "# 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", ")", "shapefile", "=", ...
Calculate outlet location
[ "Calculate", "outlet", "location" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1249-L1319
train
Find outlet location for a given shapefile.
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
Calculates the slope at the OUTLET ArcGIS entry.
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", ":", "# GET CENTROID FROM GSSHA GRID", "cen_lat", ",", "cen_lon", "=", "self", ".", "centerLatLon", "(", ")", "# update time zone", "tf", "=", "TimezoneFinder", "(", ")", "tz_n...
timezone of GSSHA model
[ "timezone", "of", "GSSHA", "model" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1362-L1374
train
Returns the timezone of the GSSHA model object.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile.centerLatLon
def centerLatLon(self): """ Get the center lat/lon of model """ # GET CENTROID FROM GSSHA GRID gssha_grid = self.getGrid() min_x, max_x, min_y, max_y = gssha_grid.bounds() x_ext, y_ext = transform(gssha_grid.proj, Proj(init='epsg:...
python
def centerLatLon(self): """ Get the center lat/lon of model """ # GET CENTROID FROM GSSHA GRID gssha_grid = self.getGrid() min_x, max_x, min_y, max_y = gssha_grid.bounds() x_ext, y_ext = transform(gssha_grid.proj, Proj(init='epsg:...
[ "def", "centerLatLon", "(", "self", ")", ":", "# GET CENTROID FROM GSSHA GRID", "gssha_grid", "=", "self", ".", "getGrid", "(", ")", "min_x", ",", "max_x", ",", "min_y", ",", "max_y", "=", "gssha_grid", ".", "bounds", "(", ")", "x_ext", ",", "y_ext", "=", ...
Get the center lat/lon of model
[ "Get", "the", "center", "lat", "/", "lon", "of", "model" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1376-L1389
train
Get the center lat lon of the model
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile._automaticallyDeriveSpatialReferenceId
def _automaticallyDeriveSpatialReferenceId(self, directory): """ This method is used to automatically lookup the spatial reference ID of the GSSHA project. This method is a wrapper for the ProjectionFile class method lookupSpatialReferenceID(). It requires an internet connection (the loo...
python
def _automaticallyDeriveSpatialReferenceId(self, directory): """ This method is used to automatically lookup the spatial reference ID of the GSSHA project. This method is a wrapper for the ProjectionFile class method lookupSpatialReferenceID(). It requires an internet connection (the loo...
[ "def", "_automaticallyDeriveSpatialReferenceId", "(", "self", ",", "directory", ")", ":", "# Only do automatic look up if spatial reference is not specified by the user", "DEFAULT_SPATIAL_REFERENCE_ID", "=", "4236", "# Lookup the projection card in the project file", "projectionCard", "=...
This method is used to automatically lookup the spatial reference ID of the GSSHA project. This method is a wrapper for the ProjectionFile class method lookupSpatialReferenceID(). It requires an internet connection (the lookup uses a web service) and the projection file to be present and the appropriate...
[ "This", "method", "is", "used", "to", "automatically", "lookup", "the", "spatial", "reference", "ID", "of", "the", "GSSHA", "project", ".", "This", "method", "is", "a", "wrapper", "for", "the", "ProjectionFile", "class", "method", "lookupSpatialReferenceID", "()...
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1391-L1424
train
This method is used to automatically lookup the spatial reference ID of the GSSHA project. It will automatically lookup the spatial reference ID of the GSSHA project.
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", ")", ":", "# Set output directory to main directory as default", "batchDirectory", "=", "projectRootDirectory", "# Get the replace folder card", "replaceFolderCard", "=", "self", ".", "getCard", "(", "'REPLA...
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
Get the batch directory path for the current project file.
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", ")", ":", "## NOTE: This function is dependent on the project file being re...
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
Read files from File Method
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", ":", "# Get...
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
Method to handle special case of WMS Dataset Files.
CI-WATER/gsshapy
gsshapy/orm/prj.py
ProjectFile._readReplacementFiles
def _readReplacementFiles(self, directory, session, spatial, spatialReferenceID): """ Check for the parameter replacement file cards (REPLACE_PARAMS and REPLACE_VALS) and read the files into database if they exist. Returns: replaceParamFile or None if it doesn't exis...
python
def _readReplacementFiles(self, directory, session, spatial, spatialReferenceID): """ Check for the parameter replacement file cards (REPLACE_PARAMS and REPLACE_VALS) and read the files into database if they exist. Returns: replaceParamFile or None if it doesn't exis...
[ "def", "_readReplacementFiles", "(", "self", ",", "directory", ",", "session", ",", "spatial", ",", "spatialReferenceID", ")", ":", "# Set default", "replaceParamFile", "=", "None", "# Check for REPLACE_PARAMS card", "replaceParamCard", "=", "self", ".", "getCard", "(...
Check for the parameter replacement file cards (REPLACE_PARAMS and REPLACE_VALS) and read the files into database if they exist. Returns: replaceParamFile or None if it doesn't exist
[ "Check", "for", "the", "parameter", "replacement", "file", "cards", "(", "REPLACE_PARAMS", "and", "REPLACE_VALS", ")", "and", "read", "the", "files", "into", "database", "if", "they", "exist", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/prj.py#L1535-L1575
train
Reads the parameter replacement files into the database if they exist.
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", ")", ":", "# Get contents of directory", ...
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
Read the output of a file in a batch mode.
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
Invoke File Read Method on Other Files
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
Method to write a file to a GSSHA Project
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
Method to write the xput maps to file
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
Method to write WMS Datasets to File Method to GSSHAPY Project Write WMS Datasets to File Method to GSSHAPY Project
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
Write the replacement files in the specified directory.
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", ")", ":", "# Default value for instance", "instance", "=", "None", "try", ":", "# Handle case where fileIO interfaces with single file", "# Ret...
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
Invoke File Write Method on Other Files