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
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder.save_image
def save_image(self, outname): """ Save the image data. This is probably only useful if the image data has been blanked. Parameters ---------- outname : str Name for the output file. """ hdu = self.global_data.img.hdu hdu.data = self.g...
python
def save_image(self, outname): """ Save the image data. This is probably only useful if the image data has been blanked. Parameters ---------- outname : str Name for the output file. """ hdu = self.global_data.img.hdu hdu.data = self.g...
[ "def", "save_image", "(", "self", ",", "outname", ")", ":", "hdu", "=", "self", ".", "global_data", ".", "img", ".", "hdu", "hdu", ".", "data", "=", "self", ".", "global_data", ".", "img", ".", "_pixels", "hdu", ".", "header", "[", "\"ORIGIN\"", "]",...
Save the image data. This is probably only useful if the image data has been blanked. Parameters ---------- outname : str Name for the output file.
[ "Save", "the", "image", "data", ".", "This", "is", "probably", "only", "useful", "if", "the", "image", "data", "has", "been", "blanked", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L824-L843
train
Save the image data to a file.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder._make_bkg_rms
def _make_bkg_rms(self, mesh_size=20, forced_rms=None, forced_bkg=None, cores=None): """ Calculate an rms image and a bkg image. Parameters ---------- mesh_size : int Number of beams per box default = 20 forced_rms : float The rms of the image. ...
python
def _make_bkg_rms(self, mesh_size=20, forced_rms=None, forced_bkg=None, cores=None): """ Calculate an rms image and a bkg image. Parameters ---------- mesh_size : int Number of beams per box default = 20 forced_rms : float The rms of the image. ...
[ "def", "_make_bkg_rms", "(", "self", ",", "mesh_size", "=", "20", ",", "forced_rms", "=", "None", ",", "forced_bkg", "=", "None", ",", "cores", "=", "None", ")", ":", "if", "(", "forced_rms", "is", "not", "None", ")", ":", "self", ".", "log", ".", ...
Calculate an rms image and a bkg image. Parameters ---------- mesh_size : int Number of beams per box default = 20 forced_rms : float The rms of the image. If None: calculate the rms level (default). Otherwise assume a constant rms. ...
[ "Calculate", "an", "rms", "image", "and", "a", "bkg", "image", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L845-L956
train
This function calculates an rms image and a bkg image.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder._estimate_bkg_rms
def _estimate_bkg_rms(self, xmin, xmax, ymin, ymax): """ Estimate the background noise mean and RMS. The mean is estimated as the median of data. The RMS is estimated as the IQR of data / 1.34896. Parameters ---------- xmin, xmax, ymin, ymax : int The...
python
def _estimate_bkg_rms(self, xmin, xmax, ymin, ymax): """ Estimate the background noise mean and RMS. The mean is estimated as the median of data. The RMS is estimated as the IQR of data / 1.34896. Parameters ---------- xmin, xmax, ymin, ymax : int The...
[ "def", "_estimate_bkg_rms", "(", "self", ",", "xmin", ",", "xmax", ",", "ymin", ",", "ymax", ")", ":", "data", "=", "self", ".", "global_data", ".", "data_pix", "[", "ymin", ":", "ymax", ",", "xmin", ":", "xmax", "]", "pixels", "=", "np", ".", "ext...
Estimate the background noise mean and RMS. The mean is estimated as the median of data. The RMS is estimated as the IQR of data / 1.34896. Parameters ---------- xmin, xmax, ymin, ymax : int The bounding region over which the bkg/rms will be calculated. Retu...
[ "Estimate", "the", "background", "noise", "mean", "and", "RMS", ".", "The", "mean", "is", "estimated", "as", "the", "median", "of", "data", ".", "The", "RMS", "is", "estimated", "as", "the", "IQR", "of", "data", "/", "1", ".", "34896", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L958-L990
train
Estimate the background noise mean and RMS.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder._load_aux_image
def _load_aux_image(self, image, auxfile): """ Load a fits file (bkg/rms/curve) and make sure that it is the same shape as the main image. Parameters ---------- image : :class:`AegeanTools.fits_image.FitsImage` The main image that has already been loaded. ...
python
def _load_aux_image(self, image, auxfile): """ Load a fits file (bkg/rms/curve) and make sure that it is the same shape as the main image. Parameters ---------- image : :class:`AegeanTools.fits_image.FitsImage` The main image that has already been loaded. ...
[ "def", "_load_aux_image", "(", "self", ",", "image", ",", "auxfile", ")", ":", "auximg", "=", "FitsImage", "(", "auxfile", ",", "beam", "=", "self", ".", "global_data", ".", "beam", ")", ".", "get_pixels", "(", ")", "if", "auximg", ".", "shape", "!=", ...
Load a fits file (bkg/rms/curve) and make sure that it is the same shape as the main image. Parameters ---------- image : :class:`AegeanTools.fits_image.FitsImage` The main image that has already been loaded. auxfile : str or HDUList The auxiliary file t...
[ "Load", "a", "fits", "file", "(", "bkg", "/", "rms", "/", "curve", ")", "and", "make", "sure", "that", "it", "is", "the", "same", "shape", "as", "the", "main", "image", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L992-L1015
train
Load a main image and auxiliary file and make sure that it is the same shape as the main image.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder._refit_islands
def _refit_islands(self, group, stage, outerclip=None, istart=0): """ Do island refitting (priorized fitting) on a group of islands. Parameters ---------- group : list A list of components grouped by island. stage : int Refitting stage. ...
python
def _refit_islands(self, group, stage, outerclip=None, istart=0): """ Do island refitting (priorized fitting) on a group of islands. Parameters ---------- group : list A list of components grouped by island. stage : int Refitting stage. ...
[ "def", "_refit_islands", "(", "self", ",", "group", ",", "stage", ",", "outerclip", "=", "None", ",", "istart", "=", "0", ")", ":", "global_data", "=", "self", ".", "global_data", "sources", "=", "[", "]", "data", "=", "global_data", ".", "data_pix", "...
Do island refitting (priorized fitting) on a group of islands. Parameters ---------- group : list A list of components grouped by island. stage : int Refitting stage. outerclip : float Ignored, placed holder for future development. ...
[ "Do", "island", "refitting", "(", "priorized", "fitting", ")", "on", "a", "group", "of", "islands", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1020-L1268
train
Refit islands on a group of components.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder._fit_island
def _fit_island(self, island_data): """ Take an Island, do all the parameter estimation and fitting. Parameters ---------- island_data : :class:`AegeanTools.models.IslandFittingData` The island to be fit. Returns ------- sources : list ...
python
def _fit_island(self, island_data): """ Take an Island, do all the parameter estimation and fitting. Parameters ---------- island_data : :class:`AegeanTools.models.IslandFittingData` The island to be fit. Returns ------- sources : list ...
[ "def", "_fit_island", "(", "self", ",", "island_data", ")", ":", "global_data", "=", "self", ".", "global_data", "# global data", "dcurve", "=", "global_data", ".", "dcurve", "rmsimg", "=", "global_data", ".", "rmsimg", "# island data", "isle_num", "=", "island_...
Take an Island, do all the parameter estimation and fitting. Parameters ---------- island_data : :class:`AegeanTools.models.IslandFittingData` The island to be fit. Returns ------- sources : list The sources that were fit.
[ "Take", "an", "Island", "do", "all", "the", "parameter", "estimation", "and", "fitting", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1270-L1370
train
This function is called by the island fit method. It is called by the island fit method.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder._fit_islands
def _fit_islands(self, islands): """ Execute fitting on a list of islands This function just wraps around fit_island, so that when we do multiprocesing a single process will fit multiple islands before returning results. Parameters ---------- islands : list of :...
python
def _fit_islands(self, islands): """ Execute fitting on a list of islands This function just wraps around fit_island, so that when we do multiprocesing a single process will fit multiple islands before returning results. Parameters ---------- islands : list of :...
[ "def", "_fit_islands", "(", "self", ",", "islands", ")", ":", "self", ".", "log", ".", "debug", "(", "\"Fitting group of {0} islands\"", ".", "format", "(", "len", "(", "islands", ")", ")", ")", "sources", "=", "[", "]", "for", "island", "in", "islands",...
Execute fitting on a list of islands This function just wraps around fit_island, so that when we do multiprocesing a single process will fit multiple islands before returning results. Parameters ---------- islands : list of :class:`AegeanTools.models.IslandFittingData` ...
[ "Execute", "fitting", "on", "a", "list", "of", "islands", "This", "function", "just", "wraps", "around", "fit_island", "so", "that", "when", "we", "do", "multiprocesing", "a", "single", "process", "will", "fit", "multiple", "islands", "before", "returning", "r...
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1372-L1394
train
Execute fitting on a list of islands and return a list of sources.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder.find_sources_in_image
def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5, outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False, nopositive=False, nonegative=False, mask=None, lat=None, img...
python
def find_sources_in_image(self, filename, hdu_index=0, outfile=None, rms=None, bkg=None, max_summits=None, innerclip=5, outerclip=4, cores=None, rmsin=None, bkgin=None, beam=None, doislandflux=False, nopositive=False, nonegative=False, mask=None, lat=None, img...
[ "def", "find_sources_in_image", "(", "self", ",", "filename", ",", "hdu_index", "=", "0", ",", "outfile", "=", "None", ",", "rms", "=", "None", ",", "bkg", "=", "None", ",", "max_summits", "=", "None", ",", "innerclip", "=", "5", ",", "outerclip", "=",...
Run the Aegean source finder. Parameters ---------- filename : str or HDUList Image filename or HDUList. hdu_index : int The index of the FITS HDU (extension). outfile : str file for printing catalog (NOT a table, just a text file of my own...
[ "Run", "the", "Aegean", "source", "finder", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1396-L1540
train
This function will find sources in an image.
PaulHancock/Aegean
AegeanTools/source_finder.py
SourceFinder.priorized_fit_islands
def priorized_fit_islands(self, filename, catalogue, hdu_index=0, outfile=None, bkgin=None, rmsin=None, cores=1, rms=None, bkg=None, beam=None, lat=None, imgpsf=None, catpsf=None, stage=3, ratio=None, outerclip=3, doregroup=True, docov=True, cube_index=None): ...
python
def priorized_fit_islands(self, filename, catalogue, hdu_index=0, outfile=None, bkgin=None, rmsin=None, cores=1, rms=None, bkg=None, beam=None, lat=None, imgpsf=None, catpsf=None, stage=3, ratio=None, outerclip=3, doregroup=True, docov=True, cube_index=None): ...
[ "def", "priorized_fit_islands", "(", "self", ",", "filename", ",", "catalogue", ",", "hdu_index", "=", "0", ",", "outfile", "=", "None", ",", "bkgin", "=", "None", ",", "rmsin", "=", "None", ",", "cores", "=", "1", ",", "rms", "=", "None", ",", "bkg"...
Take an input catalog, and image, and optional background/noise images fit the flux and ra/dec for each of the given sources, keeping the morphology fixed if doregroup is true the groups will be recreated based on a matching radius/probability. if doregroup is false then the islands of the inpu...
[ "Take", "an", "input", "catalog", "and", "image", "and", "optional", "background", "/", "noise", "images", "fit", "the", "flux", "and", "ra", "/", "dec", "for", "each", "of", "the", "given", "sources", "keeping", "the", "morphology", "fixed" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/source_finder.py#L1542-L1782
train
This function will fit the islands of the input catalogue and image and returns the corresponding output file name.
PaulHancock/Aegean
AegeanTools/catalogs.py
check_table_formats
def check_table_formats(files): """ Determine whether a list of files are of a recognizable output type. Parameters ---------- files : str A list of file names Returns ------- result : bool True if *all* the file names are supported """ cont = True formats =...
python
def check_table_formats(files): """ Determine whether a list of files are of a recognizable output type. Parameters ---------- files : str A list of file names Returns ------- result : bool True if *all* the file names are supported """ cont = True formats =...
[ "def", "check_table_formats", "(", "files", ")", ":", "cont", "=", "True", "formats", "=", "get_table_formats", "(", ")", "for", "t", "in", "files", ".", "split", "(", "','", ")", ":", "_", ",", "ext", "=", "os", ".", "path", ".", "splitext", "(", ...
Determine whether a list of files are of a recognizable output type. Parameters ---------- files : str A list of file names Returns ------- result : bool True if *all* the file names are supported
[ "Determine", "whether", "a", "list", "of", "files", "are", "of", "a", "recognizable", "output", "type", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L45-L69
train
Checks if a list of files are of a recognizable output type.
PaulHancock/Aegean
AegeanTools/catalogs.py
show_formats
def show_formats(): """ Print a list of all the file formats that are supported for writing. The file formats are determined by their extensions. Returns ------- None """ fmts = { "ann": "Kvis annotation", "reg": "DS9 regions file", "fits": "FITS Binary Table", ...
python
def show_formats(): """ Print a list of all the file formats that are supported for writing. The file formats are determined by their extensions. Returns ------- None """ fmts = { "ann": "Kvis annotation", "reg": "DS9 regions file", "fits": "FITS Binary Table", ...
[ "def", "show_formats", "(", ")", ":", "fmts", "=", "{", "\"ann\"", ":", "\"Kvis annotation\"", ",", "\"reg\"", ":", "\"DS9 regions file\"", ",", "\"fits\"", ":", "\"FITS Binary Table\"", ",", "\"csv\"", ":", "\"Comma separated values\"", ",", "\"tab\"", ":", "\"ta...
Print a list of all the file formats that are supported for writing. The file formats are determined by their extensions. Returns ------- None
[ "Print", "a", "list", "of", "all", "the", "file", "formats", "that", "are", "supported", "for", "writing", ".", "The", "file", "formats", "are", "determined", "by", "their", "extensions", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L72-L97
train
Prints a list of all the file formats that are supported for writing.
PaulHancock/Aegean
AegeanTools/catalogs.py
update_meta_data
def update_meta_data(meta=None): """ Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary. """ if meta is None...
python
def update_meta_data(meta=None): """ Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary. """ if meta is None...
[ "def", "update_meta_data", "(", "meta", "=", "None", ")", ":", "if", "meta", "is", "None", ":", "meta", "=", "{", "}", "if", "'DATE'", "not", "in", "meta", ":", "meta", "[", "'DATE'", "]", "=", "strftime", "(", "\"%Y-%m-%d %H:%M:%S\"", ",", "gmtime", ...
Modify the metadata dictionary. DATE, PROGRAM, and PROGVER are added/modified. Parameters ---------- meta : dict The dictionary to be modified, default = None (empty) Returns ------- An updated dictionary.
[ "Modify", "the", "metadata", "dictionary", ".", "DATE", "PROGRAM", "and", "PROGVER", "are", "added", "/", "modified", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L121-L142
train
Modify the metadata dictionary.
PaulHancock/Aegean
AegeanTools/catalogs.py
save_catalog
def save_catalog(filename, catalog, meta=None, prefix=None): """ Save a catalogue of sources using filename as a model. Meta data can be written to some file types (fits, votable). Each type of source will be in a separate file: - base_comp.ext :class:`AegeanTools.models.OutputSource` - base_i...
python
def save_catalog(filename, catalog, meta=None, prefix=None): """ Save a catalogue of sources using filename as a model. Meta data can be written to some file types (fits, votable). Each type of source will be in a separate file: - base_comp.ext :class:`AegeanTools.models.OutputSource` - base_i...
[ "def", "save_catalog", "(", "filename", ",", "catalog", ",", "meta", "=", "None", ",", "prefix", "=", "None", ")", ":", "ascii_table_formats", "=", "{", "'csv'", ":", "'csv'", ",", "'tab'", ":", "'tab'", ",", "'tex'", ":", "'latex'", ",", "'html'", ":"...
Save a catalogue of sources using filename as a model. Meta data can be written to some file types (fits, votable). Each type of source will be in a separate file: - base_comp.ext :class:`AegeanTools.models.OutputSource` - base_isle.ext :class:`AegeanTools.models.IslandSource` - base_simp.ext :cla...
[ "Save", "a", "catalogue", "of", "sources", "using", "filename", "as", "a", "model", ".", "Meta", "data", "can", "be", "written", "to", "some", "file", "types", "(", "fits", "votable", ")", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L145-L194
train
Save a catalogue of sources using filename as a model.
PaulHancock/Aegean
AegeanTools/catalogs.py
load_catalog
def load_catalog(filename): """ Load a catalogue and extract the source positions (only) Parameters ---------- filename : str Filename to read. Supported types are csv, tab, tex, vo, vot, and xml. Returns ------- catalogue : list A list of [ (ra, dec), ...] """ ...
python
def load_catalog(filename): """ Load a catalogue and extract the source positions (only) Parameters ---------- filename : str Filename to read. Supported types are csv, tab, tex, vo, vot, and xml. Returns ------- catalogue : list A list of [ (ra, dec), ...] """ ...
[ "def", "load_catalog", "(", "filename", ")", ":", "supported", "=", "get_table_formats", "(", ")", "fmt", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "-", "1", "]", "[", "1", ":", "]", ".", "lower", "(", ")", "# extension sans...
Load a catalogue and extract the source positions (only) Parameters ---------- filename : str Filename to read. Supported types are csv, tab, tex, vo, vot, and xml. Returns ------- catalogue : list A list of [ (ra, dec), ...]
[ "Load", "a", "catalogue", "and", "extract", "the", "source", "positions", "(", "only", ")" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L197-L236
train
Load a catalogue and extract the source positions
PaulHancock/Aegean
AegeanTools/catalogs.py
load_table
def load_table(filename): """ Load a table from a given file. Supports csv, tab, tex, vo, vot, xml, fits, and hdf5. Parameters ---------- filename : str File to read Returns ------- table : Table Table of data. """ supported = get_table_formats() fmt =...
python
def load_table(filename): """ Load a table from a given file. Supports csv, tab, tex, vo, vot, xml, fits, and hdf5. Parameters ---------- filename : str File to read Returns ------- table : Table Table of data. """ supported = get_table_formats() fmt =...
[ "def", "load_table", "(", "filename", ")", ":", "supported", "=", "get_table_formats", "(", ")", "fmt", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "-", "1", "]", "[", "1", ":", "]", ".", "lower", "(", ")", "# extension sans '...
Load a table from a given file. Supports csv, tab, tex, vo, vot, xml, fits, and hdf5. Parameters ---------- filename : str File to read Returns ------- table : Table Table of data.
[ "Load", "a", "table", "from", "a", "given", "file", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L239-L269
train
Load a table from a given file.
PaulHancock/Aegean
AegeanTools/catalogs.py
write_table
def write_table(table, filename): """ Write a table to a file. Parameters ---------- table : Table Table to be written filename : str Destination for saving table. Returns ------- None """ try: if os.path.exists(filename): os.remove(file...
python
def write_table(table, filename): """ Write a table to a file. Parameters ---------- table : Table Table to be written filename : str Destination for saving table. Returns ------- None """ try: if os.path.exists(filename): os.remove(file...
[ "def", "write_table", "(", "table", ",", "filename", ")", ":", "try", ":", "if", "os", ".", "path", ".", "exists", "(", "filename", ")", ":", "os", ".", "remove", "(", "filename", ")", "table", ".", "write", "(", "filename", ")", "log", ".", "info"...
Write a table to a file. Parameters ---------- table : Table Table to be written filename : str Destination for saving table. Returns ------- None
[ "Write", "a", "table", "to", "a", "file", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L272-L299
train
Writes a table to a file.
PaulHancock/Aegean
AegeanTools/catalogs.py
table_to_source_list
def table_to_source_list(table, src_type=OutputSource): """ Convert a table of data into a list of sources. A single table must have consistent source types given by src_type. src_type should be one of :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`Ae...
python
def table_to_source_list(table, src_type=OutputSource): """ Convert a table of data into a list of sources. A single table must have consistent source types given by src_type. src_type should be one of :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`Ae...
[ "def", "table_to_source_list", "(", "table", ",", "src_type", "=", "OutputSource", ")", ":", "source_list", "=", "[", "]", "if", "table", "is", "None", ":", "return", "source_list", "for", "row", "in", "table", ":", "# Initialise our object", "src", "=", "sr...
Convert a table of data into a list of sources. A single table must have consistent source types given by src_type. src_type should be one of :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSource`. Parameters ---------- ...
[ "Convert", "a", "table", "of", "data", "into", "a", "list", "of", "sources", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L302-L343
train
Convert a table of data into a list of sources.
PaulHancock/Aegean
AegeanTools/catalogs.py
write_catalog
def write_catalog(filename, catalog, fmt=None, meta=None, prefix=None): """ Write a catalog (list of sources) to a file with format determined by extension. Sources must be of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSo...
python
def write_catalog(filename, catalog, fmt=None, meta=None, prefix=None): """ Write a catalog (list of sources) to a file with format determined by extension. Sources must be of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSo...
[ "def", "write_catalog", "(", "filename", ",", "catalog", ",", "fmt", "=", "None", ",", "meta", "=", "None", ",", "prefix", "=", "None", ")", ":", "if", "meta", "is", "None", ":", "meta", "=", "{", "}", "if", "prefix", "is", "None", ":", "pre", "=...
Write a catalog (list of sources) to a file with format determined by extension. Sources must be of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.IslandSource`. Parameters ---------- filename : str Base name for file ...
[ "Write", "a", "catalog", "(", "list", "of", "sources", ")", "to", "a", "file", "with", "format", "determined", "by", "extension", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L346-L440
train
Writes a list of sources to a file with format determined by extension.
PaulHancock/Aegean
AegeanTools/catalogs.py
writeFITSTable
def writeFITSTable(filename, table): """ Convert a table into a FITSTable and then write to disk. Parameters ---------- filename : str Filename to write. table : Table Table to write. Returns ------- None Notes ----- Due to a bug in numpy, `int32` and ...
python
def writeFITSTable(filename, table): """ Convert a table into a FITSTable and then write to disk. Parameters ---------- filename : str Filename to write. table : Table Table to write. Returns ------- None Notes ----- Due to a bug in numpy, `int32` and ...
[ "def", "writeFITSTable", "(", "filename", ",", "table", ")", ":", "def", "FITSTableType", "(", "val", ")", ":", "\"\"\"\n Return the FITSTable type corresponding to each named parameter in obj\n \"\"\"", "if", "isinstance", "(", "val", ",", "bool", ")", ":",...
Convert a table into a FITSTable and then write to disk. Parameters ---------- filename : str Filename to write. table : Table Table to write. Returns ------- None Notes ----- Due to a bug in numpy, `int32` and `float32` are converted to `int64` and `float64` ...
[ "Convert", "a", "table", "into", "a", "FITSTable", "and", "then", "write", "to", "disk", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L443-L488
train
Convert a table into a FITSTable and then write to disk.
PaulHancock/Aegean
AegeanTools/catalogs.py
writeIslandContours
def writeIslandContours(filename, catalog, fmt='reg'): """ Write an output file in ds9 .reg format that outlines the boundaries of each island. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models....
python
def writeIslandContours(filename, catalog, fmt='reg'): """ Write an output file in ds9 .reg format that outlines the boundaries of each island. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models....
[ "def", "writeIslandContours", "(", "filename", ",", "catalog", ",", "fmt", "=", "'reg'", ")", ":", "if", "fmt", "!=", "'reg'", ":", "log", ".", "warning", "(", "\"Format {0} not yet supported\"", ".", "format", "(", "fmt", ")", ")", "log", ".", "warning", ...
Write an output file in ds9 .reg format that outlines the boundaries of each island. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models.IslandSource` will have contours drawn. fmt : str Outp...
[ "Write", "an", "output", "file", "in", "ds9", ".", "reg", "format", "that", "outlines", "the", "boundaries", "of", "each", "island", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L491-L544
train
Writes an output file in ds9. reg format that outlines the boundaries of each island.
PaulHancock/Aegean
AegeanTools/catalogs.py
writeIslandBoxes
def writeIslandBoxes(filename, catalog, fmt): """ Write an output file in ds9 .reg, or kvis .ann format that contains bounding boxes for all the islands. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanToo...
python
def writeIslandBoxes(filename, catalog, fmt): """ Write an output file in ds9 .reg, or kvis .ann format that contains bounding boxes for all the islands. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanToo...
[ "def", "writeIslandBoxes", "(", "filename", ",", "catalog", ",", "fmt", ")", ":", "if", "fmt", "not", "in", "[", "'reg'", ",", "'ann'", "]", ":", "log", ".", "warning", "(", "\"Format not supported for island boxes{0}\"", ".", "format", "(", "fmt", ")", ")...
Write an output file in ds9 .reg, or kvis .ann format that contains bounding boxes for all the islands. Parameters ---------- filename : str Filename to write. catalog : list List of sources. Only those of type :class:`AegeanTools.models.IslandSource` will have contours drawn. fmt...
[ "Write", "an", "output", "file", "in", "ds9", ".", "reg", "or", "kvis", ".", "ann", "format", "that", "contains", "bounding", "boxes", "for", "all", "the", "islands", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L547-L596
train
Writes an output file in ds9. reg or kvis. ann format that contains bounding boxes for all the islands.
PaulHancock/Aegean
AegeanTools/catalogs.py
writeAnn
def writeAnn(filename, catalog, fmt): """ Write an annotation file that can be read by Kvis (.ann) or DS9 (.reg). Uses ra/dec from catalog. Draws ellipses if bmaj/bmin/pa are in catalog. Draws 30" circles otherwise. Only :class:`AegeanTools.models.OutputSource` will appear in the annotation file ...
python
def writeAnn(filename, catalog, fmt): """ Write an annotation file that can be read by Kvis (.ann) or DS9 (.reg). Uses ra/dec from catalog. Draws ellipses if bmaj/bmin/pa are in catalog. Draws 30" circles otherwise. Only :class:`AegeanTools.models.OutputSource` will appear in the annotation file ...
[ "def", "writeAnn", "(", "filename", ",", "catalog", ",", "fmt", ")", ":", "if", "fmt", "not", "in", "[", "'reg'", ",", "'ann'", "]", ":", "log", ".", "warning", "(", "\"Format not supported for island boxes{0}\"", ".", "format", "(", "fmt", ")", ")", "re...
Write an annotation file that can be read by Kvis (.ann) or DS9 (.reg). Uses ra/dec from catalog. Draws ellipses if bmaj/bmin/pa are in catalog. Draws 30" circles otherwise. Only :class:`AegeanTools.models.OutputSource` will appear in the annotation file unless there are none, in which case :class:`Aeg...
[ "Write", "an", "annotation", "file", "that", "can", "be", "read", "by", "Kvis", "(", ".", "ann", ")", "or", "DS9", "(", ".", "reg", ")", ".", "Uses", "ra", "/", "dec", "from", "catalog", ".", "Draws", "ellipses", "if", "bmaj", "/", "bmin", "/", "...
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L599-L692
train
Writes an annotation file that can be read by Kvis or DS9.
PaulHancock/Aegean
AegeanTools/catalogs.py
writeDB
def writeDB(filename, catalog, meta=None): """ Output an sqlite3 database containing one table for each source type Parameters ---------- filename : str Output filename catalog : list List of sources of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools....
python
def writeDB(filename, catalog, meta=None): """ Output an sqlite3 database containing one table for each source type Parameters ---------- filename : str Output filename catalog : list List of sources of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools....
[ "def", "writeDB", "(", "filename", ",", "catalog", ",", "meta", "=", "None", ")", ":", "def", "sqlTypes", "(", "obj", ",", "names", ")", ":", "\"\"\"\n Return the sql type corresponding to each named parameter in obj\n \"\"\"", "types", "=", "[", "]", ...
Output an sqlite3 database containing one table for each source type Parameters ---------- filename : str Output filename catalog : list List of sources of type :class:`AegeanTools.models.OutputSource`, :class:`AegeanTools.models.SimpleSource`, or :class:`AegeanTools.models.Isl...
[ "Output", "an", "sqlite3", "database", "containing", "one", "table", "for", "each", "source", "type" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/catalogs.py#L714-L782
train
Writes a sqlite3 database containing one table for each source type and each source type in the catalog.
PaulHancock/Aegean
AegeanTools/cluster.py
norm_dist
def norm_dist(src1, src2): """ Calculate the normalised distance between two sources. Sources are elliptical Gaussians. The normalised distance is calculated as the GCD distance between the centers, divided by quadrature sum of the radius of each ellipse along a line joining the two ellipses. ...
python
def norm_dist(src1, src2): """ Calculate the normalised distance between two sources. Sources are elliptical Gaussians. The normalised distance is calculated as the GCD distance between the centers, divided by quadrature sum of the radius of each ellipse along a line joining the two ellipses. ...
[ "def", "norm_dist", "(", "src1", ",", "src2", ")", ":", "if", "np", ".", "all", "(", "src1", "==", "src2", ")", ":", "return", "0", "dist", "=", "gcd", "(", "src1", ".", "ra", ",", "src1", ".", "dec", ",", "src2", ".", "ra", ",", "src2", ".",...
Calculate the normalised distance between two sources. Sources are elliptical Gaussians. The normalised distance is calculated as the GCD distance between the centers, divided by quadrature sum of the radius of each ellipse along a line joining the two ellipses. For ellipses that touch at a single poi...
[ "Calculate", "the", "normalised", "distance", "between", "two", "sources", ".", "Sources", "are", "elliptical", "Gaussians", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L27-L60
train
Calculates the normalised distance between two sources.
PaulHancock/Aegean
AegeanTools/cluster.py
sky_dist
def sky_dist(src1, src2): """ Great circle distance between two sources. A check is made to determine if the two sources are the same object, in this case the distance is zero. Parameters ---------- src1, src2 : object Two sources to check. Objects must have parameters (ra,dec) in d...
python
def sky_dist(src1, src2): """ Great circle distance between two sources. A check is made to determine if the two sources are the same object, in this case the distance is zero. Parameters ---------- src1, src2 : object Two sources to check. Objects must have parameters (ra,dec) in d...
[ "def", "sky_dist", "(", "src1", ",", "src2", ")", ":", "if", "np", ".", "all", "(", "src1", "==", "src2", ")", ":", "return", "0", "return", "gcd", "(", "src1", ".", "ra", ",", "src1", ".", "dec", ",", "src2", ".", "ra", ",", "src2", ".", "de...
Great circle distance between two sources. A check is made to determine if the two sources are the same object, in this case the distance is zero. Parameters ---------- src1, src2 : object Two sources to check. Objects must have parameters (ra,dec) in degrees. Returns ------- d...
[ "Great", "circle", "distance", "between", "two", "sources", ".", "A", "check", "is", "made", "to", "determine", "if", "the", "two", "sources", "are", "the", "same", "object", "in", "this", "case", "the", "distance", "is", "zero", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L63-L86
train
Returns the approximate circle distance between two sources.
PaulHancock/Aegean
AegeanTools/cluster.py
pairwise_ellpitical_binary
def pairwise_ellpitical_binary(sources, eps, far=None): """ Do a pairwise comparison of all sources and determine if they have a normalized distance within eps. Form this into a matrix of shape NxN. Parameters ---------- sources : list A list of sources (objects with parameters: r...
python
def pairwise_ellpitical_binary(sources, eps, far=None): """ Do a pairwise comparison of all sources and determine if they have a normalized distance within eps. Form this into a matrix of shape NxN. Parameters ---------- sources : list A list of sources (objects with parameters: r...
[ "def", "pairwise_ellpitical_binary", "(", "sources", ",", "eps", ",", "far", "=", "None", ")", ":", "if", "far", "is", "None", ":", "far", "=", "max", "(", "a", ".", "a", "/", "3600", "for", "a", "in", "sources", ")", "l", "=", "len", "(", "sourc...
Do a pairwise comparison of all sources and determine if they have a normalized distance within eps. Form this into a matrix of shape NxN. Parameters ---------- sources : list A list of sources (objects with parameters: ra,dec,a,b,pa) eps : float Normalised distance constrain...
[ "Do", "a", "pairwise", "comparison", "of", "all", "sources", "and", "determine", "if", "they", "have", "a", "normalized", "distance", "within", "eps", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L89-L135
train
Do a pairwise comparison of all sources and determine if they have a normalized distance within eps.
PaulHancock/Aegean
AegeanTools/cluster.py
regroup_vectorized
def regroup_vectorized(srccat, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Sho...
python
def regroup_vectorized(srccat, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Sho...
[ "def", "regroup_vectorized", "(", "srccat", ",", "eps", ",", "far", "=", "None", ",", "dist", "=", "norm_dist", ")", ":", "if", "far", "is", "None", ":", "far", "=", "0.5", "# 10*max(a.a/3600 for a in srccat)", "# most negative declination first", "# XXX: kind='me...
Regroup the islands of a catalog according to their normalised distance. Assumes srccat is recarray-like for efficiency. Return a list of island groups. Parameters ---------- srccat : np.rec.arry or pd.DataFrame Should have the following fields[units]: ra[deg],dec[deg], a[arcsec],b...
[ "Regroup", "the", "islands", "of", "a", "catalog", "according", "to", "their", "normalised", "distance", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L138-L206
train
Return a list of islands that are vectorized within a catalog.
PaulHancock/Aegean
AegeanTools/cluster.py
regroup
def regroup(catalog, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Return a list of island groups. Sources have their (island,source) parameters relabeled. Parameters ---------- catalog : str or object Either a filename to ...
python
def regroup(catalog, eps, far=None, dist=norm_dist): """ Regroup the islands of a catalog according to their normalised distance. Return a list of island groups. Sources have their (island,source) parameters relabeled. Parameters ---------- catalog : str or object Either a filename to ...
[ "def", "regroup", "(", "catalog", ",", "eps", ",", "far", "=", "None", ",", "dist", "=", "norm_dist", ")", ":", "if", "isinstance", "(", "catalog", ",", "str", ")", ":", "table", "=", "load_table", "(", "catalog", ")", "srccat", "=", "table_to_source_l...
Regroup the islands of a catalog according to their normalised distance. Return a list of island groups. Sources have their (island,source) parameters relabeled. Parameters ---------- catalog : str or object Either a filename to read into a source list, or a list of objects with the following ...
[ "Regroup", "the", "islands", "of", "a", "catalog", "according", "to", "their", "normalised", "distance", ".", "Return", "a", "list", "of", "island", "groups", ".", "Sources", "have", "their", "(", "island", "source", ")", "parameters", "relabeled", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/cluster.py#L209-L278
train
Regroups the islands of a catalog according to their normalised distance.
PaulHancock/Aegean
AegeanTools/fits_interp.py
load_file_or_hdu
def load_file_or_hdu(filename): """ Load a file from disk and return an HDUList If filename is already an HDUList return that instead Parameters ---------- filename : str or HDUList File or HDU to be loaded Returns ------- hdulist : HDUList """ if isinstance(filenam...
python
def load_file_or_hdu(filename): """ Load a file from disk and return an HDUList If filename is already an HDUList return that instead Parameters ---------- filename : str or HDUList File or HDU to be loaded Returns ------- hdulist : HDUList """ if isinstance(filenam...
[ "def", "load_file_or_hdu", "(", "filename", ")", ":", "if", "isinstance", "(", "filename", ",", "fits", ".", "HDUList", ")", ":", "hdulist", "=", "filename", "else", ":", "hdulist", "=", "fits", ".", "open", "(", "filename", ",", "ignore_missing_end", "=",...
Load a file from disk and return an HDUList If filename is already an HDUList return that instead Parameters ---------- filename : str or HDUList File or HDU to be loaded Returns ------- hdulist : HDUList
[ "Load", "a", "file", "from", "disk", "and", "return", "an", "HDUList", "If", "filename", "is", "already", "an", "HDUList", "return", "that", "instead" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_interp.py#L16-L34
train
Load a file from disk and return an HDUList if it is already an HDUList
PaulHancock/Aegean
AegeanTools/fits_interp.py
compress
def compress(datafile, factor, outfile=None): """ Compress a file using decimation. Parameters ---------- datafile : str or HDUList Input data to be loaded. (HDUList will be modified if passed). factor : int Decimation factor. outfile : str File to be written. Defa...
python
def compress(datafile, factor, outfile=None): """ Compress a file using decimation. Parameters ---------- datafile : str or HDUList Input data to be loaded. (HDUList will be modified if passed). factor : int Decimation factor. outfile : str File to be written. Defa...
[ "def", "compress", "(", "datafile", ",", "factor", ",", "outfile", "=", "None", ")", ":", "if", "not", "(", "factor", ">", "0", "and", "isinstance", "(", "factor", ",", "int", ")", ")", ":", "logging", ".", "error", "(", "\"factor must be a positive inte...
Compress a file using decimation. Parameters ---------- datafile : str or HDUList Input data to be loaded. (HDUList will be modified if passed). factor : int Decimation factor. outfile : str File to be written. Default = None, which means don't write a file. Returns ...
[ "Compress", "a", "file", "using", "decimation", "." ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_interp.py#L37-L121
train
Compress a file using decimation factor.
PaulHancock/Aegean
AegeanTools/fits_interp.py
expand
def expand(datafile, outfile=None): """ Expand and interpolate the given data file using the given method. Datafile can be a filename or an HDUList It is assumed that the file has been compressed and that there are `BN_?` keywords in the fits header that describe how the compression was done. ...
python
def expand(datafile, outfile=None): """ Expand and interpolate the given data file using the given method. Datafile can be a filename or an HDUList It is assumed that the file has been compressed and that there are `BN_?` keywords in the fits header that describe how the compression was done. ...
[ "def", "expand", "(", "datafile", ",", "outfile", "=", "None", ")", ":", "hdulist", "=", "load_file_or_hdu", "(", "datafile", ")", "header", "=", "hdulist", "[", "0", "]", ".", "header", "data", "=", "hdulist", "[", "0", "]", ".", "data", "# Check for ...
Expand and interpolate the given data file using the given method. Datafile can be a filename or an HDUList It is assumed that the file has been compressed and that there are `BN_?` keywords in the fits header that describe how the compression was done. Parameters ---------- datafile : str or ...
[ "Expand", "and", "interpolate", "the", "given", "data", "file", "using", "the", "given", "method", ".", "Datafile", "can", "be", "a", "filename", "or", "an", "HDUList" ]
185d2b4a51b48441a1df747efc9a5271c79399fd
https://github.com/PaulHancock/Aegean/blob/185d2b4a51b48441a1df747efc9a5271c79399fd/AegeanTools/fits_interp.py#L124-L198
train
Expand and interpolate the given data file using the given method.
bgschiller/postgres_kernel
postgres_kernel/kernel.py
PostgresKernel.change_autocommit_mode
def change_autocommit_mode(self, switch): """ Strip and make a string case insensitive and ensure it is either 'true' or 'false'. If neither, prompt user for either value. When 'true', return True, and when 'false' return False. """ parsed_switch = switch.strip().lower()...
python
def change_autocommit_mode(self, switch): """ Strip and make a string case insensitive and ensure it is either 'true' or 'false'. If neither, prompt user for either value. When 'true', return True, and when 'false' return False. """ parsed_switch = switch.strip().lower()...
[ "def", "change_autocommit_mode", "(", "self", ",", "switch", ")", ":", "parsed_switch", "=", "switch", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "not", "parsed_switch", "in", "[", "'true'", ",", "'false'", "]", ":", "self", ".", "send_respons...
Strip and make a string case insensitive and ensure it is either 'true' or 'false'. If neither, prompt user for either value. When 'true', return True, and when 'false' return False.
[ "Strip", "and", "make", "a", "string", "case", "insensitive", "and", "ensure", "it", "is", "either", "true", "or", "false", "." ]
523c4f3b7057ca165d7c0407fd8cc865c793be30
https://github.com/bgschiller/postgres_kernel/blob/523c4f3b7057ca165d7c0407fd8cc865c793be30/postgres_kernel/kernel.py#L125-L153
train
Change autocommit mode of the current database entry.
dcwatson/django-pgcrypto
pgcrypto/base.py
armor
def armor(data, versioned=True): """ Returns a string in ASCII Armor format, for the given binary data. The output of this is compatiple with pgcrypto's armor/dearmor functions. """ template = '-----BEGIN PGP MESSAGE-----\n%(headers)s%(body)s\n=%(crc)s\n-----END PGP MESSAGE-----' body = base64.b...
python
def armor(data, versioned=True): """ Returns a string in ASCII Armor format, for the given binary data. The output of this is compatiple with pgcrypto's armor/dearmor functions. """ template = '-----BEGIN PGP MESSAGE-----\n%(headers)s%(body)s\n=%(crc)s\n-----END PGP MESSAGE-----' body = base64.b...
[ "def", "armor", "(", "data", ",", "versioned", "=", "True", ")", ":", "template", "=", "'-----BEGIN PGP MESSAGE-----\\n%(headers)s%(body)s\\n=%(crc)s\\n-----END PGP MESSAGE-----'", "body", "=", "base64", ".", "b64encode", "(", "data", ")", "# The 24-bit CRC should be in big...
Returns a string in ASCII Armor format, for the given binary data. The output of this is compatiple with pgcrypto's armor/dearmor functions.
[ "Returns", "a", "string", "in", "ASCII", "Armor", "format", "for", "the", "given", "binary", "data", ".", "The", "output", "of", "this", "is", "compatiple", "with", "pgcrypto", "s", "armor", "/", "dearmor", "functions", "." ]
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L33-L46
train
Returns an ASCII Armor format for the given binary data.
dcwatson/django-pgcrypto
pgcrypto/base.py
dearmor
def dearmor(text, verify=True): """ Given a string in ASCII Armor format, returns the decoded binary data. If verify=True (the default), the CRC is decoded and checked against that of the decoded data, otherwise it is ignored. If the checksum does not match, a BadChecksumError exception is raised. ...
python
def dearmor(text, verify=True): """ Given a string in ASCII Armor format, returns the decoded binary data. If verify=True (the default), the CRC is decoded and checked against that of the decoded data, otherwise it is ignored. If the checksum does not match, a BadChecksumError exception is raised. ...
[ "def", "dearmor", "(", "text", ",", "verify", "=", "True", ")", ":", "lines", "=", "text", ".", "strip", "(", ")", ".", "split", "(", "'\\n'", ")", "data_lines", "=", "[", "]", "check_data", "=", "None", "started", "=", "False", "in_body", "=", "Fa...
Given a string in ASCII Armor format, returns the decoded binary data. If verify=True (the default), the CRC is decoded and checked against that of the decoded data, otherwise it is ignored. If the checksum does not match, a BadChecksumError exception is raised.
[ "Given", "a", "string", "in", "ASCII", "Armor", "format", "returns", "the", "decoded", "binary", "data", ".", "If", "verify", "=", "True", "(", "the", "default", ")", "the", "CRC", "is", "decoded", "and", "checked", "against", "that", "of", "the", "decod...
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L49-L90
train
Given a string in ASCII Armor format returns the decoded binary data.
dcwatson/django-pgcrypto
pgcrypto/base.py
unpad
def unpad(text, block_size): """ Takes the last character of the text, and if it is less than the block_size, assumes the text is padded, and removes any trailing zeros or bytes with the value of the pad character. See http://www.di-mgt.com.au/cryptopad.html for more information (methods 1, 3, and 4...
python
def unpad(text, block_size): """ Takes the last character of the text, and if it is less than the block_size, assumes the text is padded, and removes any trailing zeros or bytes with the value of the pad character. See http://www.di-mgt.com.au/cryptopad.html for more information (methods 1, 3, and 4...
[ "def", "unpad", "(", "text", ",", "block_size", ")", ":", "end", "=", "len", "(", "text", ")", "if", "end", "==", "0", ":", "return", "text", "padch", "=", "ord_safe", "(", "text", "[", "end", "-", "1", "]", ")", "if", "padch", ">", "block_size",...
Takes the last character of the text, and if it is less than the block_size, assumes the text is padded, and removes any trailing zeros or bytes with the value of the pad character. See http://www.di-mgt.com.au/cryptopad.html for more information (methods 1, 3, and 4).
[ "Takes", "the", "last", "character", "of", "the", "text", "and", "if", "it", "is", "less", "than", "the", "block_size", "assumes", "the", "text", "is", "padded", "and", "removes", "any", "trailing", "zeros", "or", "bytes", "with", "the", "value", "of", "...
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L93-L109
train
Unpads the given text into a block of size block_size.
dcwatson/django-pgcrypto
pgcrypto/base.py
pad
def pad(text, block_size, zero=False): """ Given a text string and a block size, pads the text with bytes of the same value as the number of padding bytes. This is the recommended method, and the one used by pgcrypto. See http://www.di-mgt.com.au/cryptopad.html for more information. """ num = bl...
python
def pad(text, block_size, zero=False): """ Given a text string and a block size, pads the text with bytes of the same value as the number of padding bytes. This is the recommended method, and the one used by pgcrypto. See http://www.di-mgt.com.au/cryptopad.html for more information. """ num = bl...
[ "def", "pad", "(", "text", ",", "block_size", ",", "zero", "=", "False", ")", ":", "num", "=", "block_size", "-", "(", "len", "(", "text", ")", "%", "block_size", ")", "ch", "=", "b'\\0'", "if", "zero", "else", "chr", "(", "num", ")", ".", "encod...
Given a text string and a block size, pads the text with bytes of the same value as the number of padding bytes. This is the recommended method, and the one used by pgcrypto. See http://www.di-mgt.com.au/cryptopad.html for more information.
[ "Given", "a", "text", "string", "and", "a", "block", "size", "pads", "the", "text", "with", "bytes", "of", "the", "same", "value", "as", "the", "number", "of", "padding", "bytes", ".", "This", "is", "the", "recommended", "method", "and", "the", "one", ...
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L112-L120
train
Given a text string and a block size pads the text with zeros to the specified block size.
dcwatson/django-pgcrypto
pgcrypto/base.py
aes_pad_key
def aes_pad_key(key): """ AES keys must be either 16, 24, or 32 bytes long. If a key is provided that is not one of these lengths, pad it with zeroes (this is what pgcrypto does). """ if len(key) in (16, 24, 32): return key if len(key) < 16: return pad(key, 16, zero=True) eli...
python
def aes_pad_key(key): """ AES keys must be either 16, 24, or 32 bytes long. If a key is provided that is not one of these lengths, pad it with zeroes (this is what pgcrypto does). """ if len(key) in (16, 24, 32): return key if len(key) < 16: return pad(key, 16, zero=True) eli...
[ "def", "aes_pad_key", "(", "key", ")", ":", "if", "len", "(", "key", ")", "in", "(", "16", ",", "24", ",", "32", ")", ":", "return", "key", "if", "len", "(", "key", ")", "<", "16", ":", "return", "pad", "(", "key", ",", "16", ",", "zero", "...
AES keys must be either 16, 24, or 32 bytes long. If a key is provided that is not one of these lengths, pad it with zeroes (this is what pgcrypto does).
[ "AES", "keys", "must", "be", "either", "16", "24", "or", "32", "bytes", "long", ".", "If", "a", "key", "is", "provided", "that", "is", "not", "one", "of", "these", "lengths", "pad", "it", "with", "zeroes", "(", "this", "is", "what", "pgcrypto", "does...
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/base.py#L123-L135
train
This function pads a key to 32 bytes long
dcwatson/django-pgcrypto
pgcrypto/fields.py
BaseEncryptedField.deconstruct
def deconstruct(self): """ Deconstruct the field for Django 1.7+ migrations. """ name, path, args, kwargs = super(BaseEncryptedField, self).deconstruct() kwargs.update({ #'key': self.cipher_key, 'cipher': self.cipher_name, 'charset': self.chars...
python
def deconstruct(self): """ Deconstruct the field for Django 1.7+ migrations. """ name, path, args, kwargs = super(BaseEncryptedField, self).deconstruct() kwargs.update({ #'key': self.cipher_key, 'cipher': self.cipher_name, 'charset': self.chars...
[ "def", "deconstruct", "(", "self", ")", ":", "name", ",", "path", ",", "args", ",", "kwargs", "=", "super", "(", "BaseEncryptedField", ",", "self", ")", ".", "deconstruct", "(", ")", "kwargs", ".", "update", "(", "{", "#'key': self.cipher_key,", "'cipher'"...
Deconstruct the field for Django 1.7+ migrations.
[ "Deconstruct", "the", "field", "for", "Django", "1", ".", "7", "+", "migrations", "." ]
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/fields.py#L47-L59
train
Deconstruct the field for Django 1. 7 + migrations.
dcwatson/django-pgcrypto
pgcrypto/fields.py
BaseEncryptedField.get_cipher
def get_cipher(self): """ Return a new Cipher object for each time we want to encrypt/decrypt. This is because pgcrypto expects a zeroed block for IV (initial value), but the IV on the cipher object is cumulatively updated each time encrypt/decrypt is called. """ return s...
python
def get_cipher(self): """ Return a new Cipher object for each time we want to encrypt/decrypt. This is because pgcrypto expects a zeroed block for IV (initial value), but the IV on the cipher object is cumulatively updated each time encrypt/decrypt is called. """ return s...
[ "def", "get_cipher", "(", "self", ")", ":", "return", "self", ".", "cipher_class", ".", "new", "(", "self", ".", "cipher_key", ",", "self", ".", "cipher_class", ".", "MODE_CBC", ",", "b'\\0'", "*", "self", ".", "cipher_class", ".", "block_size", ")" ]
Return a new Cipher object for each time we want to encrypt/decrypt. This is because pgcrypto expects a zeroed block for IV (initial value), but the IV on the cipher object is cumulatively updated each time encrypt/decrypt is called.
[ "Return", "a", "new", "Cipher", "object", "for", "each", "time", "we", "want", "to", "encrypt", "/", "decrypt", ".", "This", "is", "because", "pgcrypto", "expects", "a", "zeroed", "block", "for", "IV", "(", "initial", "value", ")", "but", "the", "IV", ...
02108795ec97f80af92ff6800a1c55eb958c3496
https://github.com/dcwatson/django-pgcrypto/blob/02108795ec97f80af92ff6800a1c55eb958c3496/pgcrypto/fields.py#L61-L67
train
Returns a new Cipher object for each time we want to encrypt or decrypt.
click-contrib/click-configfile
setup.py
find_packages_by_root_package
def find_packages_by_root_package(where): """Better than excluding everything that is not needed, collect only what is needed. """ root_package = os.path.basename(where) packages = [ "%s.%s" % (root_package, sub_package) for sub_package in find_packages(where)] packages.insert(0...
python
def find_packages_by_root_package(where): """Better than excluding everything that is not needed, collect only what is needed. """ root_package = os.path.basename(where) packages = [ "%s.%s" % (root_package, sub_package) for sub_package in find_packages(where)] packages.insert(0...
[ "def", "find_packages_by_root_package", "(", "where", ")", ":", "root_package", "=", "os", ".", "path", ".", "basename", "(", "where", ")", "packages", "=", "[", "\"%s.%s\"", "%", "(", "root_package", ",", "sub_package", ")", "for", "sub_package", "in", "fin...
Better than excluding everything that is not needed, collect only what is needed.
[ "Better", "than", "excluding", "everything", "that", "is", "not", "needed", "collect", "only", "what", "is", "needed", "." ]
a616204cb9944125fd5051556f27a7ccef611e22
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/setup.py#L25-L33
train
Better than excluding everything that is not needed collect only what is needed.
click-contrib/click-configfile
setup.py
make_long_description
def make_long_description(marker=None, intro=None): """ click_ is a framework to simplify writing composable commands for command-line tools. This package extends the click_ functionality by adding support for commands that use configuration files. .. _click: https://click.pocoo.org/ EXAMPLE: ...
python
def make_long_description(marker=None, intro=None): """ click_ is a framework to simplify writing composable commands for command-line tools. This package extends the click_ functionality by adding support for commands that use configuration files. .. _click: https://click.pocoo.org/ EXAMPLE: ...
[ "def", "make_long_description", "(", "marker", "=", "None", ",", "intro", "=", "None", ")", ":", "if", "intro", "is", "None", ":", "intro", "=", "inspect", ".", "getdoc", "(", "make_long_description", ")", "with", "open", "(", "\"README.rst\"", ",", "\"r\"...
click_ is a framework to simplify writing composable commands for command-line tools. This package extends the click_ functionality by adding support for commands that use configuration files. .. _click: https://click.pocoo.org/ EXAMPLE: A configuration file, like: .. code-block:: INI ...
[ "click_", "is", "a", "framework", "to", "simplify", "writing", "composable", "commands", "for", "command", "-", "line", "tools", ".", "This", "package", "extends", "the", "click_", "functionality", "by", "adding", "support", "for", "commands", "that", "use", "...
a616204cb9944125fd5051556f27a7ccef611e22
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/setup.py#L35-L83
train
This function returns a long description of the current user s Alice and Bob.
thefab/tornadis
tornadis/pubsub.py
PubSubClient.pubsub_pop_message
def pubsub_pop_message(self, deadline=None): """Pops a message for a subscribed client. Args: deadline (int): max number of seconds to wait (None => no timeout) Returns: Future with the popped message as result (or None if timeout or ConnectionError obje...
python
def pubsub_pop_message(self, deadline=None): """Pops a message for a subscribed client. Args: deadline (int): max number of seconds to wait (None => no timeout) Returns: Future with the popped message as result (or None if timeout or ConnectionError obje...
[ "def", "pubsub_pop_message", "(", "self", ",", "deadline", "=", "None", ")", ":", "if", "not", "self", ".", "subscribed", ":", "excep", "=", "ClientError", "(", "\"you must subscribe before using \"", "\"pubsub_pop_message\"", ")", "raise", "tornado", ".", "gen", ...
Pops a message for a subscribed client. Args: deadline (int): max number of seconds to wait (None => no timeout) Returns: Future with the popped message as result (or None if timeout or ConnectionError object in case of connection errors or Clien...
[ "Pops", "a", "message", "for", "a", "subscribed", "client", "." ]
f9dc883e46eb5971b62eab38346319757e5f900f
https://github.com/thefab/tornadis/blob/f9dc883e46eb5971b62eab38346319757e5f900f/tornadis/pubsub.py#L140-L170
train
Pops a message for a subscribed client.
creare-com/pydem
pydem/dem_processing.py
_get_flat_ids
def _get_flat_ids(assigned): """ This is a helper function to recover the coordinates of regions that have been labeled within an image. This function efficiently computes the coordinate of all regions and returns the information in a memory-efficient manner. Parameters ----------- assi...
python
def _get_flat_ids(assigned): """ This is a helper function to recover the coordinates of regions that have been labeled within an image. This function efficiently computes the coordinate of all regions and returns the information in a memory-efficient manner. Parameters ----------- assi...
[ "def", "_get_flat_ids", "(", "assigned", ")", ":", "# MPU optimization:", "# Let's segment the regions and store in a sparse format", "# First, let's use where once to find all the information we want", "ids_labels", "=", "np", ".", "arange", "(", "len", "(", "assigned", ".", "...
This is a helper function to recover the coordinates of regions that have been labeled within an image. This function efficiently computes the coordinate of all regions and returns the information in a memory-efficient manner. Parameters ----------- assigned : ndarray[ndim=2, dtype=int] ...
[ "This", "is", "a", "helper", "function", "to", "recover", "the", "coordinates", "of", "regions", "that", "have", "been", "labeled", "within", "an", "image", ".", "This", "function", "efficiently", "computes", "the", "coordinate", "of", "all", "regions", "and",...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2364-L2404
train
This function is used to get the coordinates of all regions that have been labeled within an image and store the information in a memory - efficient manner.
creare-com/pydem
pydem/dem_processing.py
_tarboton_slopes_directions
def _tarboton_slopes_directions(data, dX, dY, facets, ang_adj): """ Calculate the slopes and directions based on the 8 sections from Tarboton http://www.neng.usu.edu/cee/faculty/dtarb/96wr03137.pdf """ shp = np.array(data.shape) - 1 direction = np.full(data.shape, FLAT_ID_INT, 'float64') m...
python
def _tarboton_slopes_directions(data, dX, dY, facets, ang_adj): """ Calculate the slopes and directions based on the 8 sections from Tarboton http://www.neng.usu.edu/cee/faculty/dtarb/96wr03137.pdf """ shp = np.array(data.shape) - 1 direction = np.full(data.shape, FLAT_ID_INT, 'float64') m...
[ "def", "_tarboton_slopes_directions", "(", "data", ",", "dX", ",", "dY", ",", "facets", ",", "ang_adj", ")", ":", "shp", "=", "np", ".", "array", "(", "data", ".", "shape", ")", "-", "1", "direction", "=", "np", ".", "full", "(", "data", ".", "shap...
Calculate the slopes and directions based on the 8 sections from Tarboton http://www.neng.usu.edu/cee/faculty/dtarb/96wr03137.pdf
[ "Calculate", "the", "slopes", "and", "directions", "based", "on", "the", "8", "sections", "from", "Tarboton", "http", ":", "//", "www", ".", "neng", ".", "usu", ".", "edu", "/", "cee", "/", "faculty", "/", "dtarb", "/", "96wr03137", ".", "pdf" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2406-L2554
train
Calculate the slopes and directions based on Tarboton s algorithm.
creare-com/pydem
pydem/dem_processing.py
_get_d1_d2
def _get_d1_d2(dX, dY, ind, e1, e2, shp, topbot=None): """ This finds the distances along the patch (within the eight neighboring pixels around a central pixel) given the difference in x and y coordinates of the real image. This is the function that allows real coordinates to be used when calculatin...
python
def _get_d1_d2(dX, dY, ind, e1, e2, shp, topbot=None): """ This finds the distances along the patch (within the eight neighboring pixels around a central pixel) given the difference in x and y coordinates of the real image. This is the function that allows real coordinates to be used when calculatin...
[ "def", "_get_d1_d2", "(", "dX", ",", "dY", ",", "ind", ",", "e1", ",", "e2", ",", "shp", ",", "topbot", "=", "None", ")", ":", "if", "topbot", "==", "None", ":", "if", "ind", "in", "[", "0", ",", "3", ",", "4", ",", "7", "]", ":", "d1", "...
This finds the distances along the patch (within the eight neighboring pixels around a central pixel) given the difference in x and y coordinates of the real image. This is the function that allows real coordinates to be used when calculating the magnitude and directions of slopes.
[ "This", "finds", "the", "distances", "along", "the", "patch", "(", "within", "the", "eight", "neighboring", "pixels", "around", "a", "central", "pixel", ")", "given", "the", "difference", "in", "x", "and", "y", "coordinates", "of", "the", "real", "image", ...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2556-L2589
train
This function finds the distances along the patch and returns the two arrays d1 and d2.
creare-com/pydem
pydem/dem_processing.py
_calc_direction
def _calc_direction(data, mag, direction, ang, d1, d2, theta, slc0, slc1, slc2): """ This function gives the magnitude and direction of the slope based on Tarboton's D_\infty method. This is a helper-function to _tarboton_slopes_directions """ data0 = data[slc0] data...
python
def _calc_direction(data, mag, direction, ang, d1, d2, theta, slc0, slc1, slc2): """ This function gives the magnitude and direction of the slope based on Tarboton's D_\infty method. This is a helper-function to _tarboton_slopes_directions """ data0 = data[slc0] data...
[ "def", "_calc_direction", "(", "data", ",", "mag", ",", "direction", ",", "ang", ",", "d1", ",", "d2", ",", "theta", ",", "slc0", ",", "slc1", ",", "slc2", ")", ":", "data0", "=", "data", "[", "slc0", "]", "data1", "=", "data", "[", "slc1", "]", ...
This function gives the magnitude and direction of the slope based on Tarboton's D_\infty method. This is a helper-function to _tarboton_slopes_directions
[ "This", "function", "gives", "the", "magnitude", "and", "direction", "of", "the", "slope", "based", "on", "Tarboton", "s", "D_", "\\", "infty", "method", ".", "This", "is", "a", "helper", "-", "function", "to", "_tarboton_slopes_directions" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2593-L2638
train
This function calculates the magnitude and direction of the current Tarboton object based on Tarboton s D_\infty method.
creare-com/pydem
pydem/dem_processing.py
TileEdge.get
def get(self, key, side): """ Returns an edge given a particular key Parmeters ---------- key : tuple (te, be, le, re) tuple that identifies a tile side : str top, bottom, left, or right, which edge to return """ return getattr(self...
python
def get(self, key, side): """ Returns an edge given a particular key Parmeters ---------- key : tuple (te, be, le, re) tuple that identifies a tile side : str top, bottom, left, or right, which edge to return """ return getattr(self...
[ "def", "get", "(", "self", ",", "key", ",", "side", ")", ":", "return", "getattr", "(", "self", ",", "side", ")", ".", "ravel", "(", ")", "[", "self", ".", "keys", "[", "key", "]", "]" ]
Returns an edge given a particular key Parmeters ---------- key : tuple (te, be, le, re) tuple that identifies a tile side : str top, bottom, left, or right, which edge to return
[ "Returns", "an", "edge", "given", "a", "particular", "key", "Parmeters", "----------", "key", ":", "tuple", "(", "te", "be", "le", "re", ")", "tuple", "that", "identifies", "a", "tile", "side", ":", "str", "top", "bottom", "left", "or", "right", "which",...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L234-L244
train
Returns an edge given a particular key
creare-com/pydem
pydem/dem_processing.py
TileEdge.set_i
def set_i(self, i, data, field, side): """ Assigns data on the i'th tile to the data 'field' of the 'side' edge of that tile """ edge = self.get_i(i, side) setattr(edge, field, data[edge.slice])
python
def set_i(self, i, data, field, side): """ Assigns data on the i'th tile to the data 'field' of the 'side' edge of that tile """ edge = self.get_i(i, side) setattr(edge, field, data[edge.slice])
[ "def", "set_i", "(", "self", ",", "i", ",", "data", ",", "field", ",", "side", ")", ":", "edge", "=", "self", ".", "get_i", "(", "i", ",", "side", ")", "setattr", "(", "edge", ",", "field", ",", "data", "[", "edge", ".", "slice", "]", ")" ]
Assigns data on the i'th tile to the data 'field' of the 'side' edge of that tile
[ "Assigns", "data", "on", "the", "i", "th", "tile", "to", "the", "data", "field", "of", "the", "side", "edge", "of", "that", "tile" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L265-L270
train
Assign data on the ith tile to the field of that tile.
creare-com/pydem
pydem/dem_processing.py
TileEdge.set_sides
def set_sides(self, key, data, field, local=False): """ Assign data on the 'key' tile to all the edges """ for side in ['left', 'right', 'top', 'bottom']: self.set(key, data, field, side, local)
python
def set_sides(self, key, data, field, local=False): """ Assign data on the 'key' tile to all the edges """ for side in ['left', 'right', 'top', 'bottom']: self.set(key, data, field, side, local)
[ "def", "set_sides", "(", "self", ",", "key", ",", "data", ",", "field", ",", "local", "=", "False", ")", ":", "for", "side", "in", "[", "'left'", ",", "'right'", ",", "'top'", ",", "'bottom'", "]", ":", "self", ".", "set", "(", "key", ",", "data"...
Assign data on the 'key' tile to all the edges
[ "Assign", "data", "on", "the", "key", "tile", "to", "all", "the", "edges" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L272-L277
train
Assign data on the key tile to all the edges that are on the key tile.
creare-com/pydem
pydem/dem_processing.py
TileEdge.set_neighbor_data
def set_neighbor_data(self, neighbor_side, data, key, field): """ Assign data from the 'key' tile to the edge on the neighboring tile which is on the 'neighbor_side' of the 'key' tile. The data is assigned to the 'field' attribute of the neihboring tile's edge. """ ...
python
def set_neighbor_data(self, neighbor_side, data, key, field): """ Assign data from the 'key' tile to the edge on the neighboring tile which is on the 'neighbor_side' of the 'key' tile. The data is assigned to the 'field' attribute of the neihboring tile's edge. """ ...
[ "def", "set_neighbor_data", "(", "self", ",", "neighbor_side", ",", "data", ",", "key", ",", "field", ")", ":", "i", "=", "self", ".", "keys", "[", "key", "]", "found", "=", "False", "sides", "=", "[", "]", "if", "'left'", "in", "neighbor_side", ":",...
Assign data from the 'key' tile to the edge on the neighboring tile which is on the 'neighbor_side' of the 'key' tile. The data is assigned to the 'field' attribute of the neihboring tile's edge.
[ "Assign", "data", "from", "the", "key", "tile", "to", "the", "edge", "on", "the", "neighboring", "tile", "which", "is", "on", "the", "neighbor_side", "of", "the", "key", "tile", ".", "The", "data", "is", "assigned", "to", "the", "field", "attribute", "of...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L279-L316
train
Assign data to the edge on the neihboring tile which is on the neighbor_side of the key tile.
creare-com/pydem
pydem/dem_processing.py
TileEdge.set_all_neighbors_data
def set_all_neighbors_data(self, data, done, key): """ Given they 'key' tile's data, assigns this information to all neighboring tiles """ # The order of this for loop is important because the topleft gets # it's data from the left neighbor, which should have already bee...
python
def set_all_neighbors_data(self, data, done, key): """ Given they 'key' tile's data, assigns this information to all neighboring tiles """ # The order of this for loop is important because the topleft gets # it's data from the left neighbor, which should have already bee...
[ "def", "set_all_neighbors_data", "(", "self", ",", "data", ",", "done", ",", "key", ")", ":", "# The order of this for loop is important because the topleft gets", "# it's data from the left neighbor, which should have already been", "# updated...", "for", "side", "in", "[", "'...
Given they 'key' tile's data, assigns this information to all neighboring tiles
[ "Given", "they", "key", "tile", "s", "data", "assigns", "this", "information", "to", "all", "neighboring", "tiles" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L318-L330
train
Assign this data to all the neighbors of the key tile s data.
creare-com/pydem
pydem/dem_processing.py
TileEdge.fill_n_todo
def fill_n_todo(self): """ Calculate and record the number of edge pixels left to do on each tile """ left = self.left right = self.right top = self.top bottom = self.bottom for i in xrange(self.n_chunks): self.n_todo.ravel()[i] = np.sum([left....
python
def fill_n_todo(self): """ Calculate and record the number of edge pixels left to do on each tile """ left = self.left right = self.right top = self.top bottom = self.bottom for i in xrange(self.n_chunks): self.n_todo.ravel()[i] = np.sum([left....
[ "def", "fill_n_todo", "(", "self", ")", ":", "left", "=", "self", ".", "left", "right", "=", "self", ".", "right", "top", "=", "self", ".", "top", "bottom", "=", "self", ".", "bottom", "for", "i", "in", "xrange", "(", "self", ".", "n_chunks", ")", ...
Calculate and record the number of edge pixels left to do on each tile
[ "Calculate", "and", "record", "the", "number", "of", "edge", "pixels", "left", "to", "do", "on", "each", "tile" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L332-L344
train
Calculate and record the number of edge pixels left to do on each tile
creare-com/pydem
pydem/dem_processing.py
TileEdge.fill_n_done
def fill_n_done(self): """ Calculate and record the number of edge pixels that are done one each tile. """ left = self.left right = self.right top = self.top bottom = self.bottom for i in xrange(self.n_chunks): self.n_done.ravel()[i] = ...
python
def fill_n_done(self): """ Calculate and record the number of edge pixels that are done one each tile. """ left = self.left right = self.right top = self.top bottom = self.bottom for i in xrange(self.n_chunks): self.n_done.ravel()[i] = ...
[ "def", "fill_n_done", "(", "self", ")", ":", "left", "=", "self", ".", "left", "right", "=", "self", ".", "right", "top", "=", "self", ".", "top", "bottom", "=", "self", ".", "bottom", "for", "i", "in", "xrange", "(", "self", ".", "n_chunks", ")", ...
Calculate and record the number of edge pixels that are done one each tile.
[ "Calculate", "and", "record", "the", "number", "of", "edge", "pixels", "that", "are", "done", "one", "each", "tile", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L346-L359
train
Calculates and record the number of edge pixels that are done one each tile.
creare-com/pydem
pydem/dem_processing.py
TileEdge.fill_percent_done
def fill_percent_done(self): """ Calculate the percentage of edge pixels that would be done if the tile was reprocessed. This is done for each tile. """ left = self.left right = self.right top = self.top bottom = self.bottom for i in xrange(self.n_...
python
def fill_percent_done(self): """ Calculate the percentage of edge pixels that would be done if the tile was reprocessed. This is done for each tile. """ left = self.left right = self.right top = self.top bottom = self.bottom for i in xrange(self.n_...
[ "def", "fill_percent_done", "(", "self", ")", ":", "left", "=", "self", ".", "left", "right", "=", "self", ".", "right", "top", "=", "self", ".", "top", "bottom", "=", "self", ".", "bottom", "for", "i", "in", "xrange", "(", "self", ".", "n_chunks", ...
Calculate the percentage of edge pixels that would be done if the tile was reprocessed. This is done for each tile.
[ "Calculate", "the", "percentage", "of", "edge", "pixels", "that", "would", "be", "done", "if", "the", "tile", "was", "reprocessed", ".", "This", "is", "done", "for", "each", "tile", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L361-L380
train
Calculates the percentage of edge pixels that would be done if the tile was reprocessed. This is done for each tile.
creare-com/pydem
pydem/dem_processing.py
TileEdge.fill_array
def fill_array(self, array, field, add=False, maximize=False): """ Given a full array (for the while image), fill it with the data on the edges. """ self.fix_shapes() for i in xrange(self.n_chunks): for side in ['left', 'right', 'top', 'bottom']: ...
python
def fill_array(self, array, field, add=False, maximize=False): """ Given a full array (for the while image), fill it with the data on the edges. """ self.fix_shapes() for i in xrange(self.n_chunks): for side in ['left', 'right', 'top', 'bottom']: ...
[ "def", "fill_array", "(", "self", ",", "array", ",", "field", ",", "add", "=", "False", ",", "maximize", "=", "False", ")", ":", "self", ".", "fix_shapes", "(", ")", "for", "i", "in", "xrange", "(", "self", ".", "n_chunks", ")", ":", "for", "side",...
Given a full array (for the while image), fill it with the data on the edges.
[ "Given", "a", "full", "array", "(", "for", "the", "while", "image", ")", "fill", "it", "with", "the", "data", "on", "the", "edges", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L382-L398
train
Given a full array with the data on the while image fill it with the data on the while image edges.
creare-com/pydem
pydem/dem_processing.py
TileEdge.fix_shapes
def fix_shapes(self): """ Fixes the shape of the data fields on edges. Left edges should be column vectors, and top edges should be row vectors, for example. """ for i in xrange(self.n_chunks): for side in ['left', 'right', 'top', 'bottom']: edge = get...
python
def fix_shapes(self): """ Fixes the shape of the data fields on edges. Left edges should be column vectors, and top edges should be row vectors, for example. """ for i in xrange(self.n_chunks): for side in ['left', 'right', 'top', 'bottom']: edge = get...
[ "def", "fix_shapes", "(", "self", ")", ":", "for", "i", "in", "xrange", "(", "self", ".", "n_chunks", ")", ":", "for", "side", "in", "[", "'left'", ",", "'right'", ",", "'top'", ",", "'bottom'", "]", ":", "edge", "=", "getattr", "(", "self", ",", ...
Fixes the shape of the data fields on edges. Left edges should be column vectors, and top edges should be row vectors, for example.
[ "Fixes", "the", "shape", "of", "the", "data", "fields", "on", "edges", ".", "Left", "edges", "should", "be", "column", "vectors", "and", "top", "edges", "should", "be", "row", "vectors", "for", "example", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L400-L414
train
Fixes the shape of the data fields on edges.
creare-com/pydem
pydem/dem_processing.py
TileEdge.find_best_candidate
def find_best_candidate(self): """ Determine which tile, when processed, would complete the largest percentage of unresolved edge pixels. This is a heuristic function and does not give the optimal tile. """ self.fill_percent_done() i_b = np.argmax(self.percent_don...
python
def find_best_candidate(self): """ Determine which tile, when processed, would complete the largest percentage of unresolved edge pixels. This is a heuristic function and does not give the optimal tile. """ self.fill_percent_done() i_b = np.argmax(self.percent_don...
[ "def", "find_best_candidate", "(", "self", ")", ":", "self", ".", "fill_percent_done", "(", ")", "i_b", "=", "np", ".", "argmax", "(", "self", ".", "percent_done", ".", "ravel", "(", ")", ")", "if", "self", ".", "percent_done", ".", "ravel", "(", ")", ...
Determine which tile, when processed, would complete the largest percentage of unresolved edge pixels. This is a heuristic function and does not give the optimal tile.
[ "Determine", "which", "tile", "when", "processed", "would", "complete", "the", "largest", "percentage", "of", "unresolved", "edge", "pixels", ".", "This", "is", "a", "heuristic", "function", "and", "does", "not", "give", "the", "optimal", "tile", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L416-L433
train
Determine which tile when processed would complete the largest percentage of unresolved edge pixels.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.save_array
def save_array(self, array, name=None, partname=None, rootpath='.', raw=False, as_int=True): """ Standard array saving routine Parameters ----------- array : array Array to save to file name : str, optional Default 'array.tif'. ...
python
def save_array(self, array, name=None, partname=None, rootpath='.', raw=False, as_int=True): """ Standard array saving routine Parameters ----------- array : array Array to save to file name : str, optional Default 'array.tif'. ...
[ "def", "save_array", "(", "self", ",", "array", ",", "name", "=", "None", ",", "partname", "=", "None", ",", "rootpath", "=", "'.'", ",", "raw", "=", "False", ",", "as_int", "=", "True", ")", ":", "if", "name", "is", "None", "and", "partname", "is"...
Standard array saving routine Parameters ----------- array : array Array to save to file name : str, optional Default 'array.tif'. Filename of array to save. Over-writes partname. partname : str, optional Part of the filename to sa...
[ "Standard", "array", "saving", "routine" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L631-L684
train
Standard array saving routine.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.save_uca
def save_uca(self, rootpath, raw=False, as_int=False): """ Saves the upstream contributing area to a file """ self.save_array(self.uca, None, 'uca', rootpath, raw, as_int=as_int)
python
def save_uca(self, rootpath, raw=False, as_int=False): """ Saves the upstream contributing area to a file """ self.save_array(self.uca, None, 'uca', rootpath, raw, as_int=as_int)
[ "def", "save_uca", "(", "self", ",", "rootpath", ",", "raw", "=", "False", ",", "as_int", "=", "False", ")", ":", "self", ".", "save_array", "(", "self", ".", "uca", ",", "None", ",", "'uca'", ",", "rootpath", ",", "raw", ",", "as_int", "=", "as_in...
Saves the upstream contributing area to a file
[ "Saves", "the", "upstream", "contributing", "area", "to", "a", "file" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L686-L689
train
Saves the upstream contributing area to a file
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.save_twi
def save_twi(self, rootpath, raw=False, as_int=True): """ Saves the topographic wetness index to a file """ self.twi = np.ma.masked_array(self.twi, mask=self.twi <= 0, fill_value=-9999) # self.twi = self.twi.filled() self.twi[self.flats] = 0...
python
def save_twi(self, rootpath, raw=False, as_int=True): """ Saves the topographic wetness index to a file """ self.twi = np.ma.masked_array(self.twi, mask=self.twi <= 0, fill_value=-9999) # self.twi = self.twi.filled() self.twi[self.flats] = 0...
[ "def", "save_twi", "(", "self", ",", "rootpath", ",", "raw", "=", "False", ",", "as_int", "=", "True", ")", ":", "self", ".", "twi", "=", "np", ".", "ma", ".", "masked_array", "(", "self", ".", "twi", ",", "mask", "=", "self", ".", "twi", "<=", ...
Saves the topographic wetness index to a file
[ "Saves", "the", "topographic", "wetness", "index", "to", "a", "file" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L691-L700
train
Saves the topographic wetness index to a file.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.save_slope
def save_slope(self, rootpath, raw=False, as_int=False): """ Saves the magnitude of the slope to a file """ self.save_array(self.mag, None, 'mag', rootpath, raw, as_int=as_int)
python
def save_slope(self, rootpath, raw=False, as_int=False): """ Saves the magnitude of the slope to a file """ self.save_array(self.mag, None, 'mag', rootpath, raw, as_int=as_int)
[ "def", "save_slope", "(", "self", ",", "rootpath", ",", "raw", "=", "False", ",", "as_int", "=", "False", ")", ":", "self", ".", "save_array", "(", "self", ".", "mag", ",", "None", ",", "'mag'", ",", "rootpath", ",", "raw", ",", "as_int", "=", "as_...
Saves the magnitude of the slope to a file
[ "Saves", "the", "magnitude", "of", "the", "slope", "to", "a", "file" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L702-L705
train
Saves the magnitude of the slope to a file.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.save_direction
def save_direction(self, rootpath, raw=False, as_int=False): """ Saves the direction of the slope to a file """ self.save_array(self.direction, None, 'ang', rootpath, raw, as_int=as_int)
python
def save_direction(self, rootpath, raw=False, as_int=False): """ Saves the direction of the slope to a file """ self.save_array(self.direction, None, 'ang', rootpath, raw, as_int=as_int)
[ "def", "save_direction", "(", "self", ",", "rootpath", ",", "raw", "=", "False", ",", "as_int", "=", "False", ")", ":", "self", ".", "save_array", "(", "self", ".", "direction", ",", "None", ",", "'ang'", ",", "rootpath", ",", "raw", ",", "as_int", "...
Saves the direction of the slope to a file
[ "Saves", "the", "direction", "of", "the", "slope", "to", "a", "file" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L707-L710
train
Saves the direction of the slope to a file
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.save_outputs
def save_outputs(self, rootpath='.', raw=False): """Saves TWI, UCA, magnitude and direction of slope to files. """ self.save_twi(rootpath, raw) self.save_uca(rootpath, raw) self.save_slope(rootpath, raw) self.save_direction(rootpath, raw)
python
def save_outputs(self, rootpath='.', raw=False): """Saves TWI, UCA, magnitude and direction of slope to files. """ self.save_twi(rootpath, raw) self.save_uca(rootpath, raw) self.save_slope(rootpath, raw) self.save_direction(rootpath, raw)
[ "def", "save_outputs", "(", "self", ",", "rootpath", "=", "'.'", ",", "raw", "=", "False", ")", ":", "self", ".", "save_twi", "(", "rootpath", ",", "raw", ")", "self", ".", "save_uca", "(", "rootpath", ",", "raw", ")", "self", ".", "save_slope", "(",...
Saves TWI, UCA, magnitude and direction of slope to files.
[ "Saves", "TWI", "UCA", "magnitude", "and", "direction", "of", "slope", "to", "files", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L712-L718
train
Saves TWI UCA magnitude and direction of slope to files.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.load_array
def load_array(self, fn, name): """ Can only load files that were saved in the 'raw' format. Loads previously computed field 'name' from file Valid names are 'mag', 'direction', 'uca', 'twi' """ if os.path.exists(fn + '.npz'): array = np.load(fn + '.npz') ...
python
def load_array(self, fn, name): """ Can only load files that were saved in the 'raw' format. Loads previously computed field 'name' from file Valid names are 'mag', 'direction', 'uca', 'twi' """ if os.path.exists(fn + '.npz'): array = np.load(fn + '.npz') ...
[ "def", "load_array", "(", "self", ",", "fn", ",", "name", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "fn", "+", "'.npz'", ")", ":", "array", "=", "np", ".", "load", "(", "fn", "+", "'.npz'", ")", "try", ":", "setattr", "(", "self", ...
Can only load files that were saved in the 'raw' format. Loads previously computed field 'name' from file Valid names are 'mag', 'direction', 'uca', 'twi'
[ "Can", "only", "load", "files", "that", "were", "saved", "in", "the", "raw", "format", ".", "Loads", "previously", "computed", "field", "name", "from", "file", "Valid", "names", "are", "mag", "direction", "uca", "twi" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L720-L737
train
Loads an array from a file and sets the attribute name to the value of the attribute name.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._get_chunk_edges
def _get_chunk_edges(self, NN, chunk_size, chunk_overlap): """ Given the size of the array, calculate and array that gives the edges of chunks of nominal size, with specified overlap Parameters ---------- NN : int Size of array chunk_size : int ...
python
def _get_chunk_edges(self, NN, chunk_size, chunk_overlap): """ Given the size of the array, calculate and array that gives the edges of chunks of nominal size, with specified overlap Parameters ---------- NN : int Size of array chunk_size : int ...
[ "def", "_get_chunk_edges", "(", "self", ",", "NN", ",", "chunk_size", ",", "chunk_overlap", ")", ":", "left_edge", "=", "np", ".", "arange", "(", "0", ",", "NN", "-", "chunk_overlap", ",", "chunk_size", ")", "left_edge", "[", "1", ":", "]", "-=", "chun...
Given the size of the array, calculate and array that gives the edges of chunks of nominal size, with specified overlap Parameters ---------- NN : int Size of array chunk_size : int Nominal size of chunks (chunk_size < NN) chunk_overlap : int ...
[ "Given", "the", "size", "of", "the", "array", "calculate", "and", "array", "that", "gives", "the", "edges", "of", "chunks", "of", "nominal", "size", "with", "specified", "overlap", "Parameters", "----------", "NN", ":", "int", "Size", "of", "array", "chunk_s...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L754-L781
train
Calculates the edges of the array that gives the nominal size of the array and the overlap of the chunks.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._assign_chunk
def _assign_chunk(self, data, arr1, arr2, te, be, le, re, ovr, add=False): """ Assign data from a chunk to the full array. The data in overlap regions will not be assigned to the full array Parameters ----------- data : array Unused array (except for shape) t...
python
def _assign_chunk(self, data, arr1, arr2, te, be, le, re, ovr, add=False): """ Assign data from a chunk to the full array. The data in overlap regions will not be assigned to the full array Parameters ----------- data : array Unused array (except for shape) t...
[ "def", "_assign_chunk", "(", "self", ",", "data", ",", "arr1", ",", "arr2", ",", "te", ",", "be", ",", "le", ",", "re", ",", "ovr", ",", "add", "=", "False", ")", ":", "if", "te", "==", "0", ":", "i1", "=", "0", "else", ":", "i1", "=", "ovr...
Assign data from a chunk to the full array. The data in overlap regions will not be assigned to the full array Parameters ----------- data : array Unused array (except for shape) that has size of full tile arr1 : array Full size array to which data will b...
[ "Assign", "data", "from", "a", "chunk", "to", "the", "full", "array", ".", "The", "data", "in", "overlap", "regions", "will", "not", "be", "assigned", "to", "the", "full", "array" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L783-L838
train
Assign data from a chunk to a full array.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.calc_slopes_directions
def calc_slopes_directions(self, plotflag=False): """ Calculates the magnitude and direction of slopes and fills self.mag, self.direction """ # TODO minimum filter behavior with nans? # fill/interpolate flats first if self.fill_flats: ...
python
def calc_slopes_directions(self, plotflag=False): """ Calculates the magnitude and direction of slopes and fills self.mag, self.direction """ # TODO minimum filter behavior with nans? # fill/interpolate flats first if self.fill_flats: ...
[ "def", "calc_slopes_directions", "(", "self", ",", "plotflag", "=", "False", ")", ":", "# TODO minimum filter behavior with nans?", "# fill/interpolate flats first", "if", "self", ".", "fill_flats", ":", "data", "=", "np", ".", "ma", ".", "filled", "(", "self", "....
Calculates the magnitude and direction of slopes and fills self.mag, self.direction
[ "Calculates", "the", "magnitude", "and", "direction", "of", "slopes", "and", "fills", "self", ".", "mag", "self", ".", "direction" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L936-L1018
train
Calculates the magnitude and direction of slopes and fills self. data
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._slopes_directions
def _slopes_directions(self, data, dX, dY, method='tarboton'): """ Wrapper to pick between various algorithms """ # %% if method == 'tarboton': return self._tarboton_slopes_directions(data, dX, dY) elif method == 'central': return self._central_slopes_dire...
python
def _slopes_directions(self, data, dX, dY, method='tarboton'): """ Wrapper to pick between various algorithms """ # %% if method == 'tarboton': return self._tarboton_slopes_directions(data, dX, dY) elif method == 'central': return self._central_slopes_dire...
[ "def", "_slopes_directions", "(", "self", ",", "data", ",", "dX", ",", "dY", ",", "method", "=", "'tarboton'", ")", ":", "# %%", "if", "method", "==", "'tarboton'", ":", "return", "self", ".", "_tarboton_slopes_directions", "(", "data", ",", "dX", ",", "...
Wrapper to pick between various algorithms
[ "Wrapper", "to", "pick", "between", "various", "algorithms" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1020-L1027
train
Wrapper for _tarboton_slopes_directions
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._tarboton_slopes_directions
def _tarboton_slopes_directions(self, data, dX, dY): """ Calculate the slopes and directions based on the 8 sections from Tarboton http://www.neng.usu.edu/cee/faculty/dtarb/96wr03137.pdf """ return _tarboton_slopes_directions(data, dX, dY, ...
python
def _tarboton_slopes_directions(self, data, dX, dY): """ Calculate the slopes and directions based on the 8 sections from Tarboton http://www.neng.usu.edu/cee/faculty/dtarb/96wr03137.pdf """ return _tarboton_slopes_directions(data, dX, dY, ...
[ "def", "_tarboton_slopes_directions", "(", "self", ",", "data", ",", "dX", ",", "dY", ")", ":", "return", "_tarboton_slopes_directions", "(", "data", ",", "dX", ",", "dY", ",", "self", ".", "facets", ",", "self", ".", "ang_adj", ")" ]
Calculate the slopes and directions based on the 8 sections from Tarboton http://www.neng.usu.edu/cee/faculty/dtarb/96wr03137.pdf
[ "Calculate", "the", "slopes", "and", "directions", "based", "on", "the", "8", "sections", "from", "Tarboton", "http", ":", "//", "www", ".", "neng", ".", "usu", ".", "edu", "/", "cee", "/", "faculty", "/", "dtarb", "/", "96wr03137", ".", "pdf" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1029-L1036
train
Calculate the slopes and directions based on Tarboton s section 3. 1. 1.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._central_slopes_directions
def _central_slopes_directions(self, data, dX, dY): """ Calculates magnitude/direction of slopes using central difference """ shp = np.array(data.shape) - 1 direction = np.full(data.shape, FLAT_ID_INT, 'float64') mag = np.full(direction, FLAT_ID_INT, 'float64') ...
python
def _central_slopes_directions(self, data, dX, dY): """ Calculates magnitude/direction of slopes using central difference """ shp = np.array(data.shape) - 1 direction = np.full(data.shape, FLAT_ID_INT, 'float64') mag = np.full(direction, FLAT_ID_INT, 'float64') ...
[ "def", "_central_slopes_directions", "(", "self", ",", "data", ",", "dX", ",", "dY", ")", ":", "shp", "=", "np", ".", "array", "(", "data", ".", "shape", ")", "-", "1", "direction", "=", "np", ".", "full", "(", "data", ".", "shape", ",", "FLAT_ID_I...
Calculates magnitude/direction of slopes using central difference
[ "Calculates", "magnitude", "/", "direction", "of", "slopes", "using", "central", "difference" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1038-L1054
train
Calculates the magnitude and direction of slopes using central difference
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._find_flats_edges
def _find_flats_edges(self, data, mag, direction): """ Extend flats 1 square downstream Flats on the downstream side of the flat might find a valid angle, but that doesn't mean that it's a correct angle. We have to find these and then set them equal to a flat """ ...
python
def _find_flats_edges(self, data, mag, direction): """ Extend flats 1 square downstream Flats on the downstream side of the flat might find a valid angle, but that doesn't mean that it's a correct angle. We have to find these and then set them equal to a flat """ ...
[ "def", "_find_flats_edges", "(", "self", ",", "data", ",", "mag", ",", "direction", ")", ":", "i12", "=", "np", ".", "arange", "(", "data", ".", "size", ")", ".", "reshape", "(", "data", ".", "shape", ")", "flat", "=", "mag", "==", "FLAT_ID_INT", "...
Extend flats 1 square downstream Flats on the downstream side of the flat might find a valid angle, but that doesn't mean that it's a correct angle. We have to find these and then set them equal to a flat
[ "Extend", "flats", "1", "square", "downstream", "Flats", "on", "the", "downstream", "side", "of", "the", "flat", "might", "find", "a", "valid", "angle", "but", "that", "doesn", "t", "mean", "that", "it", "s", "a", "correct", "angle", ".", "We", "have", ...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1056-L1079
train
Find the flats that are adjacent to the downstream side of the flat.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.calc_uca
def calc_uca(self, plotflag=False, edge_init_data=None, uca_init=None): """Calculates the upstream contributing area. Parameters ---------- plotflag : bool, optional Default False. If true will plot debugging plots. For large files, this will be very slow ...
python
def calc_uca(self, plotflag=False, edge_init_data=None, uca_init=None): """Calculates the upstream contributing area. Parameters ---------- plotflag : bool, optional Default False. If true will plot debugging plots. For large files, this will be very slow ...
[ "def", "calc_uca", "(", "self", ",", "plotflag", "=", "False", ",", "edge_init_data", "=", "None", ",", "uca_init", "=", "None", ")", ":", "if", "self", ".", "direction", "is", "None", ":", "self", ".", "calc_slopes_directions", "(", ")", "# Initialize the...
Calculates the upstream contributing area. Parameters ---------- plotflag : bool, optional Default False. If true will plot debugging plots. For large files, this will be very slow edge_init_data : list, optional edge_init_data = [uca_data, done_data,...
[ "Calculates", "the", "upstream", "contributing", "area", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1081-L1344
train
Calculates the upstream contributing area of the key - value entry.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.fix_edge_pixels
def fix_edge_pixels(self, edge_init_data, edge_init_done, edge_init_todo): """ This function fixes the pixels on the very edge of the tile. Drainage is calculated if the edge is downstream from the interior. If there is data available on the edge (from edge_init_data, for eg) the...
python
def fix_edge_pixels(self, edge_init_data, edge_init_done, edge_init_todo): """ This function fixes the pixels on the very edge of the tile. Drainage is calculated if the edge is downstream from the interior. If there is data available on the edge (from edge_init_data, for eg) the...
[ "def", "fix_edge_pixels", "(", "self", ",", "edge_init_data", ",", "edge_init_done", ",", "edge_init_todo", ")", ":", "data", ",", "dX", ",", "dY", ",", "direction", ",", "flats", "=", "self", ".", "data", ",", "self", ".", "dX", ",", "self", ".", "dY"...
This function fixes the pixels on the very edge of the tile. Drainage is calculated if the edge is downstream from the interior. If there is data available on the edge (from edge_init_data, for eg) then this data is used. This is a bit of hack to take care of the edge-values. It could ...
[ "This", "function", "fixes", "the", "pixels", "on", "the", "very", "edge", "of", "the", "tile", ".", "Drainage", "is", "calculated", "if", "the", "edge", "is", "downstream", "from", "the", "interior", ".", "If", "there", "is", "data", "available", "on", ...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1346-L1412
train
This function fixes the pixels on the very edge of the tile.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._calc_uca_chunk_update
def _calc_uca_chunk_update(self, data, dX, dY, direction, mag, flats, tile_edge=None, i=None, area_edges=None, edge_todo=None, edge_done=None, plotflag=False): """ Calculates the upstream contributing area due t...
python
def _calc_uca_chunk_update(self, data, dX, dY, direction, mag, flats, tile_edge=None, i=None, area_edges=None, edge_todo=None, edge_done=None, plotflag=False): """ Calculates the upstream contributing area due t...
[ "def", "_calc_uca_chunk_update", "(", "self", ",", "data", ",", "dX", ",", "dY", ",", "direction", ",", "mag", ",", "flats", ",", "tile_edge", "=", "None", ",", "i", "=", "None", ",", "area_edges", "=", "None", ",", "edge_todo", "=", "None", ",", "ed...
Calculates the upstream contributing area due to contributions from the edges only.
[ "Calculates", "the", "upstream", "contributing", "area", "due", "to", "contributions", "from", "the", "edges", "only", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1414-L1642
train
Calculates the upstream contributing area due to contributions from the edges only.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._calc_uca_chunk
def _calc_uca_chunk(self, data, dX, dY, direction, mag, flats, area_edges, plotflag=False, edge_todo_i_no_mask=True): """ Calculates the upstream contributing area for the interior, and includes edge contributions if they are provided through area_edges. """ ...
python
def _calc_uca_chunk(self, data, dX, dY, direction, mag, flats, area_edges, plotflag=False, edge_todo_i_no_mask=True): """ Calculates the upstream contributing area for the interior, and includes edge contributions if they are provided through area_edges. """ ...
[ "def", "_calc_uca_chunk", "(", "self", ",", "data", ",", "dX", ",", "dY", ",", "direction", ",", "mag", ",", "flats", ",", "area_edges", ",", "plotflag", "=", "False", ",", "edge_todo_i_no_mask", "=", "True", ")", ":", "# %%", "# Figure out which section the...
Calculates the upstream contributing area for the interior, and includes edge contributions if they are provided through area_edges.
[ "Calculates", "the", "upstream", "contributing", "area", "for", "the", "interior", "and", "includes", "edge", "contributions", "if", "they", "are", "provided", "through", "area_edges", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1644-L1761
train
Calculates the upstream contributing area for the interior and the upstream contributing area for the interior and the upstream contributing area for the interior and the upstream contributing area for the interior and the upstream contributing area for the interior.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._drain_step
def _drain_step(self, A, ids, area, done, edge_todo): """ Does a single step of the upstream contributing area calculation. Here the pixels in ids are drained downstream, the areas are updated and the next set of pixels to drain are determined for the next round. """ # On...
python
def _drain_step(self, A, ids, area, done, edge_todo): """ Does a single step of the upstream contributing area calculation. Here the pixels in ids are drained downstream, the areas are updated and the next set of pixels to drain are determined for the next round. """ # On...
[ "def", "_drain_step", "(", "self", ",", "A", ",", "ids", ",", "area", ",", "done", ",", "edge_todo", ")", ":", "# Only drain to cells that have a contribution", "A_todo", "=", "A", "[", ":", ",", "ids", ".", "ravel", "(", ")", "]", "colsum", "=", "np", ...
Does a single step of the upstream contributing area calculation. Here the pixels in ids are drained downstream, the areas are updated and the next set of pixels to drain are determined for the next round.
[ "Does", "a", "single", "step", "of", "the", "upstream", "contributing", "area", "calculation", ".", "Here", "the", "pixels", "in", "ids", "are", "drained", "downstream", "the", "areas", "are", "updated", "and", "the", "next", "set", "of", "pixels", "to", "...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1763-L1793
train
Do a single step of the upstream contributing area calculation.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._calc_uca_section_proportion
def _calc_uca_section_proportion(self, data, dX, dY, direction, flats): """ Given the direction, figure out which nodes the drainage will go toward, and what proportion of the drainage goes to which node """ shp = np.array(data.shape) - 1 facets = self.facets adj...
python
def _calc_uca_section_proportion(self, data, dX, dY, direction, flats): """ Given the direction, figure out which nodes the drainage will go toward, and what proportion of the drainage goes to which node """ shp = np.array(data.shape) - 1 facets = self.facets adj...
[ "def", "_calc_uca_section_proportion", "(", "self", ",", "data", ",", "dX", ",", "dY", ",", "direction", ",", "flats", ")", ":", "shp", "=", "np", ".", "array", "(", "data", ".", "shape", ")", "-", "1", "facets", "=", "self", ".", "facets", "adjust",...
Given the direction, figure out which nodes the drainage will go toward, and what proportion of the drainage goes to which node
[ "Given", "the", "direction", "figure", "out", "which", "nodes", "the", "drainage", "will", "go", "toward", "and", "what", "proportion", "of", "the", "drainage", "goes", "to", "which", "node" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1795-L1844
train
Calculate the uca section proportion of the drainage
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._mk_adjacency_matrix
def _mk_adjacency_matrix(self, section, proportion, flats, elev, mag, dX, dY): """ Calculates the adjacency of connectivity matrix. This matrix tells which pixels drain to which. For example, the pixel i, will recieve area from np.nonzero(A[i, :]) at the proportions given in A[i...
python
def _mk_adjacency_matrix(self, section, proportion, flats, elev, mag, dX, dY): """ Calculates the adjacency of connectivity matrix. This matrix tells which pixels drain to which. For example, the pixel i, will recieve area from np.nonzero(A[i, :]) at the proportions given in A[i...
[ "def", "_mk_adjacency_matrix", "(", "self", ",", "section", ",", "proportion", ",", "flats", ",", "elev", ",", "mag", ",", "dX", ",", "dY", ")", ":", "shp", "=", "section", ".", "shape", "mat_data", "=", "np", ".", "row_stack", "(", "(", "proportion", ...
Calculates the adjacency of connectivity matrix. This matrix tells which pixels drain to which. For example, the pixel i, will recieve area from np.nonzero(A[i, :]) at the proportions given in A[i, :]. So, the row gives the pixel drain to, and the columns the pixels drained from.
[ "Calculates", "the", "adjacency", "of", "connectivity", "matrix", ".", "This", "matrix", "tells", "which", "pixels", "drain", "to", "which", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1846-L1908
train
Calculates the adjacency matrix for the internal state of the logarithmic entry.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._mk_connectivity
def _mk_connectivity(self, section, i12, j1, j2): """ Helper function for _mk_adjacency_matrix. Calculates the drainage neighbors and proportions based on the direction. This deals with non-flat regions in the image. In this case, each pixel can only drain to either 1 or two neig...
python
def _mk_connectivity(self, section, i12, j1, j2): """ Helper function for _mk_adjacency_matrix. Calculates the drainage neighbors and proportions based on the direction. This deals with non-flat regions in the image. In this case, each pixel can only drain to either 1 or two neig...
[ "def", "_mk_connectivity", "(", "self", ",", "section", ",", "i12", ",", "j1", ",", "j2", ")", ":", "shp", "=", "np", ".", "array", "(", "section", ".", "shape", ")", "-", "1", "facets", "=", "self", ".", "facets", "for", "ii", ",", "facet", "in"...
Helper function for _mk_adjacency_matrix. Calculates the drainage neighbors and proportions based on the direction. This deals with non-flat regions in the image. In this case, each pixel can only drain to either 1 or two neighbors.
[ "Helper", "function", "for", "_mk_adjacency_matrix", ".", "Calculates", "the", "drainage", "neighbors", "and", "proportions", "based", "on", "the", "direction", ".", "This", "deals", "with", "non", "-", "flat", "regions", "in", "the", "image", ".", "In", "this...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L1910-L2007
train
This function calculates the adjacency matrix for the drainage and the proportions based on the direction of the image.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._mk_connectivity_pits
def _mk_connectivity_pits(self, i12, flats, elev, mag, dX, dY): """ Helper function for _mk_adjacency_matrix. This is a more general version of _mk_adjacency_flats which drains pits and flats to nearby but non-adjacent pixels. The slope magnitude (and flats mask) is updated for t...
python
def _mk_connectivity_pits(self, i12, flats, elev, mag, dX, dY): """ Helper function for _mk_adjacency_matrix. This is a more general version of _mk_adjacency_flats which drains pits and flats to nearby but non-adjacent pixels. The slope magnitude (and flats mask) is updated for t...
[ "def", "_mk_connectivity_pits", "(", "self", ",", "i12", ",", "flats", ",", "elev", ",", "mag", ",", "dX", ",", "dY", ")", ":", "e", "=", "elev", ".", "data", ".", "ravel", "(", ")", "pit_i", "=", "[", "]", "pit_j", "=", "[", "]", "pit_prop", "...
Helper function for _mk_adjacency_matrix. This is a more general version of _mk_adjacency_flats which drains pits and flats to nearby but non-adjacent pixels. The slope magnitude (and flats mask) is updated for these pits and flats so that the TWI can be computed.
[ "Helper", "function", "for", "_mk_adjacency_matrix", ".", "This", "is", "a", "more", "general", "version", "of", "_mk_adjacency_flats", "which", "drains", "pits", "and", "flats", "to", "nearby", "but", "non", "-", "adjacent", "pixels", ".", "The", "slope", "ma...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2009-L2098
train
This function is a more general method for _mk_adjacency_matrix. This function is used to compute the adjacency matrix for the pits and flats.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._mk_connectivity_flats
def _mk_connectivity_flats(self, i12, j1, j2, mat_data, flats, elev, mag): """ Helper function for _mk_adjacency_matrix. This calcualtes the connectivity for flat regions. Every pixel in the flat will drain to a random pixel in the flat. This accumulates all the area in the flat ...
python
def _mk_connectivity_flats(self, i12, j1, j2, mat_data, flats, elev, mag): """ Helper function for _mk_adjacency_matrix. This calcualtes the connectivity for flat regions. Every pixel in the flat will drain to a random pixel in the flat. This accumulates all the area in the flat ...
[ "def", "_mk_connectivity_flats", "(", "self", ",", "i12", ",", "j1", ",", "j2", ",", "mat_data", ",", "flats", ",", "elev", ",", "mag", ")", ":", "nn", ",", "mm", "=", "flats", ".", "shape", "NN", "=", "np", ".", "prod", "(", "flats", ".", "shape...
Helper function for _mk_adjacency_matrix. This calcualtes the connectivity for flat regions. Every pixel in the flat will drain to a random pixel in the flat. This accumulates all the area in the flat region to a single pixel. All that area is then drained from that pixel to the surround...
[ "Helper", "function", "for", "_mk_adjacency_matrix", ".", "This", "calcualtes", "the", "connectivity", "for", "flat", "regions", ".", "Every", "pixel", "in", "the", "flat", "will", "drain", "to", "a", "random", "pixel", "in", "the", "flat", ".", "This", "acc...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2100-L2235
train
This function calculates the connectivity between two flat regions.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor.calc_twi
def calc_twi(self): """ Calculates the topographic wetness index and saves the result in self.twi. Returns ------- twi : array Array giving the topographic wetness index at each pixel """ if self.uca is None: self.calc_uca() ...
python
def calc_twi(self): """ Calculates the topographic wetness index and saves the result in self.twi. Returns ------- twi : array Array giving the topographic wetness index at each pixel """ if self.uca is None: self.calc_uca() ...
[ "def", "calc_twi", "(", "self", ")", ":", "if", "self", ".", "uca", "is", "None", ":", "self", ".", "calc_uca", "(", ")", "gc", ".", "collect", "(", ")", "# Just in case", "min_area", "=", "self", ".", "twi_min_area", "min_slope", "=", "self", ".", "...
Calculates the topographic wetness index and saves the result in self.twi. Returns ------- twi : array Array giving the topographic wetness index at each pixel
[ "Calculates", "the", "topographic", "wetness", "index", "and", "saves", "the", "result", "in", "self", ".", "twi", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2237-L2267
train
Calculates the topographic wetness index and saves the result in self. twi.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._plot_connectivity
def _plot_connectivity(self, A, data=None, lims=[None, None]): """ A debug function used to plot the adjacency/connectivity matrix. This is really just a light wrapper around _plot_connectivity_helper """ if data is None: data = self.data B = A.tocoo() ...
python
def _plot_connectivity(self, A, data=None, lims=[None, None]): """ A debug function used to plot the adjacency/connectivity matrix. This is really just a light wrapper around _plot_connectivity_helper """ if data is None: data = self.data B = A.tocoo() ...
[ "def", "_plot_connectivity", "(", "self", ",", "A", ",", "data", "=", "None", ",", "lims", "=", "[", "None", ",", "None", "]", ")", ":", "if", "data", "is", "None", ":", "data", "=", "self", ".", "data", "B", "=", "A", ".", "tocoo", "(", ")", ...
A debug function used to plot the adjacency/connectivity matrix. This is really just a light wrapper around _plot_connectivity_helper
[ "A", "debug", "function", "used", "to", "plot", "the", "adjacency", "/", "connectivity", "matrix", ".", "This", "is", "really", "just", "a", "light", "wrapper", "around", "_plot_connectivity_helper" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2269-L2279
train
A debug function used to plot the adjacency matrix A.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._plot_connectivity_helper
def _plot_connectivity_helper(self, ii, ji, mat_datai, data, lims=[1, 8]): """ A debug function used to plot the adjacency/connectivity matrix. """ from matplotlib.pyplot import quiver, colorbar, clim, matshow I = ~np.isnan(mat_datai) & (ji != -1) & (mat_datai >= 0) mat_...
python
def _plot_connectivity_helper(self, ii, ji, mat_datai, data, lims=[1, 8]): """ A debug function used to plot the adjacency/connectivity matrix. """ from matplotlib.pyplot import quiver, colorbar, clim, matshow I = ~np.isnan(mat_datai) & (ji != -1) & (mat_datai >= 0) mat_...
[ "def", "_plot_connectivity_helper", "(", "self", ",", "ii", ",", "ji", ",", "mat_datai", ",", "data", ",", "lims", "=", "[", "1", ",", "8", "]", ")", ":", "from", "matplotlib", ".", "pyplot", "import", "quiver", ",", "colorbar", ",", "clim", ",", "ma...
A debug function used to plot the adjacency/connectivity matrix.
[ "A", "debug", "function", "used", "to", "plot", "the", "adjacency", "/", "connectivity", "matrix", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2281-L2299
train
A debug function used to plot the adjacency matrix and connectivity matrix.
creare-com/pydem
pydem/dem_processing.py
DEMProcessor._plot_debug_slopes_directions
def _plot_debug_slopes_directions(self): """ A debug function to plot the direction calculated in various ways. """ # %% from matplotlib.pyplot import matshow, colorbar, clim, title matshow(self.direction / np.pi * 180); colorbar(); clim(0, 360) title('Direction'...
python
def _plot_debug_slopes_directions(self): """ A debug function to plot the direction calculated in various ways. """ # %% from matplotlib.pyplot import matshow, colorbar, clim, title matshow(self.direction / np.pi * 180); colorbar(); clim(0, 360) title('Direction'...
[ "def", "_plot_debug_slopes_directions", "(", "self", ")", ":", "# %%", "from", "matplotlib", ".", "pyplot", "import", "matshow", ",", "colorbar", ",", "clim", ",", "title", "matshow", "(", "self", ".", "direction", "/", "np", ".", "pi", "*", "180", ")", ...
A debug function to plot the direction calculated in various ways.
[ "A", "debug", "function", "to", "plot", "the", "direction", "calculated", "in", "various", "ways", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/dem_processing.py#L2301-L2361
train
A debug function to plot the direction calculated in various ways.
click-contrib/click-configfile
tasks/docs.py
clean
def clean(ctx, dry_run=False): """Cleanup generated document artifacts.""" basedir = ctx.sphinx.destdir or "build/docs" cleanup_dirs([basedir], dry_run=dry_run)
python
def clean(ctx, dry_run=False): """Cleanup generated document artifacts.""" basedir = ctx.sphinx.destdir or "build/docs" cleanup_dirs([basedir], dry_run=dry_run)
[ "def", "clean", "(", "ctx", ",", "dry_run", "=", "False", ")", ":", "basedir", "=", "ctx", ".", "sphinx", ".", "destdir", "or", "\"build/docs\"", "cleanup_dirs", "(", "[", "basedir", "]", ",", "dry_run", "=", "dry_run", ")" ]
Cleanup generated document artifacts.
[ "Cleanup", "generated", "document", "artifacts", "." ]
a616204cb9944125fd5051556f27a7ccef611e22
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/tasks/docs.py#L20-L23
train
Cleanup generated document artifacts.
click-contrib/click-configfile
tasks/docs.py
build
def build(ctx, builder="html", options=""): """Build docs with sphinx-build""" sourcedir = ctx.config.sphinx.sourcedir destdir = Path(ctx.config.sphinx.destdir or "build")/builder destdir = destdir.abspath() with cd(sourcedir): destdir_relative = Path(".").relpathto(destdir) command ...
python
def build(ctx, builder="html", options=""): """Build docs with sphinx-build""" sourcedir = ctx.config.sphinx.sourcedir destdir = Path(ctx.config.sphinx.destdir or "build")/builder destdir = destdir.abspath() with cd(sourcedir): destdir_relative = Path(".").relpathto(destdir) command ...
[ "def", "build", "(", "ctx", ",", "builder", "=", "\"html\"", ",", "options", "=", "\"\"", ")", ":", "sourcedir", "=", "ctx", ".", "config", ".", "sphinx", ".", "sourcedir", "destdir", "=", "Path", "(", "ctx", ".", "config", ".", "sphinx", ".", "destd...
Build docs with sphinx-build
[ "Build", "docs", "with", "sphinx", "-", "build" ]
a616204cb9944125fd5051556f27a7ccef611e22
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/tasks/docs.py#L30-L40
train
Build docs with sphinx - build
click-contrib/click-configfile
tasks/docs.py
browse
def browse(ctx): """Open documentation in web browser.""" page_html = Path(ctx.config.sphinx.destdir)/"html"/"index.html" if not page_html.exists(): build(ctx, builder="html") assert page_html.exists() open_cmd = "open" # -- WORKS ON: MACOSX if sys.platform.startswith("win"): o...
python
def browse(ctx): """Open documentation in web browser.""" page_html = Path(ctx.config.sphinx.destdir)/"html"/"index.html" if not page_html.exists(): build(ctx, builder="html") assert page_html.exists() open_cmd = "open" # -- WORKS ON: MACOSX if sys.platform.startswith("win"): o...
[ "def", "browse", "(", "ctx", ")", ":", "page_html", "=", "Path", "(", "ctx", ".", "config", ".", "sphinx", ".", "destdir", ")", "/", "\"html\"", "/", "\"index.html\"", "if", "not", "page_html", ".", "exists", "(", ")", ":", "build", "(", "ctx", ",", ...
Open documentation in web browser.
[ "Open", "documentation", "in", "web", "browser", "." ]
a616204cb9944125fd5051556f27a7ccef611e22
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/tasks/docs.py#L48-L57
train
Open documentation in web browser.
click-contrib/click-configfile
tasks/docs.py
save
def save(ctx, dest="docs.html", format="html"): """Save/update docs under destination directory.""" print("STEP: Generate docs in HTML format") build(ctx, builder=format) print("STEP: Save docs under %s/" % dest) source_dir = Path(ctx.config.sphinx.destdir)/format Path(dest).rmtree_p() sour...
python
def save(ctx, dest="docs.html", format="html"): """Save/update docs under destination directory.""" print("STEP: Generate docs in HTML format") build(ctx, builder=format) print("STEP: Save docs under %s/" % dest) source_dir = Path(ctx.config.sphinx.destdir)/format Path(dest).rmtree_p() sour...
[ "def", "save", "(", "ctx", ",", "dest", "=", "\"docs.html\"", ",", "format", "=", "\"html\"", ")", ":", "print", "(", "\"STEP: Generate docs in HTML format\"", ")", "build", "(", "ctx", ",", "builder", "=", "format", ")", "print", "(", "\"STEP: Save docs under...
Save/update docs under destination directory.
[ "Save", "/", "update", "docs", "under", "destination", "directory", "." ]
a616204cb9944125fd5051556f27a7ccef611e22
https://github.com/click-contrib/click-configfile/blob/a616204cb9944125fd5051556f27a7ccef611e22/tasks/docs.py#L65-L81
train
Save docs under destination directory.
creare-com/pydem
pydem/processing_manager.py
find_neighbors
def find_neighbors(neighbors, coords, I, source_files, f, sides): """Find the tile neighbors based on filenames Parameters ----------- neighbors : dict Dictionary that stores the neighbors. Format is neighbors["source_file_name"]["side"] = "neighbor_source_file_name" coords : list ...
python
def find_neighbors(neighbors, coords, I, source_files, f, sides): """Find the tile neighbors based on filenames Parameters ----------- neighbors : dict Dictionary that stores the neighbors. Format is neighbors["source_file_name"]["side"] = "neighbor_source_file_name" coords : list ...
[ "def", "find_neighbors", "(", "neighbors", ",", "coords", ",", "I", ",", "source_files", ",", "f", ",", "sides", ")", ":", "for", "i", ",", "c1", "in", "enumerate", "(", "coords", ")", ":", "me", "=", "source_files", "[", "I", "[", "i", "]", "]", ...
Find the tile neighbors based on filenames Parameters ----------- neighbors : dict Dictionary that stores the neighbors. Format is neighbors["source_file_name"]["side"] = "neighbor_source_file_name" coords : list List of coordinates determined from the filename. See :py:...
[ "Find", "the", "tile", "neighbors", "based", "on", "filenames" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L74-L120
train
Find the tile neighbors based on filenames.
creare-com/pydem
pydem/processing_manager.py
TileEdgeFile.set_neighbor_data
def set_neighbor_data(self, elev_fn, dem_proc, interp=None): """ From the elevation filename, we can figure out and load the data and done arrays. """ if interp is None: interp = self.build_interpolator(dem_proc) opp = {'top': 'bottom', 'left': 'right'} ...
python
def set_neighbor_data(self, elev_fn, dem_proc, interp=None): """ From the elevation filename, we can figure out and load the data and done arrays. """ if interp is None: interp = self.build_interpolator(dem_proc) opp = {'top': 'bottom', 'left': 'right'} ...
[ "def", "set_neighbor_data", "(", "self", ",", "elev_fn", ",", "dem_proc", ",", "interp", "=", "None", ")", ":", "if", "interp", "is", "None", ":", "interp", "=", "self", ".", "build_interpolator", "(", "dem_proc", ")", "opp", "=", "{", "'top'", ":", "'...
From the elevation filename, we can figure out and load the data and done arrays.
[ "From", "the", "elevation", "filename", "we", "can", "figure", "out", "and", "load", "the", "data", "and", "done", "arrays", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L453-L485
train
Set the data and done arrays for the neighbors of the given elevation filename.
creare-com/pydem
pydem/processing_manager.py
TileEdgeFile.update_edge_todo
def update_edge_todo(self, elev_fn, dem_proc): """ Can figure out how to update the todo based on the elev filename """ for key in self.edges[elev_fn].keys(): self.edges[elev_fn][key].set_data('todo', data=dem_proc.edge_todo)
python
def update_edge_todo(self, elev_fn, dem_proc): """ Can figure out how to update the todo based on the elev filename """ for key in self.edges[elev_fn].keys(): self.edges[elev_fn][key].set_data('todo', data=dem_proc.edge_todo)
[ "def", "update_edge_todo", "(", "self", ",", "elev_fn", ",", "dem_proc", ")", ":", "for", "key", "in", "self", ".", "edges", "[", "elev_fn", "]", ".", "keys", "(", ")", ":", "self", ".", "edges", "[", "elev_fn", "]", "[", "key", "]", ".", "set_data...
Can figure out how to update the todo based on the elev filename
[ "Can", "figure", "out", "how", "to", "update", "the", "todo", "based", "on", "the", "elev", "filename" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L487-L492
train
Update the todo of the edge
creare-com/pydem
pydem/processing_manager.py
TileEdgeFile.update_edges
def update_edges(self, elev_fn, dem_proc): """ After finishing a calculation, this will update the neighbors and the todo for that tile """ interp = self.build_interpolator(dem_proc) self.update_edge_todo(elev_fn, dem_proc) self.set_neighbor_data(elev_fn, dem_proc...
python
def update_edges(self, elev_fn, dem_proc): """ After finishing a calculation, this will update the neighbors and the todo for that tile """ interp = self.build_interpolator(dem_proc) self.update_edge_todo(elev_fn, dem_proc) self.set_neighbor_data(elev_fn, dem_proc...
[ "def", "update_edges", "(", "self", ",", "elev_fn", ",", "dem_proc", ")", ":", "interp", "=", "self", ".", "build_interpolator", "(", "dem_proc", ")", "self", ".", "update_edge_todo", "(", "elev_fn", ",", "dem_proc", ")", "self", ".", "set_neighbor_data", "(...
After finishing a calculation, this will update the neighbors and the todo for that tile
[ "After", "finishing", "a", "calculation", "this", "will", "update", "the", "neighbors", "and", "the", "todo", "for", "that", "tile" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L494-L501
train
Update the edges of the node with the given elev_fn and dem_proc.
creare-com/pydem
pydem/processing_manager.py
TileEdgeFile.get_edge_init_data
def get_edge_init_data(self, fn, save_path=None): """ Creates the initialization data from the edge structure """ edge_init_data = {key: self.edges[fn][key].get('data') for key in self.edges[fn].keys()} edge_init_done = {key: self.edges[fn][key].get('do...
python
def get_edge_init_data(self, fn, save_path=None): """ Creates the initialization data from the edge structure """ edge_init_data = {key: self.edges[fn][key].get('data') for key in self.edges[fn].keys()} edge_init_done = {key: self.edges[fn][key].get('do...
[ "def", "get_edge_init_data", "(", "self", ",", "fn", ",", "save_path", "=", "None", ")", ":", "edge_init_data", "=", "{", "key", ":", "self", ".", "edges", "[", "fn", "]", "[", "key", "]", ".", "get", "(", "'data'", ")", "for", "key", "in", "self",...
Creates the initialization data from the edge structure
[ "Creates", "the", "initialization", "data", "from", "the", "edge", "structure" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L503-L514
train
Creates the initialization data from the edge structure
creare-com/pydem
pydem/processing_manager.py
TileEdgeFile.find_best_candidate
def find_best_candidate(self, elev_source_files=None): """ Heuristically determines which tile should be recalculated based on updated edge information. Presently does not check if that tile is locked, which could lead to a parallel thread closing while one thread continues to pr...
python
def find_best_candidate(self, elev_source_files=None): """ Heuristically determines which tile should be recalculated based on updated edge information. Presently does not check if that tile is locked, which could lead to a parallel thread closing while one thread continues to pr...
[ "def", "find_best_candidate", "(", "self", ",", "elev_source_files", "=", "None", ")", ":", "self", ".", "fill_percent_done", "(", ")", "i_b", "=", "np", ".", "argmax", "(", "self", ".", "percent_done", ".", "values", "(", ")", ")", "if", "self", ".", ...
Heuristically determines which tile should be recalculated based on updated edge information. Presently does not check if that tile is locked, which could lead to a parallel thread closing while one thread continues to process tiles.
[ "Heuristically", "determines", "which", "tile", "should", "be", "recalculated", "based", "on", "updated", "edge", "information", ".", "Presently", "does", "not", "check", "if", "that", "tile", "is", "locked", "which", "could", "lead", "to", "a", "parallel", "t...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L516-L555
train
Find the best candidate for the current thread based on the updated edge information.
creare-com/pydem
pydem/processing_manager.py
ProcessManager.process_twi
def process_twi(self, index=None, do_edges=False, skip_uca_twi=False): """ Processes the TWI, along with any dependencies (like the slope and UCA) Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, ...
python
def process_twi(self, index=None, do_edges=False, skip_uca_twi=False): """ Processes the TWI, along with any dependencies (like the slope and UCA) Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, ...
[ "def", "process_twi", "(", "self", ",", "index", "=", "None", ",", "do_edges", "=", "False", ",", "skip_uca_twi", "=", "False", ")", ":", "if", "index", "is", "not", "None", ":", "elev_source_files", "=", "[", "self", ".", "elev_source_files", "[", "inde...
Processes the TWI, along with any dependencies (like the slope and UCA) Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, will only process the index/indices of the files as listed in self.el...
[ "Processes", "the", "TWI", "along", "with", "any", "dependencies", "(", "like", "the", "slope", "and", "UCA", ")" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L614-L663
train
Processes the TWI and returns the TWI status of the UCA and TWI.
creare-com/pydem
pydem/processing_manager.py
ProcessManager.process
def process(self, index=None): """ This will completely process a directory of elevation tiles (as supplied in the constructor). Both phases of the calculation, the single tile and edge resolution phases are run. Parameters ----------- index : int/slice (optional...
python
def process(self, index=None): """ This will completely process a directory of elevation tiles (as supplied in the constructor). Both phases of the calculation, the single tile and edge resolution phases are run. Parameters ----------- index : int/slice (optional...
[ "def", "process", "(", "self", ",", "index", "=", "None", ")", ":", "# Round 0 of twi processing, process the magnitude and directions of", "# slopes", "print", "\"Starting slope calculation round\"", "self", ".", "process_twi", "(", "index", ",", "do_edges", "=", "False"...
This will completely process a directory of elevation tiles (as supplied in the constructor). Both phases of the calculation, the single tile and edge resolution phases are run. Parameters ----------- index : int/slice (optional) Default None - processes all tiles in...
[ "This", "will", "completely", "process", "a", "directory", "of", "elevation", "tiles", "(", "as", "supplied", "in", "the", "constructor", ")", ".", "Both", "phases", "of", "the", "calculation", "the", "single", "tile", "and", "edge", "resolution", "phases", ...
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L665-L709
train
This function processes a directory of elevation tiles and processes the edge resolution phases of the elevation tiles.
creare-com/pydem
pydem/processing_manager.py
ProcessManager.calculate_twi
def calculate_twi(self, esfile, save_path, use_cache=True, do_edges=False, skip_uca_twi=False): """ Calculates twi for supplied elevation file Parameters ----------- esfile : str Path to elevation file to be processed save_path: str ...
python
def calculate_twi(self, esfile, save_path, use_cache=True, do_edges=False, skip_uca_twi=False): """ Calculates twi for supplied elevation file Parameters ----------- esfile : str Path to elevation file to be processed save_path: str ...
[ "def", "calculate_twi", "(", "self", ",", "esfile", ",", "save_path", ",", "use_cache", "=", "True", ",", "do_edges", "=", "False", ",", "skip_uca_twi", "=", "False", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "joi...
Calculates twi for supplied elevation file Parameters ----------- esfile : str Path to elevation file to be processed save_path: str Root path to location where TWI will be saved. TWI will be saved in a subdirectory 'twi'. use_cache : bool (op...
[ "Calculates", "twi", "for", "supplied", "elevation", "file" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L711-L860
train
Calculates the TWI for the supplied elevation file and saves it in the specified path.
creare-com/pydem
pydem/processing_manager.py
ProcessManager.process_command
def process_command(self, command, save_name='custom', index=None): """ Processes the hillshading Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, will only process the index/indices of ...
python
def process_command(self, command, save_name='custom', index=None): """ Processes the hillshading Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, will only process the index/indices of ...
[ "def", "process_command", "(", "self", ",", "command", ",", "save_name", "=", "'custom'", ",", "index", "=", "None", ")", ":", "if", "index", "is", "not", "None", ":", "elev_source_files", "=", "[", "self", ".", "elev_source_files", "[", "index", "]", "]...
Processes the hillshading Parameters ----------- index : int/slice (optional) Default: None - process all tiles in source directory. Otherwise, will only process the index/indices of the files as listed in self.elev_source_files
[ "Processes", "the", "hillshading" ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/processing_manager.py#L873-L932
train
Processes the command for all the elevation sources in the source directory.
creare-com/pydem
pydem/utils.py
rename_files
def rename_files(files, name=None): """ Given a list of file paths for elevation files, this function will rename those files to the format required by the pyDEM package. This assumes a .tif extension. Parameters ----------- files : list A list of strings of the paths to the elevat...
python
def rename_files(files, name=None): """ Given a list of file paths for elevation files, this function will rename those files to the format required by the pyDEM package. This assumes a .tif extension. Parameters ----------- files : list A list of strings of the paths to the elevat...
[ "def", "rename_files", "(", "files", ",", "name", "=", "None", ")", ":", "for", "fil", "in", "files", ":", "elev_file", "=", "GdalReader", "(", "file_name", "=", "fil", ")", "elev", ",", "=", "elev_file", ".", "raster_layers", "fn", "=", "get_fn", "(",...
Given a list of file paths for elevation files, this function will rename those files to the format required by the pyDEM package. This assumes a .tif extension. Parameters ----------- files : list A list of strings of the paths to the elevation files that will be renamed name ...
[ "Given", "a", "list", "of", "file", "paths", "for", "elevation", "files", "this", "function", "will", "rename", "those", "files", "to", "the", "format", "required", "by", "the", "pyDEM", "package", "." ]
c2fc8d84cfb411df84f71a6dec9edc4b544f710a
https://github.com/creare-com/pydem/blob/c2fc8d84cfb411df84f71a6dec9edc4b544f710a/pydem/utils.py#L46-L74
train
This function will rename the files in the elevation tree.