Skip to content
This repository has been archived by the owner on Aug 18, 2022. It is now read-only.

Commit

Permalink
Also run doctests that are in the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tmontaigu committed Jun 28, 2018
1 parent f8486e8 commit 18ceb59
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@
- pip install lazperf

script:
- pytest pylastests
- pytest pylas # doctests
- pytest
34 changes: 16 additions & 18 deletions docs/basic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,18 @@ Accessing the file header

You can access the header of a las file you read or opened by retrieving the 'header' attribute:

.. code-block:: python
las = pylas.read('somefile.las')
header = las.header
print("Point count: {}".format(header.point_count))
>>> import pylas
>>> las = pylas.read('pylastests/simple.las')
>>> las.header
<LasHeader(1.2)>
>>> las.header.point_count
1065


# or
>>> with pylas.open('pylastests/simple.las') as f:
... f.header.point_count
1065

with pylas.open('somefile.las') as f:
header = f.header
print("Point count: {}".format(header.point_count))


you can see the accessible fields in :class:`pylas.headers.rawheader.RawHeader1_1` and its sub-classes.
Expand All @@ -78,15 +77,14 @@ Manipulating VLRs

To access the VLRs stored in a file, simply access the `vlr` member of the las object.

.. code:: python
las = pylas.read('somefile.las')
vlr_list = las.vlrs
# or
>>> las = pylas.read('pylastests/extrabytes.las')
>>> las.vlrs
[<ExtraBytesVlr(extra bytes structs: 5)>]

with pylas.open('somefile.las') as f:
vlr_list = f.read_vlrs()
>>> with pylas.open('pylastests/extrabytes.las') as f:
... vlr_list = f.read_vlrs()
>>> vlr_list
[<ExtraBytesVlr(extra bytes structs: 5)>]


To retrieve a particular vlr from the list there are 2 ways: :meth:`pylas.vlrs.vlrlist.VLRList.get` and
Expand Down
4 changes: 4 additions & 0 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ LAS files are organized in 3 main parts:
The header contains information about the data such as its version, the point format (which tells the different
dimensions stored for each points).


VLRs
----

After the header, LAS files may contain VLRs (Variable Length Record).
VLRs are meant to store additional information such as the SRS, description on extra dimensions added to the points.
VLRs are divided in two parts:
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[pytest]
addopts = --doctest-modules
addopts = --ignore docs/conf.py --doctest-modules --doctest-glob='*.rst'

0 comments on commit 18ceb59

Please sign in to comment.