pingmapper 5.0.1__py3-none-any.whl → 5.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1360,7 +1360,10 @@ class sonObj(object):
1360
1360
  outDir = os.path.join(self.outDir, t+'_mw')
1361
1361
 
1362
1362
  if not os.path.exists(outDir):
1363
- os.mkdir(outDir)
1363
+ try:
1364
+ os.mkdir(outDir)
1365
+ except:
1366
+ pass
1364
1367
 
1365
1368
  # Find the images
1366
1369
  images = os.listdir(inDir)
@@ -55,6 +55,7 @@ sys.path.insert(0, r'Z:\UDEL\PythonRepos\PINGVerter')
55
55
  from pingverter import hum2pingmapper, low2pingmapper, cerul2pingmapper, gar2pingmapper
56
56
 
57
57
  import cv2
58
+ import copy
58
59
 
59
60
 
60
61
  #===========================================
@@ -377,6 +378,7 @@ def read_master_func(logfilename='',
377
378
  # son.son8bit = sonar_obj.son8bit
378
379
  # else:
379
380
  son.son8bit = sonar_obj.son8bit
381
+ son.export_beam = True
380
382
 
381
383
  # print(son.beamName, son.son8bit)
382
384
 
@@ -400,6 +402,40 @@ def read_master_func(logfilename='',
400
402
  else:
401
403
  sonObjs.append(son)
402
404
 
405
+ # Both port and starboard are required for side scan workflows
406
+ ## Make copy of ss if both aren't available
407
+ ss_dups = {
408
+ 'ss_port': ['ss_star', 'B003'],
409
+ 'ss_star': ['ss_port', 'B002']
410
+ }
411
+ ss_chan_avail = []
412
+ for son in sonObjs:
413
+ if son.beamName == 'ss_port' or son.beamName == 'ss_star':
414
+ ss_chan_avail.append(son)
415
+ if len(ss_chan_avail) == 0:
416
+ print('\n\nNo side-scan channels available. Aborting!')
417
+ sys.exit()
418
+ elif len(ss_chan_avail) == 1:
419
+ print('\n\nMaking copy of {} to ensure PINGMapper compatibility'.format(son.beamName))
420
+ origBeam = son.beamName
421
+ print(son.beam, son.beamName)
422
+ son_copy = copy.deepcopy(ss_chan_avail[0])
423
+ son_copy.beamName = ss_dups[origBeam][0]
424
+ son_copy.beam = ss_dups[origBeam][1]
425
+ son_copy.export_beam = False
426
+
427
+ # Make copy of meta file
428
+ oldMeta = son.sonMetaFile
429
+ newMeta = '{}_{}_meta_copy.csv'.format(son_copy.beam, son_copy.beamName)
430
+ newMeta = os.path.join(os.path.dirname(oldMeta), newMeta)
431
+ shutil.copy(oldMeta, newMeta)
432
+ son_copy.sonMetaFile = newMeta
433
+ son_copy.outDir = os.path.join(os.path.dirname(oldMeta), son_copy.beamName)
434
+ sonObjs.append(son_copy)
435
+ else:
436
+ pass
437
+
438
+ print(sonObjs)
403
439
  ####
404
440
  # OLD
405
441
 
@@ -1003,8 +1039,9 @@ def read_master_func(logfilename='',
1003
1039
 
1004
1040
  # Interpolate over nan's (and set zero's to nan)
1005
1041
  dep[dep==0] = np.nan
1006
- nans, x = np.isnan(dep), lambda z: z.nonzero()[0]
1007
- dep[nans] = np.interp(x(nans), x(~nans), dep[~nans])
1042
+ dep = np.asarray(dep)
1043
+ nans = np.isnan(dep)
1044
+ dep[nans] = np.interp(np.flatnonzero(nans), np.flatnonzero(~nans), dep[~nans])
1008
1045
 
1009
1046
  sonDF['dep_m'] = dep + adjDep
1010
1047
 
@@ -1331,7 +1368,7 @@ def read_master_func(logfilename='',
1331
1368
  start_time = time.time()
1332
1369
  print("\nExporting sonogram tiles:\n")
1333
1370
  for son in sonObjs:
1334
- if son.wcp or son.wcr_src or son.wco or son.wcm:
1371
+ if (son.wcp or son.wcr_src or son.wco or son.wcm) and son.export_beam:
1335
1372
  # Set outDir
1336
1373
  son.outDir = os.path.join(son.projDir, son.beamName)
1337
1374
 
@@ -1372,7 +1409,7 @@ def read_master_func(logfilename='',
1372
1409
 
1373
1410
  depCnt = np.unique(sDF['dep_m'], return_counts=True)
1374
1411
  depMaxi = np.argmax(depCnt[1])
1375
- depMax = int(depCnt[0][depMaxi]/son.pixM)
1412
+ depMax = int(depCnt[0][depMaxi]/sDF['pixM'][0])
1376
1413
  depMax += 50
1377
1414
 
1378
1415
 
@@ -310,7 +310,7 @@ def rectify_master_func(logfilename='',
310
310
  # COG Pre-processing #
311
311
  # ##########################################################################
312
312
 
313
- # for son in portstar:
313
+ for son in portstar:
314
314
  son.rect_wcp = rect_wcp
315
315
  son.rect_wcr = rect_wcr
316
316
 
@@ -322,63 +322,64 @@ def rectify_master_func(logfilename='',
322
322
  start_time = time.time()
323
323
  print("\nRectifying and Exporting Geotiffs based on heading:\n")
324
324
  for son in portstar:
325
+ if son.export_beam:
325
326
 
326
- # Set output directory
327
- son.outDir = os.path.join(son.projDir, son.beamName)
327
+ # Set output directory
328
+ son.outDir = os.path.join(son.projDir, son.beamName)
328
329
 
329
- # # Get sonar coords dataframe
330
- # sonarCoordsDF = son.sonarCoordsDF
330
+ # # Get sonar coords dataframe
331
+ # sonarCoordsDF = son.sonarCoordsDF
331
332
 
332
- # Get smoothed trackline file
333
- smth_trk_file = son.smthTrkFile
334
- sDF = pd.read_csv(smth_trk_file)
333
+ # Get smoothed trackline file
334
+ smth_trk_file = son.smthTrkFile
335
+ sDF = pd.read_csv(smth_trk_file)
335
336
 
336
- # Smooth heading
337
- if rectMethod == 'Heading':
338
- heading = 'instr_heading'
339
- if smthHeading:
340
- for name, group in sDF.groupby('transect'):
341
- # Convert degrees to radians
342
- hding = np.deg2rad(group[heading])
343
- # Unwrap the heading because heading is circular
344
- hding_unwrapped = np.unwrap(hding)
345
- # Do smoothing
346
- smth = savgol_filter(hding_unwrapped, 51, 3)
347
- # Convert to degrees and make sure 0-360
348
- smth = np.rad2deg(smth) % 360
349
- group[heading] = smth
350
- # Update sDF
351
- sDF.update(group)
352
- else:
353
- heading = 'trk_cog'
337
+ # Smooth heading
338
+ if rectMethod == 'Heading':
339
+ heading = 'instr_heading'
340
+ if smthHeading:
341
+ for name, group in sDF.groupby('transect'):
342
+ # Convert degrees to radians
343
+ hding = np.deg2rad(group[heading])
344
+ # Unwrap the heading because heading is circular
345
+ hding_unwrapped = np.unwrap(hding)
346
+ # Do smoothing
347
+ smth = savgol_filter(hding_unwrapped, 51, 3)
348
+ # Convert to degrees and make sure 0-360
349
+ smth = np.rad2deg(smth) % 360
350
+ group[heading] = smth
351
+ # Update sDF
352
+ sDF.update(group)
353
+ else:
354
+ heading = 'trk_cog'
354
355
 
355
- smth_trk_file = son.smthTrkFile
356
- sDF.to_csv(smth_trk_file)
356
+ smth_trk_file = son.smthTrkFile
357
+ sDF.to_csv(smth_trk_file)
357
358
 
358
- # Get chunk id
359
- chunks = son._getChunkID()
359
+ # Get chunk id
360
+ chunks = son._getChunkID()
360
361
 
361
- # Get colormap
362
- son._getSonColorMap(son_colorMap)
362
+ # Get colormap
363
+ son._getSonColorMap(son_colorMap)
363
364
 
364
- print('\n\tExporting', len(chunks), 'GeoTiffs for', son.beamName)
365
+ print('\n\tExporting', len(chunks), 'GeoTiffs for', son.beamName)
365
366
 
366
- # Parallel(n_jobs= np.min([len(sDF), threadCnt]))(delayed(son._rectSonHeadingMain)(sonarCoordsDF[sonarCoordsDF['chunk_id']==chunk], chunk) for chunk in tqdm(range(len(chunks))))
367
- Parallel(n_jobs= np.min([len(sDF), threadCnt]))(delayed(son._rectSonHeadingMain)(sDF[sDF['chunk_id']==chunk], chunk, heading=heading, interp_dist=rectInterpDist) for chunk in tqdm(chunks))
368
- # for i in chunks:
369
- # # son._rectSonHeading(sonarCoordsDF[sonarCoordsDF['chunk_id']==i], i)
370
- # r = son._rectSonHeadingMain(sDF[sDF['chunk_id']==i], i, heading=heading, interp_dist=rectInterpDist)
367
+ # Parallel(n_jobs= np.min([len(sDF), threadCnt]))(delayed(son._rectSonHeadingMain)(sonarCoordsDF[sonarCoordsDF['chunk_id']==chunk], chunk) for chunk in tqdm(range(len(chunks))))
368
+ Parallel(n_jobs= np.min([len(sDF), threadCnt]))(delayed(son._rectSonHeadingMain)(sDF[sDF['chunk_id']==chunk], chunk, heading=heading, interp_dist=rectInterpDist) for chunk in tqdm(chunks))
369
+ # for i in chunks:
370
+ # # son._rectSonHeading(sonarCoordsDF[sonarCoordsDF['chunk_id']==i], i)
371
+ # r = son._rectSonHeadingMain(sDF[sDF['chunk_id']==i], i, heading=heading, interp_dist=rectInterpDist)
371
372
 
372
- # # sys.exit()
373
+ # # sys.exit()
373
374
 
374
- # # # Concatenate and store cooordinates
375
- # # dfAll = pd.concat(r)
376
- # # son.sonarCoordsDF = dfAll
375
+ # # # Concatenate and store cooordinates
376
+ # # dfAll = pd.concat(r)
377
+ # # son.sonarCoordsDF = dfAll
377
378
 
378
- # smth_trk_file = smth_trk_file.replace('.csv', 'heading.csv')
379
- # r.to_csv(smth_trk_file)
379
+ # smth_trk_file = smth_trk_file.replace('.csv', 'heading.csv')
380
+ # r.to_csv(smth_trk_file)
380
381
 
381
- # print(dfAll)
382
+ # print(dfAll)
382
383
 
383
384
  print("Done!")
384
385
  print("Time (s):", round(time.time() - start_time, ndigits=1))
@@ -405,26 +406,27 @@ def rectify_master_func(logfilename='',
405
406
  # Always use COG for rubber sheeting
406
407
  cog = True
407
408
  for son in portstar:
408
- # Set output directory
409
- son.outDir = os.path.join(son.projDir, son.beamName)
410
-
411
- # Get chunk id's
412
- chunks = son._getChunkID()
413
-
414
- # Load sonMetaDF
415
- son._loadSonMeta()
416
-
417
- # Get colormap
418
- son._getSonColorMap(son_colorMap)
419
-
420
- print('\n\tExporting', len(chunks), 'GeoTiffs for', son.beamName)
421
- # for i in chunks:
422
- # son._rectSonRubber(i, filter, cog, wgs=False)
423
- # sys.exit()
424
- Parallel(n_jobs= np.min([len(chunks), threadCnt]))(delayed(son._rectSonRubber)(i, filter, cog, wgs=False) for i in tqdm(chunks))
425
- son._cleanup()
426
- gc.collect()
427
- printUsage()
409
+ if son.export_beam:
410
+ # Set output directory
411
+ son.outDir = os.path.join(son.projDir, son.beamName)
412
+
413
+ # Get chunk id's
414
+ chunks = son._getChunkID()
415
+
416
+ # Load sonMetaDF
417
+ son._loadSonMeta()
418
+
419
+ # Get colormap
420
+ son._getSonColorMap(son_colorMap)
421
+
422
+ print('\n\tExporting', len(chunks), 'GeoTiffs for', son.beamName)
423
+ # for i in chunks:
424
+ # son._rectSonRubber(i, filter, cog, wgs=False)
425
+ # sys.exit()
426
+ Parallel(n_jobs= np.min([len(chunks), threadCnt]))(delayed(son._rectSonRubber)(i, filter, cog, wgs=False) for i in tqdm(chunks))
427
+ son._cleanup()
428
+ gc.collect()
429
+ printUsage()
428
430
 
429
431
  if rect_wcp or rect_wcr:
430
432
  for son in portstar:
pingmapper/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '5.0.1'
1
+ __version__ = '5.0.3'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pingmapper
3
- Version: 5.0.1
3
+ Version: 5.0.3
4
4
  Summary: Open-source interface for processing recreation-grade side scan sonar datasets and reproducibly mapping benthic habitat
5
5
  Author: Cameron Bodine
6
6
  Author-email: bodine.cs@gmail.email
@@ -3,20 +3,20 @@ pingmapper/__main__.py,sha256=6qBbTK3eg_Er2SlUgBUaR0CBrJCKB9P2dpJaq2y5y3g,1421
3
3
  pingmapper/class_mapSubstrateObj.py,sha256=txB9YqXfVgDFi628jo2F1RtEw1lCNR8wYpkhy94bn0U,37036
4
4
  pingmapper/class_portstarObj.py,sha256=yeYn-0M3-Zna0F-goPQMca-keNivCiXg9YHQovsluoE,106719
5
5
  pingmapper/class_rectObj.py,sha256=aJbM-q3UNBhvWutOJwnweGkWTrx6avslX2DCWdofW4Q,96182
6
- pingmapper/class_sonObj.py,sha256=pohaVOZEGazWXbRETbGPEkNXIH4GaWN3nNKWBt0BLFc,75606
6
+ pingmapper/class_sonObj.py,sha256=7HVeCTDSUTwerkdB-hrRTITvh9q7kCfbL98QCTFp85Q,75683
7
7
  pingmapper/funcs_common.py,sha256=pCOIy83srtYKtKUnF4oXkd83_kimZI0NiSrO0TE0O4g,13414
8
8
  pingmapper/funcs_model.py,sha256=dO9J4-0s1COggHkSUqHFC1qKTs20A6PSvkDqXWMUT6A,7916
9
9
  pingmapper/funcs_rectify.py,sha256=bAFWbNr4dyOuQzF1j4Je-K4zxfJZUjISc0nYrOot8Ng,12418
10
10
  pingmapper/gui_main.py,sha256=5JsOYqRu146T1xhRgYC9ag3vnpRWqa2PDuJky595YA0,34780
11
11
  pingmapper/main_mapSubstrate.py,sha256=E7jYmKHATXSk5XWhPR-pWH0288wurhX5ph94Gp_v0eg,21217
12
- pingmapper/main_readFiles.py,sha256=j5YueUGVbQeNC9UC_InP_gA-hfcOit_QmRYHLRYBhUc,55289
13
- pingmapper/main_rectify.py,sha256=818lQDTrtLQ-pMK6lbLBRMJ9tA0KdS9creRArnqj_Jg,19913
12
+ pingmapper/main_readFiles.py,sha256=lhL41W4UisY8ZgdRBgk5G47SeaLHMmB0Myk47Fhxtrc,56748
13
+ pingmapper/main_rectify.py,sha256=uOKHHYrjVa3PVtU26G_fL9hTV7sZkvIzEgk3VJd3tVA,20217
14
14
  pingmapper/test_PINGMapper.py,sha256=-SYMsdK-tTodXp5dCFSWPn-KRN7-OjX6OwjQ2-8hQg0,14176
15
15
  pingmapper/test_time.py,sha256=uHT0mtLDP1J6w-snoELyk4UzZ2LrDeF6jGgJJVloalg,750
16
- pingmapper/version.py,sha256=9tYG6TjO3vfMnMVkU2VyP-q82n6Kd8evmAb7XV7GaeE,21
17
- pingmapper-5.0.1.data/data/pingmapper_config/default_params.json,sha256=YA9Rx1PSdUy4cTq-vtKORo3nNLisCYNOeUBxClldmHs,1285
18
- pingmapper-5.0.1.dist-info/licenses/LICENSE,sha256=lowDp_th1CGR0Z224a-jYRi-oNFe_0fdldL3USXhX-k,1095
19
- pingmapper-5.0.1.dist-info/METADATA,sha256=Gl7UVCnUqQTttQHSGmumoF1y16ggIhS28JUE1uPuRLQ,9173
20
- pingmapper-5.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
- pingmapper-5.0.1.dist-info/top_level.txt,sha256=RlV4sDoE3uIIDzNMOjN2t012Ia_jsblNVojJvg4q84w,11
22
- pingmapper-5.0.1.dist-info/RECORD,,
16
+ pingmapper/version.py,sha256=09bPQIE5xdwmGSNTeDXCpFQGPQ3KBQfG1VKKsSIakYw,21
17
+ pingmapper-5.0.3.data/data/pingmapper_config/default_params.json,sha256=YA9Rx1PSdUy4cTq-vtKORo3nNLisCYNOeUBxClldmHs,1285
18
+ pingmapper-5.0.3.dist-info/licenses/LICENSE,sha256=lowDp_th1CGR0Z224a-jYRi-oNFe_0fdldL3USXhX-k,1095
19
+ pingmapper-5.0.3.dist-info/METADATA,sha256=oz9lofZcjjofeknMY9aF0Y0MH0H_9t-RokMmRKC3tE4,9173
20
+ pingmapper-5.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
21
+ pingmapper-5.0.3.dist-info/top_level.txt,sha256=RlV4sDoE3uIIDzNMOjN2t012Ia_jsblNVojJvg4q84w,11
22
+ pingmapper-5.0.3.dist-info/RECORD,,