Cloud

Intuition

Cloud3D is just a additive wrapper for a laspy File object.

Example

We can load a cloud from a LAS like so. We can then index the np.ndarray using .data. Cloud3D will query the laspy object for its XYZRGB channels to form a tabular np.ndarray.

Note that most classes have a data property to grab the underlying data representation.

cloud = Cloud3D.from_las("../rsc/las/chestnut_0/cloud.las")
d = cloud.data

d is represented as a simple X, Y, Z, R, G, B tabular format.

x0

y0

z0

r0

g0

b0

x1

y1

z1

r1

g1

b1

x2

y2

z2

r2

g2

b2

and so on…

Module Info

class frmodel.base.D3.cloud3D.Cloud3D(f: File)

Bases: frmodel.base.D3.cloud._cloud_frame._Cloud3DFrame

static _inv_transform_data(data, header: laspy.file.File)

Transforms data suitable for writing

static _inv_transform_rgb(rgb)

Inverse Transforms RGB according to the header information

This transforms RGB into 0 - 65535, intended for writing

static _inv_transform_xyz(xyz, header: laspy.file.File)

Inverse Transforms XYZ according to the header information

This inverse transforms XYZ according to header, intended for writing

static _read_xml(xml_path)

Reads XML and returns

Parameters

xml_path – Path to XML metadata

Returns

Latitude, Longitude, Origin X, Y, Z respectively

static _transform_data(data, header: laspy.file.File)

Transforms data suitable for usage, from LAS format

static _transform_rgb(rgb)

Transforms RGB according to the header information

This transforms RGB into 0 - 255

static _transform_xyz(xyz, header: laspy.file.File)

Transforms XYZ according to the header information

This transforms XYZ into a workable, intended format for usage.

data(sample_size: Optional[Union[int, float]] = None, transformed: bool = True)

Gets the data as a NumPy Array

Returns as a ‘X’, ‘Y’, ‘Z’, ‘Red’, ‘Green’, ‘Blue’ column array

Parameters
  • sample_size – The number of points to randomly pick. Integer if specifying number of points Float if specifying proportion of points

  • transformed – If the points should be adjusted based on the las header data

Returns

NumPy Array

df(sample_size: Optional[Union[int, float]] = None, transformed: bool = True)

Gets the data as a Pandas DataFrame

Columns returned are ‘X’, ‘Y’, ‘Z’, ‘Red’, ‘Green’, ‘Blue’

Parameters
  • sample_size – The number of points to randomly pick. Integer if specifying number of points Float if specifying proportion of points

  • transformed – If the points should be adjusted based on the las header data

Returns

Pandas DataFrame

static from_las(las_path: str)frmodel.base.D3.cloud3D.Cloud3D

Loads a Cloud3D from a LAS file

Parameters

las_path – Path to a las file

Returns

A Cloud3D instance

to_frame(geotiff_path: str, shape: tuple, samples: int = 100000)

Converts this Cloud3D into a 2D Frame

This algorithm uses geotiff metadata to fit the Cloud data onto it.

Parameters
  • geotiff_path – A Geo-referencable geotiff path

  • shape – The expected shape, this is usually specified by the Frame2D.from_image_spec

  • samples – The number of cloud samples to randomly sample for interpolation.

Returns

write_las(file_name: str, alt_header: Optional[laspy.file.File] = None)

Writes the current points in a las format

Header used will be the same as the one provided during loading otherwise given.