partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
test
WikiText.parameters
Return a list of parameter objects.
wikitextparser/_wikitext.py
def parameters(self) -> List['Parameter']: """Return a list of parameter objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ Parameter(_lststr, _type_to_spans, span, 'Parameter') for span in self._subspans('Parameter')]
def parameters(self) -> List['Parameter']: """Return a list of parameter objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ Parameter(_lststr, _type_to_spans, span, 'Parameter') for span in self._subspans('Parameter')]
[ "Return", "a", "list", "of", "parameter", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L687-L693
[ "def", "parameters", "(", "self", ")", "->", "List", "[", "'Parameter'", "]", ":", "_lststr", "=", "self", ".", "_lststr", "_type_to_spans", "=", "self", ".", "_type_to_spans", "return", "[", "Parameter", "(", "_lststr", ",", "_type_to_spans", ",", "span", ...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.parser_functions
Return a list of parser function objects.
wikitextparser/_wikitext.py
def parser_functions(self) -> List['ParserFunction']: """Return a list of parser function objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ ParserFunction(_lststr, _type_to_spans, span, 'ParserFunction') for span in self._subspans('P...
def parser_functions(self) -> List['ParserFunction']: """Return a list of parser function objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ ParserFunction(_lststr, _type_to_spans, span, 'ParserFunction') for span in self._subspans('P...
[ "Return", "a", "list", "of", "parser", "function", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L696-L702
[ "def", "parser_functions", "(", "self", ")", "->", "List", "[", "'ParserFunction'", "]", ":", "_lststr", "=", "self", ".", "_lststr", "_type_to_spans", "=", "self", ".", "_type_to_spans", "return", "[", "ParserFunction", "(", "_lststr", ",", "_type_to_spans", ...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.templates
Return a list of templates as template objects.
wikitextparser/_wikitext.py
def templates(self) -> List['Template']: """Return a list of templates as template objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ Template(_lststr, _type_to_spans, span, 'Template') for span in self._subspans('Template')]
def templates(self) -> List['Template']: """Return a list of templates as template objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ Template(_lststr, _type_to_spans, span, 'Template') for span in self._subspans('Template')]
[ "Return", "a", "list", "of", "templates", "as", "template", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L705-L711
[ "def", "templates", "(", "self", ")", "->", "List", "[", "'Template'", "]", ":", "_lststr", "=", "self", ".", "_lststr", "_type_to_spans", "=", "self", ".", "_type_to_spans", "return", "[", "Template", "(", "_lststr", ",", "_type_to_spans", ",", "span", ",...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.wikilinks
Return a list of wikilink objects.
wikitextparser/_wikitext.py
def wikilinks(self) -> List['WikiLink']: """Return a list of wikilink objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ WikiLink(_lststr, _type_to_spans, span, 'WikiLink') for span in self._subspans('WikiLink')]
def wikilinks(self) -> List['WikiLink']: """Return a list of wikilink objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ WikiLink(_lststr, _type_to_spans, span, 'WikiLink') for span in self._subspans('WikiLink')]
[ "Return", "a", "list", "of", "wikilink", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L714-L720
[ "def", "wikilinks", "(", "self", ")", "->", "List", "[", "'WikiLink'", "]", ":", "_lststr", "=", "self", ".", "_lststr", "_type_to_spans", "=", "self", ".", "_type_to_spans", "return", "[", "WikiLink", "(", "_lststr", ",", "_type_to_spans", ",", "span", ",...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.comments
Return a list of comment objects.
wikitextparser/_wikitext.py
def comments(self) -> List['Comment']: """Return a list of comment objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ Comment(_lststr, _type_to_spans, span, 'Comment') for span in self._subspans('Comment')]
def comments(self) -> List['Comment']: """Return a list of comment objects.""" _lststr = self._lststr _type_to_spans = self._type_to_spans return [ Comment(_lststr, _type_to_spans, span, 'Comment') for span in self._subspans('Comment')]
[ "Return", "a", "list", "of", "comment", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L723-L729
[ "def", "comments", "(", "self", ")", "->", "List", "[", "'Comment'", "]", ":", "_lststr", "=", "self", ".", "_lststr", "_type_to_spans", "=", "self", ".", "_type_to_spans", "return", "[", "Comment", "(", "_lststr", ",", "_type_to_spans", ",", "span", ",", ...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.external_links
Return a list of found external link objects. Note: Templates adjacent to external links are considered part of the link. In reality, this depends on the contents of the template: >>> WikiText( ... 'http://example.com{{dead link}}' ...).external_l...
wikitextparser/_wikitext.py
def external_links(self) -> List['ExternalLink']: """Return a list of found external link objects. Note: Templates adjacent to external links are considered part of the link. In reality, this depends on the contents of the template: >>> WikiText( ... ...
def external_links(self) -> List['ExternalLink']: """Return a list of found external link objects. Note: Templates adjacent to external links are considered part of the link. In reality, this depends on the contents of the template: >>> WikiText( ... ...
[ "Return", "a", "list", "of", "found", "external", "link", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L732-L778
[ "def", "external_links", "(", "self", ")", "->", "List", "[", "'ExternalLink'", "]", ":", "external_links", "=", "[", "]", "# type: List['ExternalLink']", "external_links_append", "=", "external_links", ".", "append", "type_to_spans", "=", "self", ".", "_type_to_spa...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.sections
Return a list of section in current wikitext. The first section will always be the lead section, even if it is an empty string.
wikitextparser/_wikitext.py
def sections(self) -> List['Section']: """Return a list of section in current wikitext. The first section will always be the lead section, even if it is an empty string. """ sections = [] # type: List['Section'] sections_append = sections.append type_to_spans = ...
def sections(self) -> List['Section']: """Return a list of section in current wikitext. The first section will always be the lead section, even if it is an empty string. """ sections = [] # type: List['Section'] sections_append = sections.append type_to_spans = ...
[ "Return", "a", "list", "of", "section", "in", "current", "wikitext", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L781-L839
[ "def", "sections", "(", "self", ")", "->", "List", "[", "'Section'", "]", ":", "sections", "=", "[", "]", "# type: List['Section']", "sections_append", "=", "sections", ".", "append", "type_to_spans", "=", "self", ".", "_type_to_spans", "lststr", "=", "self", ...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.tables
Return a list of found table objects.
wikitextparser/_wikitext.py
def tables(self) -> List['Table']: """Return a list of found table objects.""" tables = [] # type: List['Table'] tables_append = tables.append type_to_spans = self._type_to_spans lststr = self._lststr shadow = self._shadow[:] ss, se = self._span spans = t...
def tables(self) -> List['Table']: """Return a list of found table objects.""" tables = [] # type: List['Table'] tables_append = tables.append type_to_spans = self._type_to_spans lststr = self._lststr shadow = self._shadow[:] ss, se = self._span spans = t...
[ "Return", "a", "list", "of", "found", "table", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L842-L882
[ "def", "tables", "(", "self", ")", "->", "List", "[", "'Table'", "]", ":", "tables", "=", "[", "]", "# type: List['Table']", "tables_append", "=", "tables", ".", "append", "type_to_spans", "=", "self", ".", "_type_to_spans", "lststr", "=", "self", ".", "_l...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.lists
r"""Return a list of WikiList objects. :param pattern: The starting pattern for list items. Return all types of lists (ol, ul, and dl) if pattern is None. If pattern is not None, it will be passed to the regex engine, remember to escape the `*` character. Examples: ...
wikitextparser/_wikitext.py
def lists(self, pattern: str = None) -> List['WikiList']: r"""Return a list of WikiList objects. :param pattern: The starting pattern for list items. Return all types of lists (ol, ul, and dl) if pattern is None. If pattern is not None, it will be passed to the regex engine, ...
def lists(self, pattern: str = None) -> List['WikiList']: r"""Return a list of WikiList objects. :param pattern: The starting pattern for list items. Return all types of lists (ol, ul, and dl) if pattern is None. If pattern is not None, it will be passed to the regex engine, ...
[ "r", "Return", "a", "list", "of", "WikiList", "objects", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L889-L939
[ "def", "lists", "(", "self", ",", "pattern", ":", "str", "=", "None", ")", "->", "List", "[", "'WikiList'", "]", ":", "lists", "=", "[", "]", "lists_append", "=", "lists", ".", "append", "lststr", "=", "self", ".", "_lststr", "type_to_spans", "=", "s...
1347425814361d7955342c53212edbb27f0ff4b5
test
WikiText.tags
Return all tags with the given name.
wikitextparser/_wikitext.py
def tags(self, name=None) -> List['Tag']: """Return all tags with the given name.""" lststr = self._lststr type_to_spans = self._type_to_spans if name: if name in _tag_extensions: string = lststr[0] return [ Tag(lststr, type...
def tags(self, name=None) -> List['Tag']: """Return all tags with the given name.""" lststr = self._lststr type_to_spans = self._type_to_spans if name: if name in _tag_extensions: string = lststr[0] return [ Tag(lststr, type...
[ "Return", "all", "tags", "with", "the", "given", "name", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L941-L1009
[ "def", "tags", "(", "self", ",", "name", "=", "None", ")", "->", "List", "[", "'Tag'", "]", ":", "lststr", "=", "self", ".", "_lststr", "type_to_spans", "=", "self", ".", "_type_to_spans", "if", "name", ":", "if", "name", "in", "_tag_extensions", ":", ...
1347425814361d7955342c53212edbb27f0ff4b5
test
SubWikiText._subspans
Yield all the sub-span indices excluding self._span.
wikitextparser/_wikitext.py
def _subspans(self, _type: str) -> Generator[int, None, None]: """Yield all the sub-span indices excluding self._span.""" ss, se = self._span spans = self._type_to_spans[_type] # Do not yield self._span by bisecting for s < ss. # The second bisect is an optimization and should be...
def _subspans(self, _type: str) -> Generator[int, None, None]: """Yield all the sub-span indices excluding self._span.""" ss, se = self._span spans = self._type_to_spans[_type] # Do not yield self._span by bisecting for s < ss. # The second bisect is an optimization and should be...
[ "Yield", "all", "the", "sub", "-", "span", "indices", "excluding", "self", ".", "_span", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L1052-L1062
[ "def", "_subspans", "(", "self", ",", "_type", ":", "str", ")", "->", "Generator", "[", "int", ",", "None", ",", "None", "]", ":", "ss", ",", "se", "=", "self", ".", "_span", "spans", "=", "self", ".", "_type_to_spans", "[", "_type", "]", "# Do not...
1347425814361d7955342c53212edbb27f0ff4b5
test
SubWikiText.ancestors
Return the ancestors of the current node. :param type_: the type of the desired ancestors as a string. Currently the following types are supported: {Template, ParserFunction, WikiLink, Comment, Parameter, ExtensionTag}. The default is None and means all the ancestors of any ...
wikitextparser/_wikitext.py
def ancestors(self, type_: Optional[str] = None) -> List['WikiText']: """Return the ancestors of the current node. :param type_: the type of the desired ancestors as a string. Currently the following types are supported: {Template, ParserFunction, WikiLink, Comment, Parameter, E...
def ancestors(self, type_: Optional[str] = None) -> List['WikiText']: """Return the ancestors of the current node. :param type_: the type of the desired ancestors as a string. Currently the following types are supported: {Template, ParserFunction, WikiLink, Comment, Parameter, E...
[ "Return", "the", "ancestors", "of", "the", "current", "node", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L1065-L1088
[ "def", "ancestors", "(", "self", ",", "type_", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "List", "[", "'WikiText'", "]", ":", "if", "type_", "is", "None", ":", "types", "=", "SPAN_PARSER_TYPES", "else", ":", "types", "=", "type_", ","...
1347425814361d7955342c53212edbb27f0ff4b5
test
SubWikiText.parent
Return the parent node of the current object. :param type_: the type of the desired parent object. Currently the following types are supported: {Template, ParserFunction, WikiLink, Comment, Parameter, ExtensionTag}. The default is None and means the first parent, of any type...
wikitextparser/_wikitext.py
def parent(self, type_: Optional[str] = None) -> Optional['WikiText']: """Return the parent node of the current object. :param type_: the type of the desired parent object. Currently the following types are supported: {Template, ParserFunction, WikiLink, Comment, Parameter, Exte...
def parent(self, type_: Optional[str] = None) -> Optional['WikiText']: """Return the parent node of the current object. :param type_: the type of the desired parent object. Currently the following types are supported: {Template, ParserFunction, WikiLink, Comment, Parameter, Exte...
[ "Return", "the", "parent", "node", "of", "the", "current", "object", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_wikitext.py#L1090-L1103
[ "def", "parent", "(", "self", ",", "type_", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Optional", "[", "'WikiText'", "]", ":", "ancestors", "=", "self", ".", "ancestors", "(", "type_", ")", "if", "ancestors", ":", "return", "ancestors",...
1347425814361d7955342c53212edbb27f0ff4b5
test
mode
Return the most common item in the list. Return the first one if there are more than one most common items. Example: >>> mode([1,1,2,2,]) 1 >>> mode([1,2,2]) 2 >>> mode([]) ... ValueError: max() arg is an empty sequence
wikitextparser/_template.py
def mode(list_: List[T]) -> T: """Return the most common item in the list. Return the first one if there are more than one most common items. Example: >>> mode([1,1,2,2,]) 1 >>> mode([1,2,2]) 2 >>> mode([]) ... ValueError: max() arg is an empty sequence """ return max(...
def mode(list_: List[T]) -> T: """Return the most common item in the list. Return the first one if there are more than one most common items. Example: >>> mode([1,1,2,2,]) 1 >>> mode([1,2,2]) 2 >>> mode([]) ... ValueError: max() arg is an empty sequence """ return max(...
[ "Return", "the", "most", "common", "item", "in", "the", "list", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L323-L338
[ "def", "mode", "(", "list_", ":", "List", "[", "T", "]", ")", "->", "T", ":", "return", "max", "(", "set", "(", "list_", ")", ",", "key", "=", "list_", ".", "count", ")" ]
1347425814361d7955342c53212edbb27f0ff4b5
test
get_arg
Return the first argument in the args that has the given name. Return None if no such argument is found. As the computation of self.arguments is a little costly, this function was created so that other methods that have already computed the arguments use it instead of calling self.get_arg directly.
wikitextparser/_template.py
def get_arg(name: str, args: Iterable[Argument]) -> Optional[Argument]: """Return the first argument in the args that has the given name. Return None if no such argument is found. As the computation of self.arguments is a little costly, this function was created so that other methods that have already...
def get_arg(name: str, args: Iterable[Argument]) -> Optional[Argument]: """Return the first argument in the args that has the given name. Return None if no such argument is found. As the computation of self.arguments is a little costly, this function was created so that other methods that have already...
[ "Return", "the", "first", "argument", "in", "the", "args", "that", "has", "the", "given", "name", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L341-L353
[ "def", "get_arg", "(", "name", ":", "str", ",", "args", ":", "Iterable", "[", "Argument", "]", ")", "->", "Optional", "[", "Argument", "]", ":", "for", "arg", "in", "args", ":", "if", "arg", ".", "name", ".", "strip", "(", "WS", ")", "==", "name"...
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.normal_name
Return normal form of self.name. - Remove comments. - Remove language code. - Remove namespace ("template:" or any of `localized_namespaces`. - Use space instead of underscore. - Remove consecutive spaces. - Use uppercase for the first letter if `capitalize`. - R...
wikitextparser/_template.py
def normal_name( self, rm_namespaces=('Template',), capital_links=False, _code: str = None, *, code: str = None, capitalize=False ) -> str: """Return normal form of self.name. - Remove comments. - Remove language code. - Remove...
def normal_name( self, rm_namespaces=('Template',), capital_links=False, _code: str = None, *, code: str = None, capitalize=False ) -> str: """Return normal form of self.name. - Remove comments. - Remove language code. - Remove...
[ "Return", "normal", "form", "of", "self", ".", "name", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L40-L113
[ "def", "normal_name", "(", "self", ",", "rm_namespaces", "=", "(", "'Template'", ",", ")", ",", "capital_links", "=", "False", ",", "_code", ":", "str", "=", "None", ",", "*", ",", "code", ":", "str", "=", "None", ",", "capitalize", "=", "False", ")"...
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.rm_first_of_dup_args
Eliminate duplicate arguments by removing the first occurrences. Remove the first occurrences of duplicate arguments, regardless of their value. Result of the rendered wikitext should remain the same. Warning: Some meaningful data may be removed from wikitext. Also see `rm_dup_args_saf...
wikitextparser/_template.py
def rm_first_of_dup_args(self) -> None: """Eliminate duplicate arguments by removing the first occurrences. Remove the first occurrences of duplicate arguments, regardless of their value. Result of the rendered wikitext should remain the same. Warning: Some meaningful data may be remove...
def rm_first_of_dup_args(self) -> None: """Eliminate duplicate arguments by removing the first occurrences. Remove the first occurrences of duplicate arguments, regardless of their value. Result of the rendered wikitext should remain the same. Warning: Some meaningful data may be remove...
[ "Eliminate", "duplicate", "arguments", "by", "removing", "the", "first", "occurrences", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L115-L130
[ "def", "rm_first_of_dup_args", "(", "self", ")", "->", "None", ":", "names", "=", "set", "(", ")", "# type: set", "for", "a", "in", "reversed", "(", "self", ".", "arguments", ")", ":", "name", "=", "a", ".", "name", ".", "strip", "(", "WS", ")", "i...
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.rm_dup_args_safe
Remove duplicate arguments in a safe manner. Remove the duplicate arguments only in the following situations: 1. Both arguments have the same name AND value. (Remove one of them.) 2. Arguments have the same name and one of them is empty. (Remove the empty...
wikitextparser/_template.py
def rm_dup_args_safe(self, tag: str = None) -> None: """Remove duplicate arguments in a safe manner. Remove the duplicate arguments only in the following situations: 1. Both arguments have the same name AND value. (Remove one of them.) 2. Arguments have the same ...
def rm_dup_args_safe(self, tag: str = None) -> None: """Remove duplicate arguments in a safe manner. Remove the duplicate arguments only in the following situations: 1. Both arguments have the same name AND value. (Remove one of them.) 2. Arguments have the same ...
[ "Remove", "duplicate", "arguments", "in", "a", "safe", "manner", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L132-L188
[ "def", "rm_dup_args_safe", "(", "self", ",", "tag", ":", "str", "=", "None", ")", "->", "None", ":", "name_to_lastarg_vals", "=", "{", "}", "# type: Dict[str, Tuple[Argument, List[str]]]", "# Removing positional args affects their name. By reversing the list", "# we avoid enc...
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.set_arg
Set the value for `name` argument. Add it if it doesn't exist. - Use `positional`, `before` and `after` keyword arguments only when adding a new argument. - If `before` is given, ignore `after`. - If neither `before` nor `after` are given and it's needed to add a new argumen...
wikitextparser/_template.py
def set_arg( self, name: str, value: str, positional: bool = None, before: str = None, after: str = None, preserve_spacing: bool = True ) -> None: """Set the value for `name` argument. Add it if it doesn't exist. - Use `positional`, `before` and `afte...
def set_arg( self, name: str, value: str, positional: bool = None, before: str = None, after: str = None, preserve_spacing: bool = True ) -> None: """Set the value for `name` argument. Add it if it doesn't exist. - Use `positional`, `before` and `afte...
[ "Set", "the", "value", "for", "name", "argument", ".", "Add", "it", "if", "it", "doesn", "t", "exist", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L190-L285
[ "def", "set_arg", "(", "self", ",", "name", ":", "str", ",", "value", ":", "str", ",", "positional", ":", "bool", "=", "None", ",", "before", ":", "str", "=", "None", ",", "after", ":", "str", "=", "None", ",", "preserve_spacing", ":", "bool", "=",...
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.get_arg
Return the last argument with the given name. Return None if no argument with that name is found.
wikitextparser/_template.py
def get_arg(self, name: str) -> Optional[Argument]: """Return the last argument with the given name. Return None if no argument with that name is found. """ return get_arg(name, reversed(self.arguments))
def get_arg(self, name: str) -> Optional[Argument]: """Return the last argument with the given name. Return None if no argument with that name is found. """ return get_arg(name, reversed(self.arguments))
[ "Return", "the", "last", "argument", "with", "the", "given", "name", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L287-L292
[ "def", "get_arg", "(", "self", ",", "name", ":", "str", ")", "->", "Optional", "[", "Argument", "]", ":", "return", "get_arg", "(", "name", ",", "reversed", "(", "self", ".", "arguments", ")", ")" ]
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.has_arg
Return true if the is an arg named `name`. Also check equality of values if `value` is provided. Note: If you just need to get an argument and you want to LBYL, it's better to get_arg directly and then check if the returned value is None.
wikitextparser/_template.py
def has_arg(self, name: str, value: str = None) -> bool: """Return true if the is an arg named `name`. Also check equality of values if `value` is provided. Note: If you just need to get an argument and you want to LBYL, it's better to get_arg directly and then check if the returne...
def has_arg(self, name: str, value: str = None) -> bool: """Return true if the is an arg named `name`. Also check equality of values if `value` is provided. Note: If you just need to get an argument and you want to LBYL, it's better to get_arg directly and then check if the returne...
[ "Return", "true", "if", "the", "is", "an", "arg", "named", "name", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L294-L314
[ "def", "has_arg", "(", "self", ",", "name", ":", "str", ",", "value", ":", "str", "=", "None", ")", "->", "bool", ":", "for", "arg", "in", "reversed", "(", "self", ".", "arguments", ")", ":", "if", "arg", ".", "name", ".", "strip", "(", "WS", "...
1347425814361d7955342c53212edbb27f0ff4b5
test
Template.del_arg
Delete all arguments with the given then.
wikitextparser/_template.py
def del_arg(self, name: str) -> None: """Delete all arguments with the given then.""" for arg in reversed(self.arguments): if arg.name.strip(WS) == name.strip(WS): del arg[:]
def del_arg(self, name: str) -> None: """Delete all arguments with the given then.""" for arg in reversed(self.arguments): if arg.name.strip(WS) == name.strip(WS): del arg[:]
[ "Delete", "all", "arguments", "with", "the", "given", "then", "." ]
5j9/wikitextparser
python
https://github.com/5j9/wikitextparser/blob/1347425814361d7955342c53212edbb27f0ff4b5/wikitextparser/_template.py#L316-L320
[ "def", "del_arg", "(", "self", ",", "name", ":", "str", ")", "->", "None", ":", "for", "arg", "in", "reversed", "(", "self", ".", "arguments", ")", ":", "if", "arg", ".", "name", ".", "strip", "(", "WS", ")", "==", "name", ".", "strip", "(", "W...
1347425814361d7955342c53212edbb27f0ff4b5
test
build_crs_table
Build crs table of all equivalent format variations by scraping spatialreference.org. Saves table as tab-delimited text file. NOTE: Might take a while. Arguments: - *savepath*: The absolute or relative filepath to which to save the crs table, including the ".txt" extension.
pycrs/utils.py
def build_crs_table(savepath): """ Build crs table of all equivalent format variations by scraping spatialreference.org. Saves table as tab-delimited text file. NOTE: Might take a while. Arguments: - *savepath*: The absolute or relative filepath to which to save the crs table, including the "....
def build_crs_table(savepath): """ Build crs table of all equivalent format variations by scraping spatialreference.org. Saves table as tab-delimited text file. NOTE: Might take a while. Arguments: - *savepath*: The absolute or relative filepath to which to save the crs table, including the "....
[ "Build", "crs", "table", "of", "all", "equivalent", "format", "variations", "by", "scraping", "spatialreference", ".", "org", ".", "Saves", "table", "as", "tab", "-", "delimited", "text", "file", ".", "NOTE", ":", "Might", "take", "a", "while", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/utils.py#L11-L69
[ "def", "build_crs_table", "(", "savepath", ")", ":", "# create table", "outfile", "=", "open", "(", "savepath", ",", "\"wb\"", ")", "# create fields", "fields", "=", "[", "\"codetype\"", ",", "\"code\"", ",", "\"proj4\"", ",", "\"ogcwkt\"", ",", "\"esriwkt\"", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
crscode_to_string
Lookup crscode on spatialreference.org and return in specified format. Arguments: - *codetype*: "epsg", "esri", or "sr-org". - *code*: The code. - *format*: The crs format of the returned string. One of "ogcwkt", "esriwkt", or "proj4", but also several others... Returns: - Crs string in the ...
pycrs/utils.py
def crscode_to_string(codetype, code, format): """ Lookup crscode on spatialreference.org and return in specified format. Arguments: - *codetype*: "epsg", "esri", or "sr-org". - *code*: The code. - *format*: The crs format of the returned string. One of "ogcwkt", "esriwkt", or "proj4", but als...
def crscode_to_string(codetype, code, format): """ Lookup crscode on spatialreference.org and return in specified format. Arguments: - *codetype*: "epsg", "esri", or "sr-org". - *code*: The code. - *format*: The crs format of the returned string. One of "ogcwkt", "esriwkt", or "proj4", but als...
[ "Lookup", "crscode", "on", "spatialreference", ".", "org", "and", "return", "in", "specified", "format", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/utils.py#L72-L90
[ "def", "crscode_to_string", "(", "codetype", ",", "code", ",", "format", ")", ":", "link", "=", "'http://spatialreference.org/ref/%s/%s/%s/'", "%", "(", "codetype", ",", "code", ",", "format", ")", "result", "=", "urllib2", ".", "urlopen", "(", "link", ")", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
GeogCS.to_proj4
Returns the CS as a proj4 formatted string or dict. Arguments: - **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False). - **toplevel** (optional): If True, treats this CS as the final toplevel CS and adds the necessary proj4 elements (defaults to True).
pycrs/elements/cs.py
def to_proj4(self, as_dict=False, toplevel=True): """ Returns the CS as a proj4 formatted string or dict. Arguments: - **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False). - **toplevel** (optional): If True, treats this CS as the final toplev...
def to_proj4(self, as_dict=False, toplevel=True): """ Returns the CS as a proj4 formatted string or dict. Arguments: - **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False). - **toplevel** (optional): If True, treats this CS as the final toplev...
[ "Returns", "the", "CS", "as", "a", "proj4", "formatted", "string", "or", "dict", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/cs.py#L66-L88
[ "def", "to_proj4", "(", "self", ",", "as_dict", "=", "False", ",", "toplevel", "=", "True", ")", ":", "# dont parse axis to proj4, because in proj4, axis only applies to the cs, ie the projcs (not the geogcs, where wkt can specify with axis)", "# also proj4 cannot specify angular units...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
GeogCS.to_ogc_wkt
Returns the CS as a OGC WKT formatted string.
pycrs/elements/cs.py
def to_ogc_wkt(self): """ Returns the CS as a OGC WKT formatted string. """ return 'GEOGCS["%s", %s, %s, %s, AXIS["Lon", %s], AXIS["Lat", %s]]' % (self.name, self.datum.to_ogc_wkt(), self.prime_mer.to_ogc_wkt(), self.angunit.to_ogc_wkt(), self.twin_ax[0].ogc_wkt, self.twin_ax[1].ogc_wkt ...
def to_ogc_wkt(self): """ Returns the CS as a OGC WKT formatted string. """ return 'GEOGCS["%s", %s, %s, %s, AXIS["Lon", %s], AXIS["Lat", %s]]' % (self.name, self.datum.to_ogc_wkt(), self.prime_mer.to_ogc_wkt(), self.angunit.to_ogc_wkt(), self.twin_ax[0].ogc_wkt, self.twin_ax[1].ogc_wkt ...
[ "Returns", "the", "CS", "as", "a", "OGC", "WKT", "formatted", "string", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/cs.py#L90-L94
[ "def", "to_ogc_wkt", "(", "self", ")", ":", "return", "'GEOGCS[\"%s\", %s, %s, %s, AXIS[\"Lon\", %s], AXIS[\"Lat\", %s]]'", "%", "(", "self", ".", "name", ",", "self", ".", "datum", ".", "to_ogc_wkt", "(", ")", ",", "self", ".", "prime_mer", ".", "to_ogc_wkt", "...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
GeogCS.to_esri_wkt
Returns the CS as a ESRI WKT formatted string.
pycrs/elements/cs.py
def to_esri_wkt(self): """ Returns the CS as a ESRI WKT formatted string. """ return 'GEOGCS["%s", %s, %s, %s, AXIS["Lon", %s], AXIS["Lat", %s]]' % (self.name, self.datum.to_esri_wkt(), self.prime_mer.to_esri_wkt(), self.angunit.to_esri_wkt(), self.twin_ax[0].esri_wkt, self.twin_ax[1].es...
def to_esri_wkt(self): """ Returns the CS as a ESRI WKT formatted string. """ return 'GEOGCS["%s", %s, %s, %s, AXIS["Lon", %s], AXIS["Lat", %s]]' % (self.name, self.datum.to_esri_wkt(), self.prime_mer.to_esri_wkt(), self.angunit.to_esri_wkt(), self.twin_ax[0].esri_wkt, self.twin_ax[1].es...
[ "Returns", "the", "CS", "as", "a", "ESRI", "WKT", "formatted", "string", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/cs.py#L96-L100
[ "def", "to_esri_wkt", "(", "self", ")", ":", "return", "'GEOGCS[\"%s\", %s, %s, %s, AXIS[\"Lon\", %s], AXIS[\"Lat\", %s]]'", "%", "(", "self", ".", "name", ",", "self", ".", "datum", ".", "to_esri_wkt", "(", ")", ",", "self", ".", "prime_mer", ".", "to_esri_wkt", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
ProjCS.to_proj4
Returns the CS as a proj4 formatted string or dict. Arguments: - **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False).
pycrs/elements/cs.py
def to_proj4(self, as_dict=False): """ Returns the CS as a proj4 formatted string or dict. Arguments: - **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False). """ string = "%s" % self.proj.to_proj4() string += " %s" % self.geogc...
def to_proj4(self, as_dict=False): """ Returns the CS as a proj4 formatted string or dict. Arguments: - **as_dict** (optional): If True, returns the proj4 string as a dict (defaults to False). """ string = "%s" % self.proj.to_proj4() string += " %s" % self.geogc...
[ "Returns", "the", "CS", "as", "a", "proj4", "formatted", "string", "or", "dict", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/cs.py#L147-L169
[ "def", "to_proj4", "(", "self", ",", "as_dict", "=", "False", ")", ":", "string", "=", "\"%s\"", "%", "self", ".", "proj", ".", "to_proj4", "(", ")", "string", "+=", "\" %s\"", "%", "self", ".", "geogcs", ".", "to_proj4", "(", "toplevel", "=", "False...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
ProjCS.to_ogc_wkt
Returns the CS as a OGC WKT formatted string.
pycrs/elements/cs.py
def to_ogc_wkt(self): """ Returns the CS as a OGC WKT formatted string. """ string = 'PROJCS["%s", %s, %s, ' % (self.name, self.geogcs.to_ogc_wkt(), self.proj.to_ogc_wkt() ) string += ", ".join(param.to_ogc_wkt() for param in self.params) string += ', %s' % self.unit.to_o...
def to_ogc_wkt(self): """ Returns the CS as a OGC WKT formatted string. """ string = 'PROJCS["%s", %s, %s, ' % (self.name, self.geogcs.to_ogc_wkt(), self.proj.to_ogc_wkt() ) string += ", ".join(param.to_ogc_wkt() for param in self.params) string += ', %s' % self.unit.to_o...
[ "Returns", "the", "CS", "as", "a", "OGC", "WKT", "formatted", "string", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/cs.py#L171-L179
[ "def", "to_ogc_wkt", "(", "self", ")", ":", "string", "=", "'PROJCS[\"%s\", %s, %s, '", "%", "(", "self", ".", "name", ",", "self", ".", "geogcs", ".", "to_ogc_wkt", "(", ")", ",", "self", ".", "proj", ".", "to_ogc_wkt", "(", ")", ")", "string", "+=", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
ProjCS.to_esri_wkt
Returns the CS as a ESRI WKT formatted string.
pycrs/elements/cs.py
def to_esri_wkt(self): """ Returns the CS as a ESRI WKT formatted string. """ string = 'PROJCS["%s", %s, %s, ' % (self.name, self.geogcs.to_esri_wkt(), self.proj.to_esri_wkt() ) string += ", ".join(param.to_esri_wkt() for param in self.params) string += ', %s' % self.unit...
def to_esri_wkt(self): """ Returns the CS as a ESRI WKT formatted string. """ string = 'PROJCS["%s", %s, %s, ' % (self.name, self.geogcs.to_esri_wkt(), self.proj.to_esri_wkt() ) string += ", ".join(param.to_esri_wkt() for param in self.params) string += ', %s' % self.unit...
[ "Returns", "the", "CS", "as", "a", "ESRI", "WKT", "formatted", "string", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/cs.py#L181-L189
[ "def", "to_esri_wkt", "(", "self", ")", ":", "string", "=", "'PROJCS[\"%s\", %s, %s, '", "%", "(", "self", ".", "name", ",", "self", ".", "geogcs", ".", "to_esri_wkt", "(", ")", ",", "self", ".", "proj", ".", "to_esri_wkt", "(", ")", ")", "string", "+=...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
find
Search for a ellipsoid name located in this module. Arguments: - **ellipsname**: The ellipsoid name to search for. - **crstype**: Which CRS naming convention to search (different CRS formats have different names for the same ellipsoid). - **strict** (optional): If False, ignores minor name mis...
pycrs/elements/ellipsoids.py
def find(ellipsname, crstype, strict=False): """ Search for a ellipsoid name located in this module. Arguments: - **ellipsname**: The ellipsoid name to search for. - **crstype**: Which CRS naming convention to search (different CRS formats have different names for the same ellipsoid). ...
def find(ellipsname, crstype, strict=False): """ Search for a ellipsoid name located in this module. Arguments: - **ellipsname**: The ellipsoid name to search for. - **crstype**: Which CRS naming convention to search (different CRS formats have different names for the same ellipsoid). ...
[ "Search", "for", "a", "ellipsoid", "name", "located", "in", "this", "module", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/elements/ellipsoids.py#L8-L36
[ "def", "find", "(", "ellipsname", ",", "crstype", ",", "strict", "=", "False", ")", ":", "if", "not", "strict", ":", "ellipsname", "=", "ellipsname", ".", "lower", "(", ")", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", "for", "itemname", ",", "it...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_url
Returns the crs object from a string interpreted as a specified format, located at a given url site. Arguments: - *url*: The url where the crs string is to be read from. - *format* (optional): Which format to parse the crs string as. One of "ogc wkt", "esri wkt", or "proj4". If None, tries to aut...
pycrs/load.py
def from_url(url, format=None): """ Returns the crs object from a string interpreted as a specified format, located at a given url site. Arguments: - *url*: The url where the crs string is to be read from. - *format* (optional): Which format to parse the crs string as. One of "ogc wkt", "esri wkt...
def from_url(url, format=None): """ Returns the crs object from a string interpreted as a specified format, located at a given url site. Arguments: - *url*: The url where the crs string is to be read from. - *format* (optional): Which format to parse the crs string as. One of "ogc wkt", "esri wkt...
[ "Returns", "the", "crs", "object", "from", "a", "string", "interpreted", "as", "a", "specified", "format", "located", "at", "a", "given", "url", "site", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/load.py#L22-L54
[ "def", "from_url", "(", "url", ",", "format", "=", "None", ")", ":", "# first get string from url", "string", "=", "urllib2", ".", "urlopen", "(", "url", ")", ".", "read", "(", ")", "if", "PY3", "is", "True", ":", "# decode str into string", "string", "=",...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_file
Returns the crs object from a file, with the format determined from the filename extension. Arguments: - *filepath*: filepath to be loaded, including extension.
pycrs/load.py
def from_file(filepath): """ Returns the crs object from a file, with the format determined from the filename extension. Arguments: - *filepath*: filepath to be loaded, including extension. """ if filepath.endswith(".prj"): string = open(filepath, "r").read() return parse.from...
def from_file(filepath): """ Returns the crs object from a file, with the format determined from the filename extension. Arguments: - *filepath*: filepath to be loaded, including extension. """ if filepath.endswith(".prj"): string = open(filepath, "r").read() return parse.from...
[ "Returns", "the", "crs", "object", "from", "a", "file", "with", "the", "format", "determined", "from", "the", "filename", "extension", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/load.py#L56-L87
[ "def", "from_file", "(", "filepath", ")", ":", "if", "filepath", ".", "endswith", "(", "\".prj\"", ")", ":", "string", "=", "open", "(", "filepath", ",", "\"r\"", ")", ".", "read", "(", ")", "return", "parse", ".", "from_unknown_wkt", "(", "string", ")...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_epsg_code
Load crs object from epsg code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The EPSG code as an integer. Returns: - A CS instance of the indicated type.
pycrs/parse.py
def from_epsg_code(code): """ Load crs object from epsg code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The EPSG code as an integer. Returns: - A CS instance of the indicated type. """ # must go online (or look up local table) to ge...
def from_epsg_code(code): """ Load crs object from epsg code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The EPSG code as an integer. Returns: - A CS instance of the indicated type. """ # must go online (or look up local table) to ge...
[ "Load", "crs", "object", "from", "epsg", "code", "via", "spatialreference", ".", "org", ".", "Parses", "based", "on", "the", "proj4", "representation", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L24-L41
[ "def", "from_epsg_code", "(", "code", ")", ":", "# must go online (or look up local table) to get crs details", "code", "=", "str", "(", "code", ")", "proj4", "=", "utils", ".", "crscode_to_string", "(", "\"epsg\"", ",", "code", ",", "\"proj4\"", ")", "crs", "=", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_esri_code
Load crs object from esri code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The ESRI code as an integer. Returns: - A CS instance of the indicated type.
pycrs/parse.py
def from_esri_code(code): """ Load crs object from esri code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The ESRI code as an integer. Returns: - A CS instance of the indicated type. """ # must go online (or look up local table) to ge...
def from_esri_code(code): """ Load crs object from esri code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The ESRI code as an integer. Returns: - A CS instance of the indicated type. """ # must go online (or look up local table) to ge...
[ "Load", "crs", "object", "from", "esri", "code", "via", "spatialreference", ".", "org", ".", "Parses", "based", "on", "the", "proj4", "representation", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L43-L60
[ "def", "from_esri_code", "(", "code", ")", ":", "# must go online (or look up local table) to get crs details", "code", "=", "str", "(", "code", ")", "proj4", "=", "utils", ".", "crscode_to_string", "(", "\"esri\"", ",", "code", ",", "\"proj4\"", ")", "crs", "=", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_sr_code
Load crs object from sr-org code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The SR-ORG code as an integer. Returns: - A CS instance of the indicated type.
pycrs/parse.py
def from_sr_code(code): """ Load crs object from sr-org code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The SR-ORG code as an integer. Returns: - A CS instance of the indicated type. """ # must go online (or look up local table) to ...
def from_sr_code(code): """ Load crs object from sr-org code, via spatialreference.org. Parses based on the proj4 representation. Arguments: - *code*: The SR-ORG code as an integer. Returns: - A CS instance of the indicated type. """ # must go online (or look up local table) to ...
[ "Load", "crs", "object", "from", "sr", "-", "org", "code", "via", "spatialreference", ".", "org", ".", "Parses", "based", "on", "the", "proj4", "representation", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L62-L79
[ "def", "from_sr_code", "(", "code", ")", ":", "# must go online (or look up local table) to get crs details", "code", "=", "str", "(", "code", ")", "proj4", "=", "utils", ".", "crscode_to_string", "(", "\"sr-org\"", ",", "code", ",", "\"proj4\"", ")", "crs", "=", ...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
_from_wkt
Internal method for parsing wkt, with minor differences depending on ogc or esri style. Arguments: - *string*: The OGC or ESRI WKT representation as a string. - *wkttype* (optional): How to parse the WKT string, as either 'ogc', 'esri', or None. If None, tries to autodetect the wkt type before parsing (de...
pycrs/parse.py
def _from_wkt(string, wkttype=None, strict=False): """ Internal method for parsing wkt, with minor differences depending on ogc or esri style. Arguments: - *string*: The OGC or ESRI WKT representation as a string. - *wkttype* (optional): How to parse the WKT string, as either 'ogc', 'esri', or Non...
def _from_wkt(string, wkttype=None, strict=False): """ Internal method for parsing wkt, with minor differences depending on ogc or esri style. Arguments: - *string*: The OGC or ESRI WKT representation as a string. - *wkttype* (optional): How to parse the WKT string, as either 'ogc', 'esri', or Non...
[ "Internal", "method", "for", "parsing", "wkt", "with", "minor", "differences", "depending", "on", "ogc", "or", "esri", "style", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L134-L418
[ "def", "_from_wkt", "(", "string", ",", "wkttype", "=", "None", ",", "strict", "=", "False", ")", ":", "# TODO", "# - Make function for finding next elemt by name, instead of knowing its arg index position", "# - Maybe verify elem arg name", "# make sure valid wkttype", "if", "...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_proj4
Parse crs as proj4 formatted string or dict and return the resulting crs object. Arguments: - *proj4*: The proj4 representation as a string or dict. - *strict* (optional): When True, the parser is strict about names having to match exactly with upper and lowercases. Default is not strict (False). ...
pycrs/parse.py
def from_proj4(proj4, strict=False): """ Parse crs as proj4 formatted string or dict and return the resulting crs object. Arguments: - *proj4*: The proj4 representation as a string or dict. - *strict* (optional): When True, the parser is strict about names having to match exactly with uppe...
def from_proj4(proj4, strict=False): """ Parse crs as proj4 formatted string or dict and return the resulting crs object. Arguments: - *proj4*: The proj4 representation as a string or dict. - *strict* (optional): When True, the parser is strict about names having to match exactly with uppe...
[ "Parse", "crs", "as", "proj4", "formatted", "string", "or", "dict", "and", "return", "the", "resulting", "crs", "object", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L420-L708
[ "def", "from_proj4", "(", "proj4", ",", "strict", "=", "False", ")", ":", "# parse arguments into components", "# use args to create crs", "# TODO: SLIGTHLY MESSY STILL, CLEANUP..", "params", "=", "[", "]", "if", "isinstance", "(", "proj4", ",", "dict", ")", ":", "#...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
from_unknown_text
Detect crs string format and parse into crs object with appropriate function. Arguments: - *text*: The crs text representation of unknown type. - *strict* (optional): When True, the parser is strict about names having to match exactly with upper and lowercases. Default is not strict (False). ...
pycrs/parse.py
def from_unknown_text(text, strict=False): """ Detect crs string format and parse into crs object with appropriate function. Arguments: - *text*: The crs text representation of unknown type. - *strict* (optional): When True, the parser is strict about names having to match exactly with up...
def from_unknown_text(text, strict=False): """ Detect crs string format and parse into crs object with appropriate function. Arguments: - *text*: The crs text representation of unknown type. - *strict* (optional): When True, the parser is strict about names having to match exactly with up...
[ "Detect", "crs", "string", "format", "and", "parse", "into", "crs", "object", "with", "appropriate", "function", "." ]
karimbahgat/PyCRS
python
https://github.com/karimbahgat/PyCRS/blob/d6a8bb9c28787a25b4a1d59a7e4603db3221eaef/pycrs/parse.py#L736-L771
[ "def", "from_unknown_text", "(", "text", ",", "strict", "=", "False", ")", ":", "if", "text", ".", "startswith", "(", "\"+\"", ")", ":", "crs", "=", "from_proj4", "(", "text", ",", "strict", ")", "elif", "text", ".", "startswith", "(", "(", "\"PROJCS[\...
d6a8bb9c28787a25b4a1d59a7e4603db3221eaef
test
RawVLR.write_to
Write the raw header content to the out stream Parameters: ---------- out : {file object} The output stream
pylas/vlrs/rawvlr.py
def write_to(self, out): """ Write the raw header content to the out stream Parameters: ---------- out : {file object} The output stream """ out.write(bytes(self.header)) out.write(self.record_data)
def write_to(self, out): """ Write the raw header content to the out stream Parameters: ---------- out : {file object} The output stream """ out.write(bytes(self.header)) out.write(self.record_data)
[ "Write", "the", "raw", "header", "content", "to", "the", "out", "stream" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/rawvlr.py#L60-L70
[ "def", "write_to", "(", "self", ",", "out", ")", ":", "out", ".", "write", "(", "bytes", "(", "self", ".", "header", ")", ")", "out", ".", "write", "(", "self", ".", "record_data", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawVLR.read_from
Instantiate a RawVLR by reading the content from the data stream Parameters: ---------- data_stream : {file object} The input stream Returns ------- RawVLR The RawVLR read
pylas/vlrs/rawvlr.py
def read_from(cls, data_stream): """ Instantiate a RawVLR by reading the content from the data stream Parameters: ---------- data_stream : {file object} The input stream Returns ------- RawVLR The RawVLR read """ r...
def read_from(cls, data_stream): """ Instantiate a RawVLR by reading the content from the data stream Parameters: ---------- data_stream : {file object} The input stream Returns ------- RawVLR The RawVLR read """ r...
[ "Instantiate", "a", "RawVLR", "by", "reading", "the", "content", "from", "the", "data", "stream" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/rawvlr.py#L73-L91
[ "def", "read_from", "(", "cls", ",", "data_stream", ")", ":", "raw_vlr", "=", "cls", "(", ")", "header", "=", "RawVLRHeader", ".", "from_stream", "(", "data_stream", ")", "raw_vlr", ".", "header", "=", "header", "raw_vlr", ".", "record_data", "=", "data_st...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
parse_geo_tiff_keys_from_vlrs
Gets the 3 GeoTiff vlrs from the vlr_list and parse them into a nicer structure Parameters ---------- vlr_list: pylas.vrls.vlrslist.VLRList list of vlrs from a las file Raises ------ IndexError if any of the needed GeoTiffVLR is not found in the list Returns ------- List o...
pylas/vlrs/geotiff.py
def parse_geo_tiff_keys_from_vlrs(vlr_list: vlrlist.VLRList) -> List[GeoTiffKey]: """ Gets the 3 GeoTiff vlrs from the vlr_list and parse them into a nicer structure Parameters ---------- vlr_list: pylas.vrls.vlrslist.VLRList list of vlrs from a las file Raises ------ IndexError if...
def parse_geo_tiff_keys_from_vlrs(vlr_list: vlrlist.VLRList) -> List[GeoTiffKey]: """ Gets the 3 GeoTiff vlrs from the vlr_list and parse them into a nicer structure Parameters ---------- vlr_list: pylas.vrls.vlrslist.VLRList list of vlrs from a las file Raises ------ IndexError if...
[ "Gets", "the", "3", "GeoTiff", "vlrs", "from", "the", "vlr_list", "and", "parse", "them", "into", "a", "nicer", "structure" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/geotiff.py#L23-L49
[ "def", "parse_geo_tiff_keys_from_vlrs", "(", "vlr_list", ":", "vlrlist", ".", "VLRList", ")", "->", "List", "[", "GeoTiffKey", "]", ":", "geo_key_dir", "=", "vlr_list", ".", "get_by_id", "(", "GeoKeyDirectoryVlr", ".", "official_user_id", "(", ")", ",", "GeoKeyD...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
parse_geo_tiff
Parses the GeoTiff VLRs information into nicer structs
pylas/vlrs/geotiff.py
def parse_geo_tiff( key_dir_vlr: GeoKeyDirectoryVlr, double_vlr: GeoDoubleParamsVlr, ascii_vlr: GeoAsciiParamsVlr, ) -> List[GeoTiffKey]: """ Parses the GeoTiff VLRs information into nicer structs """ geotiff_keys = [] for k in key_dir_vlr.geo_keys: if k.tiff_tag_location == 0: ...
def parse_geo_tiff( key_dir_vlr: GeoKeyDirectoryVlr, double_vlr: GeoDoubleParamsVlr, ascii_vlr: GeoAsciiParamsVlr, ) -> List[GeoTiffKey]: """ Parses the GeoTiff VLRs information into nicer structs """ geotiff_keys = [] for k in key_dir_vlr.geo_keys: if k.tiff_tag_location == 0: ...
[ "Parses", "the", "GeoTiff", "VLRs", "information", "into", "nicer", "structs" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/geotiff.py#L52-L81
[ "def", "parse_geo_tiff", "(", "key_dir_vlr", ":", "GeoKeyDirectoryVlr", ",", "double_vlr", ":", "GeoDoubleParamsVlr", ",", "ascii_vlr", ":", "GeoAsciiParamsVlr", ",", ")", "->", "List", "[", "GeoTiffKey", "]", ":", "geotiff_keys", "=", "[", "]", "for", "k", "i...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
get_signedness_for_extra_dim
Returns the signedness foe the given type index Parameters ---------- type_index: int index of the type as defined in the LAS Specification Returns ------- DimensionSignedness, the enum variant
pylas/extradims.py
def get_signedness_for_extra_dim(type_index): """ Returns the signedness foe the given type index Parameters ---------- type_index: int index of the type as defined in the LAS Specification Returns ------- DimensionSignedness, the enum variant """ try: t = _...
def get_signedness_for_extra_dim(type_index): """ Returns the signedness foe the given type index Parameters ---------- type_index: int index of the type as defined in the LAS Specification Returns ------- DimensionSignedness, the enum variant """ try: t = _...
[ "Returns", "the", "signedness", "foe", "the", "given", "type", "index" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/extradims.py#L67-L89
[ "def", "get_signedness_for_extra_dim", "(", "type_index", ")", ":", "try", ":", "t", "=", "_extra_dims_style_2", "[", "type_index", "]", "if", "\"uint\"", "in", "t", ":", "return", "DimensionSignedness", ".", "UNSIGNED", "elif", "\"int\"", "in", "t", ":", "ret...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
get_id_for_extra_dim_type
Returns the index of the type as defined in the LAS Specification Parameters ---------- type_str: str Returns ------- int index of the type
pylas/extradims.py
def get_id_for_extra_dim_type(type_str): """ Returns the index of the type as defined in the LAS Specification Parameters ---------- type_str: str Returns ------- int index of the type """ try: return _type_to_extra_dim_id_style_1[type_str] except KeyError: ...
def get_id_for_extra_dim_type(type_str): """ Returns the index of the type as defined in the LAS Specification Parameters ---------- type_str: str Returns ------- int index of the type """ try: return _type_to_extra_dim_id_style_1[type_str] except KeyError: ...
[ "Returns", "the", "index", "of", "the", "type", "as", "defined", "in", "the", "LAS", "Specification" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/extradims.py#L111-L130
[ "def", "get_id_for_extra_dim_type", "(", "type_str", ")", ":", "try", ":", "return", "_type_to_extra_dim_id_style_1", "[", "type_str", "]", "except", "KeyError", ":", "try", ":", "return", "_type_to_extra_dim_id_style_2", "[", "type_str", "]", "except", "KeyError", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PointRecord.from_point_record
Construct a new PackedPointRecord from an existing one with the ability to change to point format while doing so
pylas/point/record.py
def from_point_record(cls, other_point_record, new_point_format): """ Construct a new PackedPointRecord from an existing one with the ability to change to point format while doing so """ array = np.zeros_like(other_point_record.array, dtype=new_point_format.dtype) new_record = c...
def from_point_record(cls, other_point_record, new_point_format): """ Construct a new PackedPointRecord from an existing one with the ability to change to point format while doing so """ array = np.zeros_like(other_point_record.array, dtype=new_point_format.dtype) new_record = c...
[ "Construct", "a", "new", "PackedPointRecord", "from", "an", "existing", "one", "with", "the", "ability", "to", "change", "to", "point", "format", "while", "doing", "so" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L121-L128
[ "def", "from_point_record", "(", "cls", ",", "other_point_record", ",", "new_point_format", ")", ":", "array", "=", "np", ".", "zeros_like", "(", "other_point_record", ".", "array", ",", "dtype", "=", "new_point_format", ".", "dtype", ")", "new_record", "=", "...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PointRecord.copy_fields_from
Tries to copy the values of the current dimensions from other_record
pylas/point/record.py
def copy_fields_from(self, other_record): """ Tries to copy the values of the current dimensions from other_record """ for dim_name in self.dimensions_names: try: self[dim_name] = other_record[dim_name] except ValueError: pass
def copy_fields_from(self, other_record): """ Tries to copy the values of the current dimensions from other_record """ for dim_name in self.dimensions_names: try: self[dim_name] = other_record[dim_name] except ValueError: pass
[ "Tries", "to", "copy", "the", "values", "of", "the", "current", "dimensions", "from", "other_record" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L130-L137
[ "def", "copy_fields_from", "(", "self", ",", "other_record", ")", ":", "for", "dim_name", "in", "self", ".", "dimensions_names", ":", "try", ":", "self", "[", "dim_name", "]", "=", "other_record", "[", "dim_name", "]", "except", "ValueError", ":", "pass" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PointRecord._append_zeros_if_too_small
Appends zeros to the points stored if the value we are trying to fit is bigger
pylas/point/record.py
def _append_zeros_if_too_small(self, value): """ Appends zeros to the points stored if the value we are trying to fit is bigger """ size_diff = len(value) - len(self.array) if size_diff: self.array = np.append( self.array, np.zeros(size_diff, dtype=sel...
def _append_zeros_if_too_small(self, value): """ Appends zeros to the points stored if the value we are trying to fit is bigger """ size_diff = len(value) - len(self.array) if size_diff: self.array = np.append( self.array, np.zeros(size_diff, dtype=sel...
[ "Appends", "zeros", "to", "the", "points", "stored", "if", "the", "value", "we", "are", "trying", "to", "fit", "is", "bigger" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L155-L163
[ "def", "_append_zeros_if_too_small", "(", "self", ",", "value", ")", ":", "size_diff", "=", "len", "(", "value", ")", "-", "len", "(", "self", ".", "array", ")", "if", "size_diff", ":", "self", ".", "array", "=", "np", ".", "append", "(", "self", "."...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PackedPointRecord.all_dimensions_names
Returns all the dimensions names, including the names of sub_fields and their corresponding packed fields
pylas/point/record.py
def all_dimensions_names(self): """ Returns all the dimensions names, including the names of sub_fields and their corresponding packed fields """ return frozenset(self.array.dtype.names + tuple(self.sub_fields_dict.keys()))
def all_dimensions_names(self): """ Returns all the dimensions names, including the names of sub_fields and their corresponding packed fields """ return frozenset(self.array.dtype.names + tuple(self.sub_fields_dict.keys()))
[ "Returns", "all", "the", "dimensions", "names", "including", "the", "names", "of", "sub_fields", "and", "their", "corresponding", "packed", "fields" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L199-L203
[ "def", "all_dimensions_names", "(", "self", ")", ":", "return", "frozenset", "(", "self", ".", "array", ".", "dtype", ".", "names", "+", "tuple", "(", "self", ".", "sub_fields_dict", ".", "keys", "(", ")", ")", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PackedPointRecord.zeros
Creates a new point record with all dimensions initialized to zero Parameters ---------- point_format_id: int The point format id the point record should have point_count : int The number of point the point record should have Returns ------- ...
pylas/point/record.py
def zeros(cls, point_format, point_count): """ Creates a new point record with all dimensions initialized to zero Parameters ---------- point_format_id: int The point format id the point record should have point_count : int The number of point the point r...
def zeros(cls, point_format, point_count): """ Creates a new point record with all dimensions initialized to zero Parameters ---------- point_format_id: int The point format id the point record should have point_count : int The number of point the point r...
[ "Creates", "a", "new", "point", "record", "with", "all", "dimensions", "initialized", "to", "zero" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L218-L234
[ "def", "zeros", "(", "cls", ",", "point_format", ",", "point_count", ")", ":", "data", "=", "np", ".", "zeros", "(", "point_count", ",", "point_format", ".", "dtype", ")", "return", "cls", "(", "data", ",", "point_format", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PackedPointRecord.from_stream
Construct the point record by reading the points from the stream
pylas/point/record.py
def from_stream(cls, stream, point_format, count): """ Construct the point record by reading the points from the stream """ points_dtype = point_format.dtype point_data_buffer = bytearray(stream.read(count * points_dtype.itemsize)) try: data = np.frombuffer(point_dat...
def from_stream(cls, stream, point_format, count): """ Construct the point record by reading the points from the stream """ points_dtype = point_format.dtype point_data_buffer = bytearray(stream.read(count * points_dtype.itemsize)) try: data = np.frombuffer(point_dat...
[ "Construct", "the", "point", "record", "by", "reading", "the", "points", "from", "the", "stream" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L253-L282
[ "def", "from_stream", "(", "cls", ",", "stream", ",", "point_format", ",", "count", ")", ":", "points_dtype", "=", "point_format", ".", "dtype", "point_data_buffer", "=", "bytearray", "(", "stream", ".", "read", "(", "count", "*", "points_dtype", ".", "items...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
PackedPointRecord.from_compressed_buffer
Construct the point record by reading and decompressing the points data from the input buffer
pylas/point/record.py
def from_compressed_buffer(cls, compressed_buffer, point_format, count, laszip_vlr): """ Construct the point record by reading and decompressing the points data from the input buffer """ point_dtype = point_format.dtype uncompressed = decompress_buffer( compressed_bu...
def from_compressed_buffer(cls, compressed_buffer, point_format, count, laszip_vlr): """ Construct the point record by reading and decompressing the points data from the input buffer """ point_dtype = point_format.dtype uncompressed = decompress_buffer( compressed_bu...
[ "Construct", "the", "point", "record", "by", "reading", "and", "decompressing", "the", "points", "data", "from", "the", "input", "buffer" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/record.py#L292-L300
[ "def", "from_compressed_buffer", "(", "cls", ",", "compressed_buffer", ",", "point_format", ",", "count", ",", "laszip_vlr", ")", ":", "point_dtype", "=", "point_format", ".", "dtype", "uncompressed", "=", "decompress_buffer", "(", "compressed_buffer", ",", "point_d...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.x
Returns the scaled x positions of the points as doubles
pylas/lasdatas/base.py
def x(self): """ Returns the scaled x positions of the points as doubles """ return scale_dimension(self.X, self.header.x_scale, self.header.x_offset)
def x(self): """ Returns the scaled x positions of the points as doubles """ return scale_dimension(self.X, self.header.x_scale, self.header.x_offset)
[ "Returns", "the", "scaled", "x", "positions", "of", "the", "points", "as", "doubles" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L60-L63
[ "def", "x", "(", "self", ")", ":", "return", "scale_dimension", "(", "self", ".", "X", ",", "self", ".", "header", ".", "x_scale", ",", "self", ".", "header", ".", "x_offset", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.y
Returns the scaled y positions of the points as doubles
pylas/lasdatas/base.py
def y(self): """ Returns the scaled y positions of the points as doubles """ return scale_dimension(self.Y, self.header.y_scale, self.header.y_offset)
def y(self): """ Returns the scaled y positions of the points as doubles """ return scale_dimension(self.Y, self.header.y_scale, self.header.y_offset)
[ "Returns", "the", "scaled", "y", "positions", "of", "the", "points", "as", "doubles" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L66-L69
[ "def", "y", "(", "self", ")", ":", "return", "scale_dimension", "(", "self", ".", "Y", ",", "self", ".", "header", ".", "y_scale", ",", "self", ".", "header", ".", "y_offset", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.z
Returns the scaled z positions of the points as doubles
pylas/lasdatas/base.py
def z(self): """ Returns the scaled z positions of the points as doubles """ return scale_dimension(self.Z, self.header.z_scale, self.header.z_offset)
def z(self): """ Returns the scaled z positions of the points as doubles """ return scale_dimension(self.Z, self.header.z_scale, self.header.z_offset)
[ "Returns", "the", "scaled", "z", "positions", "of", "the", "points", "as", "doubles" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L72-L75
[ "def", "z", "(", "self", ")", ":", "return", "scale_dimension", "(", "self", ".", "Z", ",", "self", ".", "header", ".", "z_scale", ",", "self", ".", "header", ".", "z_offset", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.points
Setter for the points property, Takes care of changing the point_format of the file (as long as the point format of the new points it compatible with the file version) Parameters ---------- value: numpy.array of the new points
pylas/lasdatas/base.py
def points(self, value): """ Setter for the points property, Takes care of changing the point_format of the file (as long as the point format of the new points it compatible with the file version) Parameters ---------- value: numpy.array of the new points """ ...
def points(self, value): """ Setter for the points property, Takes care of changing the point_format of the file (as long as the point format of the new points it compatible with the file version) Parameters ---------- value: numpy.array of the new points """ ...
[ "Setter", "for", "the", "points", "property", "Takes", "care", "of", "changing", "the", "point_format", "of", "the", "file", "(", "as", "long", "as", "the", "point", "format", "of", "the", "new", "points", "it", "compatible", "with", "the", "file", "versio...
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L126-L143
[ "def", "points", "(", "self", ",", "value", ")", ":", "if", "value", ".", "dtype", "!=", "self", ".", "points", ".", "dtype", ":", "raise", "errors", ".", "IncompatibleDataFormat", "(", "'Cannot set points with a different point format, convert first'", ")", "new_...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.add_extra_dim
Adds a new extra dimension to the point record Parameters ---------- name: str the name of the dimension type: str type of the dimension (eg 'uint8') description: str, optional a small description of the dimension
pylas/lasdatas/base.py
def add_extra_dim(self, name, type, description=""): """ Adds a new extra dimension to the point record Parameters ---------- name: str the name of the dimension type: str type of the dimension (eg 'uint8') description: str, optional a...
def add_extra_dim(self, name, type, description=""): """ Adds a new extra dimension to the point record Parameters ---------- name: str the name of the dimension type: str type of the dimension (eg 'uint8') description: str, optional a...
[ "Adds", "a", "new", "extra", "dimension", "to", "the", "point", "record" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L185-L210
[ "def", "add_extra_dim", "(", "self", ",", "name", ",", "type", ",", "description", "=", "\"\"", ")", ":", "name", "=", "name", ".", "replace", "(", "\" \"", ",", "\"_\"", ")", "type_id", "=", "extradims", ".", "get_id_for_extra_dim_type", "(", "type", ")...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.write_to
writes the data to a stream Parameters ---------- out_stream: file object the destination stream, implementing the write method do_compress: bool, optional, default False Flag to indicate if you want the date to be compressed
pylas/lasdatas/base.py
def write_to(self, out_stream, do_compress=False): """ writes the data to a stream Parameters ---------- out_stream: file object the destination stream, implementing the write method do_compress: bool, optional, default False Flag to indicate if you want ...
def write_to(self, out_stream, do_compress=False): """ writes the data to a stream Parameters ---------- out_stream: file object the destination stream, implementing the write method do_compress: bool, optional, default False Flag to indicate if you want ...
[ "writes", "the", "data", "to", "a", "stream" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L229-L283
[ "def", "write_to", "(", "self", ",", "out_stream", ",", "do_compress", "=", "False", ")", ":", "self", ".", "update_header", "(", ")", "if", "(", "self", ".", "vlrs", ".", "get", "(", "\"ExtraBytesVlr\"", ")", "and", "not", "self", ".", "points_data", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.write_to_file
Writes the las data into a file Parameters ---------- filename : str The file where the data should be written. do_compress: bool, optional, default None if None the extension of the filename will be used to determine if the data should be compressed ...
pylas/lasdatas/base.py
def write_to_file(self, filename, do_compress=None): """ Writes the las data into a file Parameters ---------- filename : str The file where the data should be written. do_compress: bool, optional, default None if None the extension of the filename will b...
def write_to_file(self, filename, do_compress=None): """ Writes the las data into a file Parameters ---------- filename : str The file where the data should be written. do_compress: bool, optional, default None if None the extension of the filename will b...
[ "Writes", "the", "las", "data", "into", "a", "file" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L294-L310
[ "def", "write_to_file", "(", "self", ",", "filename", ",", "do_compress", "=", "None", ")", ":", "is_ext_laz", "=", "filename", ".", "split", "(", "\".\"", ")", "[", "-", "1", "]", "==", "\"laz\"", "if", "is_ext_laz", "and", "do_compress", "is", "None", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasBase.write
Writes to a stream or file When destination is a string, it will be interpreted as the path were the file should be written to, also if do_compress is None, the compression will be guessed from the file extension: - .laz -> compressed - .las -> uncompressed .. note:: ...
pylas/lasdatas/base.py
def write(self, destination, do_compress=None): """ Writes to a stream or file When destination is a string, it will be interpreted as the path were the file should be written to, also if do_compress is None, the compression will be guessed from the file extension: - .laz -> compressed...
def write(self, destination, do_compress=None): """ Writes to a stream or file When destination is a string, it will be interpreted as the path were the file should be written to, also if do_compress is None, the compression will be guessed from the file extension: - .laz -> compressed...
[ "Writes", "to", "a", "stream", "or", "file" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasdatas/base.py#L312-L347
[ "def", "write", "(", "self", ",", "destination", ",", "do_compress", "=", "None", ")", ":", "if", "isinstance", "(", "destination", ",", "str", ")", ":", "self", ".", "write_to_file", "(", "destination", ")", "else", ":", "if", "do_compress", "is", "None...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
_build_point_formats_dtypes
Builds the dict mapping point format id to numpy.dtype In the dtypes, bit fields are still packed, and need to be unpacked each time you want to access them
pylas/point/dims.py
def _build_point_formats_dtypes(point_format_dimensions, dimensions_dict): """ Builds the dict mapping point format id to numpy.dtype In the dtypes, bit fields are still packed, and need to be unpacked each time you want to access them """ return { fmt_id: _point_format_to_dtype(point_fmt, d...
def _build_point_formats_dtypes(point_format_dimensions, dimensions_dict): """ Builds the dict mapping point format id to numpy.dtype In the dtypes, bit fields are still packed, and need to be unpacked each time you want to access them """ return { fmt_id: _point_format_to_dtype(point_fmt, d...
[ "Builds", "the", "dict", "mapping", "point", "format", "id", "to", "numpy", ".", "dtype", "In", "the", "dtypes", "bit", "fields", "are", "still", "packed", "and", "need", "to", "be", "unpacked", "each", "time", "you", "want", "to", "access", "them" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L29-L37
[ "def", "_build_point_formats_dtypes", "(", "point_format_dimensions", ",", "dimensions_dict", ")", ":", "return", "{", "fmt_id", ":", "_point_format_to_dtype", "(", "point_fmt", ",", "dimensions_dict", ")", "for", "fmt_id", ",", "point_fmt", "in", "point_format_dimensio...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
_build_unpacked_point_formats_dtypes
Builds the dict mapping point format id to numpy.dtype In the dtypes, bit fields are unpacked and can be accessed directly
pylas/point/dims.py
def _build_unpacked_point_formats_dtypes( point_formats_dimensions, composed_fields_dict, dimensions_dict ): """ Builds the dict mapping point format id to numpy.dtype In the dtypes, bit fields are unpacked and can be accessed directly """ unpacked_dtypes = {} for fmt_id, dim_names in point_...
def _build_unpacked_point_formats_dtypes( point_formats_dimensions, composed_fields_dict, dimensions_dict ): """ Builds the dict mapping point format id to numpy.dtype In the dtypes, bit fields are unpacked and can be accessed directly """ unpacked_dtypes = {} for fmt_id, dim_names in point_...
[ "Builds", "the", "dict", "mapping", "point", "format", "id", "to", "numpy", ".", "dtype", "In", "the", "dtypes", "bit", "fields", "are", "unpacked", "and", "can", "be", "accessed", "directly" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L40-L55
[ "def", "_build_unpacked_point_formats_dtypes", "(", "point_formats_dimensions", ",", "composed_fields_dict", ",", "dimensions_dict", ")", ":", "unpacked_dtypes", "=", "{", "}", "for", "fmt_id", ",", "dim_names", "in", "point_formats_dimensions", ".", "items", "(", ")", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
np_dtype_to_point_format
Tries to find a matching point format id for the input numpy dtype To match, the input dtype has to be 100% equal to a point format dtype so all names & dimensions types must match Parameters: ---------- dtype : numpy.dtype The input dtype unpacked : bool, optional [description]...
pylas/point/dims.py
def np_dtype_to_point_format(dtype, unpacked=False): """ Tries to find a matching point format id for the input numpy dtype To match, the input dtype has to be 100% equal to a point format dtype so all names & dimensions types must match Parameters: ---------- dtype : numpy.dtype The in...
def np_dtype_to_point_format(dtype, unpacked=False): """ Tries to find a matching point format id for the input numpy dtype To match, the input dtype has to be 100% equal to a point format dtype so all names & dimensions types must match Parameters: ---------- dtype : numpy.dtype The in...
[ "Tries", "to", "find", "a", "matching", "point", "format", "id", "for", "the", "input", "numpy", "dtype", "To", "match", "the", "input", "dtype", "has", "to", "be", "100%", "equal", "to", "a", "point", "format", "dtype", "so", "all", "names", "&", "dim...
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L234-L268
[ "def", "np_dtype_to_point_format", "(", "dtype", ",", "unpacked", "=", "False", ")", ":", "all_dtypes", "=", "(", "ALL_POINT_FORMATS_DTYPE", "if", "not", "unpacked", "else", "UNPACKED_POINT_FORMATS_DTYPES", ")", "for", "format_id", ",", "fmt_dtype", "in", "all_dtype...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
min_file_version_for_point_format
Returns the minimum file version that supports the given point_format_id
pylas/point/dims.py
def min_file_version_for_point_format(point_format_id): """ Returns the minimum file version that supports the given point_format_id """ for version, point_formats in sorted(VERSION_TO_POINT_FMT.items()): if point_format_id in point_formats: return version else: raise errors...
def min_file_version_for_point_format(point_format_id): """ Returns the minimum file version that supports the given point_format_id """ for version, point_formats in sorted(VERSION_TO_POINT_FMT.items()): if point_format_id in point_formats: return version else: raise errors...
[ "Returns", "the", "minimum", "file", "version", "that", "supports", "the", "given", "point_format_id" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L271-L278
[ "def", "min_file_version_for_point_format", "(", "point_format_id", ")", ":", "for", "version", ",", "point_formats", "in", "sorted", "(", "VERSION_TO_POINT_FMT", ".", "items", "(", ")", ")", ":", "if", "point_format_id", "in", "point_formats", ":", "return", "ver...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
is_point_fmt_compatible_with_version
Returns true if the file version support the point_format_id
pylas/point/dims.py
def is_point_fmt_compatible_with_version(point_format_id, file_version): """ Returns true if the file version support the point_format_id """ try: return point_format_id in VERSION_TO_POINT_FMT[str(file_version)] except KeyError: raise errors.FileVersionNotSupported(file_version)
def is_point_fmt_compatible_with_version(point_format_id, file_version): """ Returns true if the file version support the point_format_id """ try: return point_format_id in VERSION_TO_POINT_FMT[str(file_version)] except KeyError: raise errors.FileVersionNotSupported(file_version)
[ "Returns", "true", "if", "the", "file", "version", "support", "the", "point_format_id" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/dims.py#L293-L299
[ "def", "is_point_fmt_compatible_with_version", "(", "point_format_id", ",", "file_version", ")", ":", "try", ":", "return", "point_format_id", "in", "VERSION_TO_POINT_FMT", "[", "str", "(", "file_version", ")", "]", "except", "KeyError", ":", "raise", "errors", ".",...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
VLRList.get_by_id
Function to get vlrs by user_id and/or record_ids. Always returns a list even if only one vlr matches the user_id and record_id >>> import pylas >>> from pylas.vlrs.known import ExtraBytesVlr, WktCoordinateSystemVlr >>> las = pylas.read("pylastests/extrabytes.las") >>> las.vlrs ...
pylas/vlrs/vlrlist.py
def get_by_id(self, user_id="", record_ids=(None,)): """ Function to get vlrs by user_id and/or record_ids. Always returns a list even if only one vlr matches the user_id and record_id >>> import pylas >>> from pylas.vlrs.known import ExtraBytesVlr, WktCoordinateSystemVlr >>> la...
def get_by_id(self, user_id="", record_ids=(None,)): """ Function to get vlrs by user_id and/or record_ids. Always returns a list even if only one vlr matches the user_id and record_id >>> import pylas >>> from pylas.vlrs.known import ExtraBytesVlr, WktCoordinateSystemVlr >>> la...
[ "Function", "to", "get", "vlrs", "by", "user_id", "and", "/", "or", "record_ids", ".", "Always", "returns", "a", "list", "even", "if", "only", "one", "vlr", "matches", "the", "user_id", "and", "record_id" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/vlrlist.py#L95-L138
[ "def", "get_by_id", "(", "self", ",", "user_id", "=", "\"\"", ",", "record_ids", "=", "(", "None", ",", ")", ")", ":", "if", "user_id", "!=", "\"\"", "and", "record_ids", "!=", "(", "None", ",", ")", ":", "return", "[", "vlr", "for", "vlr", "in", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
VLRList.get
Returns the list of vlrs of the requested type Always returns a list even if there is only one VLR of type vlr_type. >>> import pylas >>> las = pylas.read("pylastests/extrabytes.las") >>> las.vlrs [<ExtraBytesVlr(extra bytes structs: 5)>] >>> las.vlrs.get("WktCoordinateS...
pylas/vlrs/vlrlist.py
def get(self, vlr_type): """ Returns the list of vlrs of the requested type Always returns a list even if there is only one VLR of type vlr_type. >>> import pylas >>> las = pylas.read("pylastests/extrabytes.las") >>> las.vlrs [<ExtraBytesVlr(extra bytes structs: 5)>] ...
def get(self, vlr_type): """ Returns the list of vlrs of the requested type Always returns a list even if there is only one VLR of type vlr_type. >>> import pylas >>> las = pylas.read("pylastests/extrabytes.las") >>> las.vlrs [<ExtraBytesVlr(extra bytes structs: 5)>] ...
[ "Returns", "the", "list", "of", "vlrs", "of", "the", "requested", "type", "Always", "returns", "a", "list", "even", "if", "there", "is", "only", "one", "VLR", "of", "type", "vlr_type", "." ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/vlrlist.py#L140-L170
[ "def", "get", "(", "self", ",", "vlr_type", ")", ":", "return", "[", "v", "for", "v", "in", "self", ".", "vlrs", "if", "v", ".", "__class__", ".", "__name__", "==", "vlr_type", "]" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
VLRList.extract
Returns the list of vlrs of the requested type The difference with get is that the returned vlrs will be removed from the list Parameters ---------- vlr_type: str the class name of the vlr Returns ------- list a List of vlrs matchin...
pylas/vlrs/vlrlist.py
def extract(self, vlr_type): """ Returns the list of vlrs of the requested type The difference with get is that the returned vlrs will be removed from the list Parameters ---------- vlr_type: str the class name of the vlr Returns ------- ...
def extract(self, vlr_type): """ Returns the list of vlrs of the requested type The difference with get is that the returned vlrs will be removed from the list Parameters ---------- vlr_type: str the class name of the vlr Returns ------- ...
[ "Returns", "the", "list", "of", "vlrs", "of", "the", "requested", "type", "The", "difference", "with", "get", "is", "that", "the", "returned", "vlrs", "will", "be", "removed", "from", "the", "list" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/vlrlist.py#L172-L194
[ "def", "extract", "(", "self", ",", "vlr_type", ")", ":", "kept_vlrs", ",", "extracted_vlrs", "=", "[", "]", ",", "[", "]", "for", "vlr", "in", "self", ".", "vlrs", ":", "if", "vlr", ".", "__class__", ".", "__name__", "==", "vlr_type", ":", "extracte...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
VLRList.read_from
Reads vlrs and parse them if possible from the stream Parameters ---------- data_stream : io.BytesIO stream to read from num_to_read : int number of vlrs to be read Returns ------- pylas.vlrs.vlrlist.VLRList ...
pylas/vlrs/vlrlist.py
def read_from(cls, data_stream, num_to_read): """ Reads vlrs and parse them if possible from the stream Parameters ---------- data_stream : io.BytesIO stream to read from num_to_read : int number of vlrs to be read Returns ...
def read_from(cls, data_stream, num_to_read): """ Reads vlrs and parse them if possible from the stream Parameters ---------- data_stream : io.BytesIO stream to read from num_to_read : int number of vlrs to be read Returns ...
[ "Reads", "vlrs", "and", "parse", "them", "if", "possible", "from", "the", "stream" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/vlrlist.py#L223-L247
[ "def", "read_from", "(", "cls", ",", "data_stream", ",", "num_to_read", ")", ":", "vlrlist", "=", "cls", "(", ")", "for", "_", "in", "range", "(", "num_to_read", ")", ":", "raw", "=", "RawVLR", ".", "read_from", "(", "data_stream", ")", "try", ":", "...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
files_have_same_point_format_id
Returns true if all the files have the same points format id
pylas/utils.py
def files_have_same_point_format_id(las_files): """ Returns true if all the files have the same points format id """ point_format_found = {las.header.point_format_id for las in las_files} return len(point_format_found) == 1
def files_have_same_point_format_id(las_files): """ Returns true if all the files have the same points format id """ point_format_found = {las.header.point_format_id for las in las_files} return len(point_format_found) == 1
[ "Returns", "true", "if", "all", "the", "files", "have", "the", "same", "points", "format", "id" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/utils.py#L6-L10
[ "def", "files_have_same_point_format_id", "(", "las_files", ")", ":", "point_format_found", "=", "{", "las", ".", "header", ".", "point_format_id", "for", "las", "in", "las_files", "}", "return", "len", "(", "point_format_found", ")", "==", "1" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
files_have_same_dtype
Returns true if all the files have the same numpy datatype
pylas/utils.py
def files_have_same_dtype(las_files): """ Returns true if all the files have the same numpy datatype """ dtypes = {las.points.dtype for las in las_files} return len(dtypes) == 1
def files_have_same_dtype(las_files): """ Returns true if all the files have the same numpy datatype """ dtypes = {las.points.dtype for las in las_files} return len(dtypes) == 1
[ "Returns", "true", "if", "all", "the", "files", "have", "the", "same", "numpy", "datatype" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/utils.py#L13-L17
[ "def", "files_have_same_dtype", "(", "las_files", ")", ":", "dtypes", "=", "{", "las", ".", "points", ".", "dtype", "for", "las", "in", "las_files", "}", "return", "len", "(", "dtypes", ")", "==", "1" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
_raise_if_wrong_file_signature
Reads the 4 first bytes of the stream to check that is LASF
pylas/lasreader.py
def _raise_if_wrong_file_signature(stream): """ Reads the 4 first bytes of the stream to check that is LASF""" file_sig = stream.read(len(headers.LAS_FILE_SIGNATURE)) if file_sig != headers.LAS_FILE_SIGNATURE: raise errors.PylasError( "File Signature ({}) is not {}".format(file_sig, head...
def _raise_if_wrong_file_signature(stream): """ Reads the 4 first bytes of the stream to check that is LASF""" file_sig = stream.read(len(headers.LAS_FILE_SIGNATURE)) if file_sig != headers.LAS_FILE_SIGNATURE: raise errors.PylasError( "File Signature ({}) is not {}".format(file_sig, head...
[ "Reads", "the", "4", "first", "bytes", "of", "the", "stream", "to", "check", "that", "is", "LASF" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L15-L21
[ "def", "_raise_if_wrong_file_signature", "(", "stream", ")", ":", "file_sig", "=", "stream", ".", "read", "(", "len", "(", "headers", ".", "LAS_FILE_SIGNATURE", ")", ")", "if", "file_sig", "!=", "headers", ".", "LAS_FILE_SIGNATURE", ":", "raise", "errors", "."...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader.read_header
Reads the head of the las file and returns it
pylas/lasreader.py
def read_header(self): """ Reads the head of the las file and returns it """ self.stream.seek(self.start_pos) return headers.HeaderFactory().read_from_stream(self.stream)
def read_header(self): """ Reads the head of the las file and returns it """ self.stream.seek(self.start_pos) return headers.HeaderFactory().read_from_stream(self.stream)
[ "Reads", "the", "head", "of", "the", "las", "file", "and", "returns", "it" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L39-L43
[ "def", "read_header", "(", "self", ")", ":", "self", ".", "stream", ".", "seek", "(", "self", ".", "start_pos", ")", "return", "headers", ".", "HeaderFactory", "(", ")", ".", "read_from_stream", "(", "self", ".", "stream", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader.read_vlrs
Reads and return the vlrs of the file
pylas/lasreader.py
def read_vlrs(self): """ Reads and return the vlrs of the file """ self.stream.seek(self.start_pos + self.header.size) return VLRList.read_from(self.stream, num_to_read=self.header.number_of_vlr)
def read_vlrs(self): """ Reads and return the vlrs of the file """ self.stream.seek(self.start_pos + self.header.size) return VLRList.read_from(self.stream, num_to_read=self.header.number_of_vlr)
[ "Reads", "and", "return", "the", "vlrs", "of", "the", "file" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L45-L49
[ "def", "read_vlrs", "(", "self", ")", ":", "self", ".", "stream", ".", "seek", "(", "self", ".", "start_pos", "+", "self", ".", "header", ".", "size", ")", "return", "VLRList", ".", "read_from", "(", "self", ".", "stream", ",", "num_to_read", "=", "s...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader.read
Reads the whole las data (header, vlrs ,points, etc) and returns a LasData object
pylas/lasreader.py
def read(self): """ Reads the whole las data (header, vlrs ,points, etc) and returns a LasData object """ vlrs = self.read_vlrs() self._warn_if_not_at_expected_pos( self.header.offset_to_point_data, "end of vlrs", "start of points" ) self.stream.seek(s...
def read(self): """ Reads the whole las data (header, vlrs ,points, etc) and returns a LasData object """ vlrs = self.read_vlrs() self._warn_if_not_at_expected_pos( self.header.offset_to_point_data, "end of vlrs", "start of points" ) self.stream.seek(s...
[ "Reads", "the", "whole", "las", "data", "(", "header", "vlrs", "points", "etc", ")", "and", "returns", "a", "LasData", "object" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L51-L95
[ "def", "read", "(", "self", ")", ":", "vlrs", "=", "self", ".", "read_vlrs", "(", ")", "self", ".", "_warn_if_not_at_expected_pos", "(", "self", ".", "header", ".", "offset_to_point_data", ",", "\"end of vlrs\"", ",", "\"start of points\"", ")", "self", ".", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader._read_points
private function to handle reading of the points record parts of the las file. the header is needed for the point format and number of points the vlrs are need to get the potential laszip vlr as well as the extra bytes vlr
pylas/lasreader.py
def _read_points(self, vlrs): """ private function to handle reading of the points record parts of the las file. the header is needed for the point format and number of points the vlrs are need to get the potential laszip vlr as well as the extra bytes vlr """ try: ...
def _read_points(self, vlrs): """ private function to handle reading of the points record parts of the las file. the header is needed for the point format and number of points the vlrs are need to get the potential laszip vlr as well as the extra bytes vlr """ try: ...
[ "private", "function", "to", "handle", "reading", "of", "the", "points", "record", "parts", "of", "the", "las", "file", "." ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L97-L117
[ "def", "_read_points", "(", "self", ",", "vlrs", ")", ":", "try", ":", "extra_dims", "=", "vlrs", ".", "get", "(", "\"ExtraBytesVlr\"", ")", "[", "0", "]", ".", "type_of_extra_dims", "(", ")", "except", "IndexError", ":", "extra_dims", "=", "None", "poin...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader._read_compressed_points_data
reads the compressed point record
pylas/lasreader.py
def _read_compressed_points_data(self, laszip_vlr, point_format): """ reads the compressed point record """ offset_to_chunk_table = struct.unpack("<q", self.stream.read(8))[0] size_of_point_data = offset_to_chunk_table - self.stream.tell() if offset_to_chunk_table <= 0: ...
def _read_compressed_points_data(self, laszip_vlr, point_format): """ reads the compressed point record """ offset_to_chunk_table = struct.unpack("<q", self.stream.read(8))[0] size_of_point_data = offset_to_chunk_table - self.stream.tell() if offset_to_chunk_table <= 0: ...
[ "reads", "the", "compressed", "point", "record" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L119-L139
[ "def", "_read_compressed_points_data", "(", "self", ",", "laszip_vlr", ",", "point_format", ")", ":", "offset_to_chunk_table", "=", "struct", ".", "unpack", "(", "\"<q\"", ",", "self", ".", "stream", ".", "read", "(", "8", ")", ")", "[", "0", "]", "size_of...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader._read_internal_waveform_packet
reads and returns the waveform vlr header, waveform record
pylas/lasreader.py
def _read_internal_waveform_packet(self): """ reads and returns the waveform vlr header, waveform record """ # This is strange, the spec says, waveform data packet is in a EVLR # but in the 2 samples I have its a VLR # but also the 2 samples have a wrong user_id (LAS_Spec instea...
def _read_internal_waveform_packet(self): """ reads and returns the waveform vlr header, waveform record """ # This is strange, the spec says, waveform data packet is in a EVLR # but in the 2 samples I have its a VLR # but also the 2 samples have a wrong user_id (LAS_Spec instea...
[ "reads", "and", "returns", "the", "waveform", "vlr", "header", "waveform", "record" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L141-L154
[ "def", "_read_internal_waveform_packet", "(", "self", ")", ":", "# This is strange, the spec says, waveform data packet is in a EVLR", "# but in the 2 samples I have its a VLR", "# but also the 2 samples have a wrong user_id (LAS_Spec instead of LASF_Spec)", "b", "=", "bytearray", "(", "s...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader.read_evlrs
Reads the EVLRs of the file, will fail if the file version does not support evlrs
pylas/lasreader.py
def read_evlrs(self): """ Reads the EVLRs of the file, will fail if the file version does not support evlrs """ self.stream.seek(self.start_pos + self.header.start_of_first_evlr) return evlrs.EVLRList.read_from(self.stream, self.header.number_of_evlr)
def read_evlrs(self): """ Reads the EVLRs of the file, will fail if the file version does not support evlrs """ self.stream.seek(self.start_pos + self.header.start_of_first_evlr) return evlrs.EVLRList.read_from(self.stream, self.header.number_of_evlr)
[ "Reads", "the", "EVLRs", "of", "the", "file", "will", "fail", "if", "the", "file", "version", "does", "not", "support", "evlrs" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L156-L161
[ "def", "read_evlrs", "(", "self", ")", ":", "self", ".", "stream", ".", "seek", "(", "self", ".", "start_pos", "+", "self", ".", "header", ".", "start_of_first_evlr", ")", "return", "evlrs", ".", "EVLRList", ".", "read_from", "(", "self", ".", "stream", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
LasReader._warn_if_not_at_expected_pos
Helper function to warn about unknown bytes found in the file
pylas/lasreader.py
def _warn_if_not_at_expected_pos(self, expected_pos, end_of, start_of): """ Helper function to warn about unknown bytes found in the file""" diff = expected_pos - self.stream.tell() if diff != 0: logger.warning( "There are {} bytes between {} and {}".format(diff, end_...
def _warn_if_not_at_expected_pos(self, expected_pos, end_of, start_of): """ Helper function to warn about unknown bytes found in the file""" diff = expected_pos - self.stream.tell() if diff != 0: logger.warning( "There are {} bytes between {} and {}".format(diff, end_...
[ "Helper", "function", "to", "warn", "about", "unknown", "bytes", "found", "in", "the", "file" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lasreader.py#L163-L169
[ "def", "_warn_if_not_at_expected_pos", "(", "self", ",", "expected_pos", ",", "end_of", ",", "start_of", ")", ":", "diff", "=", "expected_pos", "-", "self", ".", "stream", ".", "tell", "(", ")", "if", "diff", "!=", "0", ":", "logger", ".", "warning", "("...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
vlr_factory
Given a raw_vlr tries to find its corresponding KnownVLR class that can parse its data. If no KnownVLR implementation is found, returns a VLR (record_data will still be bytes)
pylas/vlrs/known.py
def vlr_factory(raw_vlr): """ Given a raw_vlr tries to find its corresponding KnownVLR class that can parse its data. If no KnownVLR implementation is found, returns a VLR (record_data will still be bytes) """ user_id = raw_vlr.header.user_id.rstrip(NULL_BYTE).decode() known_vlrs = BaseKnownVLR....
def vlr_factory(raw_vlr): """ Given a raw_vlr tries to find its corresponding KnownVLR class that can parse its data. If no KnownVLR implementation is found, returns a VLR (record_data will still be bytes) """ user_id = raw_vlr.header.user_id.rstrip(NULL_BYTE).decode() known_vlrs = BaseKnownVLR....
[ "Given", "a", "raw_vlr", "tries", "to", "find", "its", "corresponding", "KnownVLR", "class", "that", "can", "parse", "its", "data", ".", "If", "no", "KnownVLR", "implementation", "is", "found", "returns", "a", "VLR", "(", "record_data", "will", "still", "be"...
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/vlrs/known.py#L547-L561
[ "def", "vlr_factory", "(", "raw_vlr", ")", ":", "user_id", "=", "raw_vlr", ".", "header", ".", "user_id", ".", "rstrip", "(", "NULL_BYTE", ")", ".", "decode", "(", ")", "known_vlrs", "=", "BaseKnownVLR", ".", "__subclasses__", "(", ")", "for", "known_vlr",...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
open_las
Opens and reads the header of the las content in the source >>> with open_las('pylastests/simple.las') as f: ... print(f.header.point_format_id) 3 >>> f = open('pylastests/simple.las', mode='rb') >>> with open_las(f, closefd=False) as flas: ... print(flas.heade...
pylas/lib.py
def open_las(source, closefd=True): """ Opens and reads the header of the las content in the source >>> with open_las('pylastests/simple.las') as f: ... print(f.header.point_format_id) 3 >>> f = open('pylastests/simple.las', mode='rb') >>> with open_las(f, closefd=Fals...
def open_las(source, closefd=True): """ Opens and reads the header of the las content in the source >>> with open_las('pylastests/simple.las') as f: ... print(f.header.point_format_id) 3 >>> f = open('pylastests/simple.las', mode='rb') >>> with open_las(f, closefd=Fals...
[ "Opens", "and", "reads", "the", "header", "of", "the", "las", "content", "in", "the", "source" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L20-L66
[ "def", "open_las", "(", "source", ",", "closefd", "=", "True", ")", ":", "if", "isinstance", "(", "source", ",", "str", ")", ":", "stream", "=", "open", "(", "source", ",", "mode", "=", "\"rb\"", ")", "if", "not", "closefd", ":", "raise", "ValueError...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
read_las
Entry point for reading las data in pylas Reads the whole file into memory. >>> las = read_las("pylastests/simple.las") >>> las.classification array([1, 1, 1, ..., 1, 1, 1], dtype=uint8) Parameters ---------- source : str or io.BytesIO The source to read data from closefd: bo...
pylas/lib.py
def read_las(source, closefd=True): """ Entry point for reading las data in pylas Reads the whole file into memory. >>> las = read_las("pylastests/simple.las") >>> las.classification array([1, 1, 1, ..., 1, 1, 1], dtype=uint8) Parameters ---------- source : str or io.BytesIO T...
def read_las(source, closefd=True): """ Entry point for reading las data in pylas Reads the whole file into memory. >>> las = read_las("pylastests/simple.las") >>> las.classification array([1, 1, 1, ..., 1, 1, 1], dtype=uint8) Parameters ---------- source : str or io.BytesIO T...
[ "Entry", "point", "for", "reading", "las", "data", "in", "pylas" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L69-L94
[ "def", "read_las", "(", "source", ",", "closefd", "=", "True", ")", ":", "with", "open_las", "(", "source", ",", "closefd", "=", "closefd", ")", "as", "reader", ":", "return", "reader", ".", "read", "(", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
create_from_header
Creates a File from an existing header, allocating the array of point according to the provided header. The input header is copied. Parameters ---------- header : existing header to be used to create the file Returns ------- pylas.lasdatas.base.LasBase
pylas/lib.py
def create_from_header(header): """ Creates a File from an existing header, allocating the array of point according to the provided header. The input header is copied. Parameters ---------- header : existing header to be used to create the file Returns ------- pylas.lasdatas.base....
def create_from_header(header): """ Creates a File from an existing header, allocating the array of point according to the provided header. The input header is copied. Parameters ---------- header : existing header to be used to create the file Returns ------- pylas.lasdatas.base....
[ "Creates", "a", "File", "from", "an", "existing", "header", "allocating", "the", "array", "of", "point", "according", "to", "the", "provided", "header", ".", "The", "input", "header", "is", "copied", "." ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L104-L123
[ "def", "create_from_header", "(", "header", ")", ":", "header", "=", "copy", ".", "copy", "(", "header", ")", "header", ".", "point_count", "=", "0", "points", "=", "record", ".", "PackedPointRecord", ".", "empty", "(", "PointFormat", "(", "header", ".", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
create_las
Function to create a new empty las data object .. note:: If you provide both point_format and file_version an exception will be raised if they are not compatible >>> las = create_las(point_format_id=6,file_version="1.2") Traceback (most recent call last): ... pylas.errors.PylasEr...
pylas/lib.py
def create_las(*, point_format_id=0, file_version=None): """ Function to create a new empty las data object .. note:: If you provide both point_format and file_version an exception will be raised if they are not compatible >>> las = create_las(point_format_id=6,file_version="1.2") Tra...
def create_las(*, point_format_id=0, file_version=None): """ Function to create a new empty las data object .. note:: If you provide both point_format and file_version an exception will be raised if they are not compatible >>> las = create_las(point_format_id=6,file_version="1.2") Tra...
[ "Function", "to", "create", "a", "new", "empty", "las", "data", "object" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L126-L176
[ "def", "create_las", "(", "*", ",", "point_format_id", "=", "0", ",", "file_version", "=", "None", ")", ":", "if", "file_version", "is", "not", "None", ":", "dims", ".", "raise_if_version_not_compatible_with_fmt", "(", "point_format_id", ",", "file_version", ")"...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
convert
Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id convert to point format 0 >>> las = read_las('pylastests/simple.las') >>> las.header.version '1.2' >>> las = convert(las, point_for...
pylas/lib.py
def convert(source_las, *, point_format_id=None, file_version=None): """ Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id convert to point format 0 >>> las = read_las('pylastests/simple.la...
def convert(source_las, *, point_format_id=None, file_version=None): """ Converts a Las from one point format to another Automatically upgrades the file version if source file version is not compatible with the new point_format_id convert to point format 0 >>> las = read_las('pylastests/simple.la...
[ "Converts", "a", "Las", "from", "one", "point", "format", "to", "another", "Automatically", "upgrades", "the", "file", "version", "if", "source", "file", "version", "is", "not", "compatible", "with", "the", "new", "point_format_id" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L179-L279
[ "def", "convert", "(", "source_las", ",", "*", ",", "point_format_id", "=", "None", ",", "file_version", "=", "None", ")", ":", "if", "point_format_id", "is", "None", ":", "point_format_id", "=", "source_las", ".", "points_data", ".", "point_format", ".", "i...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
merge_las
Merges multiple las files into one merged = merge_las(las_1, las_2) merged = merge_las([las_1, las_2, las_3]) Parameters ---------- las_files: Iterable of LasData or LasData Returns ------- pylas.lasdatas.base.LasBase The result of the merging
pylas/lib.py
def merge_las(*las_files): """ Merges multiple las files into one merged = merge_las(las_1, las_2) merged = merge_las([las_1, las_2, las_3]) Parameters ---------- las_files: Iterable of LasData or LasData Returns ------- pylas.lasdatas.base.LasBase The result of the mergin...
def merge_las(*las_files): """ Merges multiple las files into one merged = merge_las(las_1, las_2) merged = merge_las([las_1, las_2, las_3]) Parameters ---------- las_files: Iterable of LasData or LasData Returns ------- pylas.lasdatas.base.LasBase The result of the mergin...
[ "Merges", "multiple", "las", "files", "into", "one" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L282-L337
[ "def", "merge_las", "(", "*", "las_files", ")", ":", "if", "len", "(", "las_files", ")", "==", "1", ":", "las_files", "=", "las_files", "[", "0", "]", "if", "not", "las_files", ":", "raise", "ValueError", "(", "\"No files to merge\"", ")", "if", "not", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
write_then_read_again
writes the given las into memory using BytesIO and reads it again, returning the newly read file. Mostly used for testing purposes, without having to write to disk
pylas/lib.py
def write_then_read_again(las, do_compress=False): """ writes the given las into memory using BytesIO and reads it again, returning the newly read file. Mostly used for testing purposes, without having to write to disk """ out = io.BytesIO() las.write(out, do_compress=do_compress) out.seek...
def write_then_read_again(las, do_compress=False): """ writes the given las into memory using BytesIO and reads it again, returning the newly read file. Mostly used for testing purposes, without having to write to disk """ out = io.BytesIO() las.write(out, do_compress=do_compress) out.seek...
[ "writes", "the", "given", "las", "into", "memory", "using", "BytesIO", "and", "reads", "it", "again", "returning", "the", "newly", "read", "file", "." ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/lib.py#L340-L349
[ "def", "write_then_read_again", "(", "las", ",", "do_compress", "=", "False", ")", ":", "out", "=", "io", ".", "BytesIO", "(", ")", "las", ".", "write", "(", "out", ",", "do_compress", "=", "do_compress", ")", "out", ".", "seek", "(", "0", ")", "retu...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.date
Returns the creation date stored in the las file Returns ------- datetime.date
pylas/headers/rawheader.py
def date(self): """ Returns the creation date stored in the las file Returns ------- datetime.date """ try: return datetime.date(self.creation_year, 1, 1) + datetime.timedelta( self.creation_day_of_year - 1 ) except ValueE...
def date(self): """ Returns the creation date stored in the las file Returns ------- datetime.date """ try: return datetime.date(self.creation_year, 1, 1) + datetime.timedelta( self.creation_day_of_year - 1 ) except ValueE...
[ "Returns", "the", "creation", "date", "stored", "in", "the", "las", "file" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L143-L156
[ "def", "date", "(", "self", ")", ":", "try", ":", "return", "datetime", ".", "date", "(", "self", ".", "creation_year", ",", "1", ",", "1", ")", "+", "datetime", ".", "timedelta", "(", "self", ".", "creation_day_of_year", "-", "1", ")", "except", "Va...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.date
Returns the date of file creation as a python date object
pylas/headers/rawheader.py
def date(self, date): """ Returns the date of file creation as a python date object """ self.creation_year = date.year self.creation_day_of_year = date.timetuple().tm_yday
def date(self, date): """ Returns the date of file creation as a python date object """ self.creation_year = date.year self.creation_day_of_year = date.timetuple().tm_yday
[ "Returns", "the", "date", "of", "file", "creation", "as", "a", "python", "date", "object" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L159-L163
[ "def", "date", "(", "self", ",", "date", ")", ":", "self", ".", "creation_year", "=", "date", ".", "year", "self", ".", "creation_day_of_year", "=", "date", ".", "timetuple", "(", ")", ".", "tm_yday" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.mins
Returns de minimum values of x, y, z as a numpy array
pylas/headers/rawheader.py
def mins(self): """ Returns de minimum values of x, y, z as a numpy array """ return np.array([self.x_min, self.y_min, self.z_min])
def mins(self): """ Returns de minimum values of x, y, z as a numpy array """ return np.array([self.x_min, self.y_min, self.z_min])
[ "Returns", "de", "minimum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L200-L203
[ "def", "mins", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "self", ".", "x_min", ",", "self", ".", "y_min", ",", "self", ".", "z_min", "]", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.mins
Sets de minimum values of x, y, z as a numpy array
pylas/headers/rawheader.py
def mins(self, value): """ Sets de minimum values of x, y, z as a numpy array """ self.x_min, self.y_min, self.z_min = value
def mins(self, value): """ Sets de minimum values of x, y, z as a numpy array """ self.x_min, self.y_min, self.z_min = value
[ "Sets", "de", "minimum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L206-L209
[ "def", "mins", "(", "self", ",", "value", ")", ":", "self", ".", "x_min", ",", "self", ".", "y_min", ",", "self", ".", "z_min", "=", "value" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.maxs
Returns de maximum values of x, y, z as a numpy array
pylas/headers/rawheader.py
def maxs(self): """ Returns de maximum values of x, y, z as a numpy array """ return np.array([self.x_max, self.y_max, self.z_max])
def maxs(self): """ Returns de maximum values of x, y, z as a numpy array """ return np.array([self.x_max, self.y_max, self.z_max])
[ "Returns", "de", "maximum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L212-L215
[ "def", "maxs", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "self", ".", "x_max", ",", "self", ".", "y_max", ",", "self", ".", "z_max", "]", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.maxs
Sets de maximum values of x, y, z as a numpy array
pylas/headers/rawheader.py
def maxs(self, value): """ Sets de maximum values of x, y, z as a numpy array """ self.x_max, self.y_max, self.z_max = value
def maxs(self, value): """ Sets de maximum values of x, y, z as a numpy array """ self.x_max, self.y_max, self.z_max = value
[ "Sets", "de", "maximum", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L218-L221
[ "def", "maxs", "(", "self", ",", "value", ")", ":", "self", ".", "x_max", ",", "self", ".", "y_max", ",", "self", ".", "z_max", "=", "value" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.scales
Returns the scaling values of x, y, z as a numpy array
pylas/headers/rawheader.py
def scales(self): """ Returns the scaling values of x, y, z as a numpy array """ return np.array([self.x_scale, self.y_scale, self.z_scale])
def scales(self): """ Returns the scaling values of x, y, z as a numpy array """ return np.array([self.x_scale, self.y_scale, self.z_scale])
[ "Returns", "the", "scaling", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L224-L227
[ "def", "scales", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "self", ".", "x_scale", ",", "self", ".", "y_scale", ",", "self", ".", "z_scale", "]", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
RawHeader1_1.offsets
Returns the offsets values of x, y, z as a numpy array
pylas/headers/rawheader.py
def offsets(self): """ Returns the offsets values of x, y, z as a numpy array """ return np.array([self.x_offset, self.y_offset, self.z_offset])
def offsets(self): """ Returns the offsets values of x, y, z as a numpy array """ return np.array([self.x_offset, self.y_offset, self.z_offset])
[ "Returns", "the", "offsets", "values", "of", "x", "y", "z", "as", "a", "numpy", "array" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L234-L237
[ "def", "offsets", "(", "self", ")", ":", "return", "np", ".", "array", "(", "[", "self", ".", "x_offset", ",", "self", ".", "y_offset", ",", "self", ".", "z_offset", "]", ")" ]
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
HeaderFactory.header_class_for_version
>>> HeaderFactory.header_class_for_version(2.0) Traceback (most recent call last): ... pylas.errors.FileVersionNotSupported: 2.0 >>> HeaderFactory.header_class_for_version(1.2) <class 'pylas.headers.rawheader.RawHeader1_2'> >>> header_class = HeaderFactory.header_class...
pylas/headers/rawheader.py
def header_class_for_version(cls, version): """ >>> HeaderFactory.header_class_for_version(2.0) Traceback (most recent call last): ... pylas.errors.FileVersionNotSupported: 2.0 >>> HeaderFactory.header_class_for_version(1.2) <class 'pylas.headers.rawheader.RawHe...
def header_class_for_version(cls, version): """ >>> HeaderFactory.header_class_for_version(2.0) Traceback (most recent call last): ... pylas.errors.FileVersionNotSupported: 2.0 >>> HeaderFactory.header_class_for_version(1.2) <class 'pylas.headers.rawheader.RawHe...
[ ">>>", "HeaderFactory", ".", "header_class_for_version", "(", "2", ".", "0", ")", "Traceback", "(", "most", "recent", "call", "last", ")", ":", "...", "pylas", ".", "errors", ".", "FileVersionNotSupported", ":", "2", ".", "0" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L300-L318
[ "def", "header_class_for_version", "(", "cls", ",", "version", ")", ":", "try", ":", "return", "cls", ".", "_version_to_header", "[", "str", "(", "version", ")", "]", "except", "KeyError", ":", "raise", "errors", ".", "FileVersionNotSupported", "(", "version",...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
HeaderFactory.peek_file_version
seeks to the position of the las version header fields in the stream and returns it as a str Parameters ---------- stream io.BytesIO Returns ------- str file version read from the stream
pylas/headers/rawheader.py
def peek_file_version(cls, stream): """ seeks to the position of the las version header fields in the stream and returns it as a str Parameters ---------- stream io.BytesIO Returns ------- str file version read from the stream """ ...
def peek_file_version(cls, stream): """ seeks to the position of the las version header fields in the stream and returns it as a str Parameters ---------- stream io.BytesIO Returns ------- str file version read from the stream """ ...
[ "seeks", "to", "the", "position", "of", "the", "las", "version", "header", "fields", "in", "the", "stream", "and", "returns", "it", "as", "a", "str" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L353-L372
[ "def", "peek_file_version", "(", "cls", ",", "stream", ")", ":", "old_pos", "=", "stream", ".", "tell", "(", ")", "stream", ".", "seek", "(", "cls", ".", "_offset_to_major_version", ")", "major", "=", "int", ".", "from_bytes", "(", "stream", ".", "read",...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
HeaderFactory.convert_header
Converts a header to a another version Parameters ---------- old_header: the old header instance new_version: float or str Returns ------- The converted header >>> old_header = HeaderFactory.new(1.2) >>> HeaderFactory.convert_header(old_header,...
pylas/headers/rawheader.py
def convert_header(cls, old_header, new_version): """ Converts a header to a another version Parameters ---------- old_header: the old header instance new_version: float or str Returns ------- The converted header >>> old_header = HeaderFactory...
def convert_header(cls, old_header, new_version): """ Converts a header to a another version Parameters ---------- old_header: the old header instance new_version: float or str Returns ------- The converted header >>> old_header = HeaderFactory...
[ "Converts", "a", "header", "to", "a", "another", "version" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/headers/rawheader.py#L375-L404
[ "def", "convert_header", "(", "cls", ",", "old_header", ",", "new_version", ")", ":", "new_header_class", "=", "cls", ".", "header_class_for_version", "(", "new_version", ")", "b", "=", "bytearray", "(", "old_header", ")", "b", "+=", "b\"\\x00\"", "*", "(", ...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06
test
unpack
Unpack sub field using its mask Parameters: ---------- source_array : numpy.ndarray The source array mask : mask (ie: 0b00001111) Mask of the sub field to be extracted from the source array Returns ------- numpy.ndarray The sub field array
pylas/point/packing.py
def unpack(source_array, mask, dtype=np.uint8): """ Unpack sub field using its mask Parameters: ---------- source_array : numpy.ndarray The source array mask : mask (ie: 0b00001111) Mask of the sub field to be extracted from the source array Returns ------- numpy.ndarray...
def unpack(source_array, mask, dtype=np.uint8): """ Unpack sub field using its mask Parameters: ---------- source_array : numpy.ndarray The source array mask : mask (ie: 0b00001111) Mask of the sub field to be extracted from the source array Returns ------- numpy.ndarray...
[ "Unpack", "sub", "field", "using", "its", "mask" ]
tmontaigu/pylas
python
https://github.com/tmontaigu/pylas/blob/8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06/pylas/point/packing.py#L12-L27
[ "def", "unpack", "(", "source_array", ",", "mask", ",", "dtype", "=", "np", ".", "uint8", ")", ":", "lsb", "=", "least_significant_bit", "(", "mask", ")", "return", "(", "(", "source_array", "&", "mask", ")", ">>", "lsb", ")", ".", "astype", "(", "dt...
8335a1a7d7677f0e4bc391bb6fa3c75b42ed5b06