lidar_tools

Tools to examine bathy lidar data extracted using Global Mapper.

source

las2datetime

 las2datetime (las_time)

Convert a LAS / LAZ time to utc datetime value.

Type Details
las_time LAS Time
Returns object UTC_datetime
czmil_time_stamp      = 153407475.910288                                         # A LAZ raw time stamp from CZMIL
utc_soe = las2datetime( czmil_time_stamp )

 #UTC={dt.datetime.fromtimestamp(utc_soe)}
print(
    f'{czmil_time_stamp=:18.6f}\n'
    f'{utc_soe=}\n'
    f'{utc_soe.strftime("%Y/%m/%d %H:%M:%S.%f")}') 

czmil_time_stamp      = 341842350.167830
utc_soe = las2datetime( czmil_time_stamp )

# UTC={dt.datetime.fromtimestamp(utc_soe)}
print(
    f'{czmil_time_stamp=:18.6f}\n'
    f'{utc_soe=}\n'
    f'{utc_soe.strftime("%Y/%m/%d %H:%M:%S.%f")}')
czmil_time_stamp=  153407475.910288
utc_soe=datetime.datetime(2016, 7, 24, 14, 57, 55, 910288)
2016/07/24 14:57:55.910288
czmil_time_stamp=  341842350.167830
utc_soe=datetime.datetime(2022, 7, 14, 13, 59, 10, 167830)
2022/07/14 13:59:10.167830
utc_soe.strftime('%Y/%m/%d %H:%M:%S.%f')
'2022/07/14 13:59:10.167830'

source

swath_width

 swath_width (full_scan_angle_d:float, altitude_ft=None, altitude_m=None)

Compute the scan width give the full scan angle in degrees, and the altitude in either meters or feet. Returns scan width in meters.

Type Default Details
full_scan_angle_d float Full scan angle in degrees.
altitude_ft NoneType None Sensor altitude in feet.
altitude_m NoneType None Sensor altitude in meters.
Returns float Returns the swath width in meters.
print(swath_width( 16, altitude_ft =10_500 ), 
      swath_width( 16, altitude_m  =3_200 ),
     )
899.5737459767073 899.4613420953053

source

DATA

 DATA ()

This class gets populated


source

TEST_AREA

 TEST_AREA ()

Presets parameters for analysis. Most of the parameters are presets for Bokeh plots used in the analysis. Additional attributes to define datasets and their related attributes are added after this class is instantiated.

help(TEST_AREA)
Help on class TEST_AREA in module __main__:

class TEST_AREA(builtins.object)
 |  Presets parameters for analysis. Most of the parameters are presets for Bokeh
 |  plots used in the analysis.  Additional attributes to define datasets and 
 |  their related attributes are added after this class is instantiated.
 |  
 |  Methods defined here:
 |  
 |  __init__(self)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      dictionary for instance variables
 |  
 |  __weakref__
 |      list of weak references to the object
ta = TEST_AREA()
vars( ta )
{'title': 'Title Not set',
 'y_axis_label': 'not Set',
 'xaxis_axis_label': 'NAVD88 Depth (m)',
 'bin_size': 0.01,
 'width': 700,
 'height': 400,
 'axis_axis_label_text_font_style': 'bold',
 'axis_axis_label_text_font_size': '18pt',
 'title_text_font_size': '24pt',
 'title_text_font_style': 'bold',
 'axis_major_label_text_font_size': '16pt',
 'axis_major_label_text_font_style': 'bold',
 'area_width': 0,
 'area_length': 0,
 'area': 0,
 'data_list': [],
 'ref_mean': None,
 'colab': False,
 'density': False,
 'yaxis_axis_label': 'Number of Depths'}

source

data

 data (tdf, fn='', name='', ref=False, scale=1.0, offset=0.0,
       color='blue', width=3)

Reads the ASCII data file cls.fn, stores the data in cls.df, and generates stats on the cls.['ELEVATION'] data. It also generates a histogram, cls.hist, based on tdf.bin_size.

Type Default Details
tdf The parent TEST_AREA class.
fn str Data file name
name str Name of this data set
ref bool False Use as the reference dataset or not.
scale float 1.0 Scale factor.
offset float 0.0 Offset to apply.
color str blue
width int 3 line width

source

profile_distance

 profile_distance (df, lat='lat', lon='lon', dist='dist')

Generate distance values between the first Lat/Lon point and each other Lat/Lon point in the DataFrame.

Type Default Details
df Dataframe or numpy array containing latitude, Longititude, and Elevation columns
lat str lat The name of the latitude column
lon str lon The name of the Longititude column
dist str dist Computed distance value
Returns object New dataframe with a new column for distance

Example usage:

data_path               = '../data/atm/'
atm_file                = 'profile-1-atm-xyz.zip'
atm = pd.read_csv(data_path+atm_file, names=["lon", "lat", "elev"])
display(atm)
lon lat elev
0 -49.478853 69.031902 623.736
1 -49.478861 69.031816 624.403
2 -49.478869 69.031728 623.600
3 -49.478871 69.031641 623.747
4 -49.478873 69.031553 623.072
... ... ... ...
137 -49.479172 69.025193 616.221
138 -49.479169 69.025107 617.262
139 -49.479169 69.025023 617.074
140 -49.479186 69.024852 617.871
141 -49.479179 69.024766 617.835

142 rows × 3 columns

rv = profile_distance( atm )
display( rv )
lon lat elev dist
0 -49.478853 69.031902 623.736 0.000000
1 -49.478861 69.031816 624.403 9.568074
2 -49.478869 69.031728 623.600 19.358416
3 -49.478871 69.031641 623.747 29.030753
4 -49.478873 69.031553 623.072 38.815242
... ... ... ... ...
137 -49.479172 69.025193 616.221 746.115807
138 -49.479169 69.025107 617.262 755.675221
139 -49.479169 69.025023 617.074 765.014330
140 -49.479186 69.024852 617.871 784.037327
141 -49.479179 69.024766 617.835 793.594151

142 rows × 4 columns

x = rv['dist']
y = rv['elev']
bkp = wwbk.ww_figure()
bkp.fig.scatter( x, y)
show( bkp.fig )
Loading BokehJS ...

source

gen_plot

 gen_plot (test_area)

Generate a plot figure, and store it as an attribute in test-area. Configure it with preferred settings.

Details
test_area Generate and configure a Bokeh plot.

source

plot_hists

 plot_hists (obj)

Plot histograms of each dataset.

Details
obj Data object.

source

show_attributes

 show_attributes (obj)

Printout atrributes of obj. obj is a class DATA.


source

gen_stats

 gen_stats (data_obj=None, header:bool=False, area=0)

Print the statistics for the given elevation data from data_obj. Setting header=True will cause it to print a header describing the columns before printing the results.

Type Default Details
data_obj NoneType None The data obj
header bool False Print a header showing the column names.
area int 0 The area (in meters) that the values came from. Used to computed points per meter.
Returns tuple Tuple containing: mean, std, min, max, number_of_points

source

gen_all_stats

 gen_all_stats (ta:object)

Generate stats for all of the datasets within the ta class.

Type Details
ta object Object of class TEST_AREA.
if 'google.colab' in str(get_ipython()):
    data_path = '/content/drive/MyDrive/Projects/2024-0209-NOAA-RSD-Bulldog/'
else:
    data_path = "../work/data/buldog/"
a10bdd    = data_path + "A-10m-bulldog-deep.txt"
a10bds    = data_path + "A-10m-bulldog-shallow.txt"
b10dd     = data_path + "B-10m-bulldog-deep.txt"
b10ds     = data_path + "B-10m-bulldog-shallow.txt"
c22bdd    = data_path + "C-22m-bulldog-deep.txt"
d30bdd    = data_path + "D-30m-bulldog-deep.txt"
a10cz     = data_path + "A-10m-czmil.txt"
b10cz     = data_path + "B-10m-czmil.txt"
c22cz     = data_path + "C-22m-czmil.txt"
d30cz     = data_path + "D-30m-czmil.txt"
bd_a = TEST_AREA()
bd_a.area_name      = "Area B"
bd_a.title          = f"{bd_a.area_name} ~10 meter depth. 1cm bins."
bd_a.area_width     = 3
bd_a.area_length    = 70
bd_a.area           = bd_a.area_width * bd_a.area_length

bd_a.bin_size       = 0.02
bd_a.density        = True
if bd_a.colab:
    bd_a.data_path  = "/content/drive/MyDrive/Projects/2024-0209-NOAA-RSD-Bulldog/"
else:
    bd_a.data_path      = "../data/bulldog/"
    
width = 3
#data( bd_a, offset=26.0, fn = bd_a.data_path + "A-30m-sonar.txt",          color = "red",   width = width, name = "SONAR", ref=True )
data( bd_a, offset=26.0, fn = bd_a.data_path + "B-10m-czmil.txt",           color = "green", width = width, name = "CZMIL", ref=True  )
data( bd_a, offset=26.0, fn = bd_a.data_path + "B-10m-bulldog-deep.txt",    color = "blue",  width = width, name = "Bulldog-D",       )
data( bd_a, offset=26.0, fn = bd_a.data_path + "B-10m-bulldog-shallow.txt", color = "Red",   width = width, name = "Bulldog-S",       )
gen_all_stats( bd_a )
plot_hists( bd_a )

The test area is 210.0 square meters. (3 by 70 meters)

                        Ref            Std                                 Total
    Data Source  Ref    Dif  Mean(m)  Dev(m)   Min(m)    Max(m)   P2P(m)  Points  Points/m  Scale  Offset(m)
          CZMIL <--   0.000 16.231    0.053   16.076    16.434    0.358     878     4.181  1.0000 26.000
      Bulldog-D       0.037 16.193    0.089   15.991    16.482    0.491      58     0.276  1.0000 26.000
      Bulldog-S       0.046 16.184    0.073   16.022    16.296    0.274      35     0.167  1.0000 26.000
Loading BokehJS ...
hx4_a = TEST_AREA()
hx4_a.area_name      = "Area A"
hx4_a.title          = f"{hx4_a.area_name} ~30 meter depth. 1cm bins."
hx4_a.area_width     = 2
hx4_a.area_length    = 45
hx4_a.area           = hx4_a.area_width * hx4_a.area_length

hx4_a.bin_size       = 0.01
hx4_a.data_path      = "../data/ch4x/"
width = 3
data( hx4_a, offset=26.0, fn = hx4_a.data_path + "A-30m-sonar.txt", color = "red",   width = width, name = "SONAR", ref=True       )
data( hx4_a, offset=26.0, fn = hx4_a.data_path + "A-30m-czmil.txt", color = "green", width = width, name = "CZMIL"                 )
data( hx4_a, offset=26.0, fn = hx4_a.data_path + "A-30m-hx4.txt",   color = "blue",  width = width, name = "Hawkeye 4x", scale=1.0175 )

gen_all_stats( hx4_a )
plot_hists( hx4_a )

The test area is 90.0 square meters. (2 by 45 meters)

                        Ref            Std                                 Total
    Data Source  Ref    Dif  Mean(m)  Dev(m)   Min(m)    Max(m)   P2P(m)  Points  Points/m  Scale  Offset(m)
          SONAR <--   0.000 -29.928    0.087  -30.161   -29.739    0.422     684     7.600  1.0000 26.000
          CZMIL       0.070 -29.998    0.206  -30.621   -29.470    1.151     168     1.867  1.0000 26.000
     Hawkeye 4x       0.016 -29.944    0.099  -30.220   -29.701    0.519     294     3.267  1.0175 26.000
Loading BokehJS ...