예제 #1
0
파일: test.py 프로젝트: cambodine/PyHum
def dotest():

   # copy files over to somewhere read/writeable
   dircopy(PyHum.__path__[0], os.path.expanduser("~")+os.sep+'pyhum_test')
   shutil.copy(PyHum.__path__[0]+os.sep+'test.DAT', os.path.expanduser("~")+os.sep+'pyhum_test'+os.sep+'test.DAT')

   # general settings   
   humfile = os.path.expanduser("~")+os.sep+'pyhum_test'+os.sep+'test.DAT' #PyHum.__path__[0]+os.sep+'test.DAT'
   sonpath = os.path.expanduser("~")+os.sep+'pyhum_test' #PyHum.__path__[0]
   doplot = 1 #yes

   # reading specific settings
   cs2cs_args = "epsg:26949" #arizona central state plane
   bedpick = 1 # auto bed pick
   c = 1450 # speed of sound fresh water
   t = 0.108 # length of transducer
   f = 455 # frequency kHz
   draft = 0.3 # draft in metres
   flip_lr = 1 # flip port and starboard

   # correction specific settings
   maxW = 1000 # rms output wattage

   # for texture calcs
   win = 50 # pixel window
   shift = 10 # pixel shift
   density = win/2 
   numclasses = 4 # number of discrete classes for contouring and k-means
   maxscale = 20 # Max scale as inverse fraction of data length (for wavelet analysis)
   notes = 4 # Notes per octave (for wavelet analysis)

   # for mapping
   #imagery = 1 # server='http://server.arcgisonline.com/ArcGIS', service='World_Imagery'
   dogrid = 1 # yes
   calc_bearing = 0 #no
   filt_bearing = 1 #yes
   res = 0.05 # grid resolution in metres
   chunk_size = 0 # auto chunk size

   PyHum.read(humfile, sonpath, cs2cs_args, c, draft, doplot, t, f, bedpick, flip_lr, chunk_size)

   PyHum.correct(humfile, sonpath, maxW, doplot)

   PyHum.texture(humfile, sonpath, win, shift, doplot, density, numclasses, maxscale, notes)

   PyHum.map(humfile, sonpath, cs2cs_args, dogrid, calc_bearing, filt_bearing, res)

   res = 0.5 # grid resolution in metres
   
   PyHum.map_texture(humfile, sonpath, cs2cs_args, dogrid, calc_bearing, filt_bearing, res)
예제 #2
0
파일: test.py 프로젝트: rsignell-usgs/PyHum
def dotest():

   # copy files over to somewhere read/writeable
   dircopy(PyHum.__path__[0], os.path.expanduser("~")+os.sep+'pyhum_test')
   shutil.copy(PyHum.__path__[0]+os.sep+'test.DAT', os.path.expanduser("~")+os.sep+'pyhum_test'+os.sep+'test.DAT')

   # general settings   
   humfile = os.path.expanduser("~")+os.sep+'pyhum_test'+os.sep+'test.DAT' #PyHum.__path__[0]+os.sep+'test.DAT'
   sonpath = os.path.expanduser("~")+os.sep+'pyhum_test' #PyHum.__path__[0]
   doplot = 1 #yes

   # reading specific settings
   cs2cs_args = "epsg:26949" #arizona central state plane
   bedpick = 1 # auto bed pick
   c = 1450 # speed of sound fresh water
   t = 0.108 # length of transducer
   f = 455 # frequency kHz
   draft = 0.3 # draft in metres
   flip_lr = 1 # flip port and starboard
   model = 998 # humminbird model
   chunk_size = 1000 # chunk size = 1000 pings
   #chunk_size = 0 # auto chunk size
 
   # correction specific settings
   maxW = 1000 # rms output wattage

   # for texture calcs
   win = 50 # pixel window
   shift = 10 # pixel shift
   density = win/2 
   numclasses = 4 # number of discrete classes for contouring and k-means
   maxscale = 20 # Max scale as inverse fraction of data length (for wavelet analysis)
   notes = 4 # Notes per octave (for wavelet analysis)

   # for mapping
   dogrid = 1 # yes
   calc_bearing = 0 #no
   filt_bearing = 1 #yes
   res = 0.2 # grid resolution in metres
   cog = 1 # GPS course-over-ground used for heading

   # for downward-looking echosounder echogram (e1-e2) analysis
   ph = 7.0 # acidity on the pH scale
   temp = 10.0 # water temperature in degrees Celsius
   salinity = 0.0
   beam = 20.0
   transfreq = 200.0
   integ = 5
   numclusters = 3

   PyHum.read(humfile, sonpath, cs2cs_args, c, draft, doplot, t, f, bedpick, flip_lr, chunk_size, model)

   PyHum.correct(humfile, sonpath, maxW, doplot)

   PyHum.texture(humfile, sonpath, win, shift, doplot, density, numclasses, maxscale, notes)

   PyHum.map(humfile, sonpath, cs2cs_args, dogrid, calc_bearing, filt_bearing, res, cog)

   res = 0.5 # grid resolution in metres
   
   PyHum.map_texture(humfile, sonpath, cs2cs_args, dogrid, calc_bearing, filt_bearing, res, cog)

   PyHum.e1e2(humfile, sonpath, cs2cs_args, ph, temp, salinity, beam, transfreq, integ, numclusters, doplot)
예제 #3
0
       Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
       humfile = askopenfilename(filetypes=[("DAT files","*.DAT")]) 

    # prompt user to supply directory if no input sonpath is given
    if not sonpath:
       print 'A *.SON directory is required!!!!!!'
       Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
       sonpath = askdirectory()


    # print given arguments to screen and convert data type where necessary
    if humfile:
       print 'Input file is %s' % (humfile)

    if sonpath:
       print 'Son files are in %s' % (sonpath)

    doplot = 1 #yes


    # for texture calcs
    win = 100 # pixel window
    shift = 10 # pixel shift
    density = win/2 # win/2 
    numclasses = 4 # number of discrete classes for contouring and k-means
    maxscale = 20 # Max scale as inverse fraction of data length (for wavelet analysis)
    notes = 4 # Notes per octave (for wavelet analysis)

    ## Calculate texture lengthscale maps using the method of Buscombe et al. (2015)
    PyHum.texture(humfile, sonpath, win, shift, doplot, density, numclasses, maxscale, notes)
예제 #4
0
def correct(humfiles, sonpath, cww):
    PyHum.correct(humfiles, sonpath, correct_withwater=cww)
예제 #5
0
def read_sondata(hmf, sonDir, c1, f1, model1, chunk1):
    PyHum.read(hmf, sonDir, c=c1, f=f1, model=model1, chunk=chunk1)
예제 #6
0
        )  # we don't want a full GUI, so keep the root window from appearing
        sonpath = askdirectory()

    # print given arguments to screen and convert data type where necessary
    if humfile:
        print 'Input file is %s' % (humfile)

    if sonpath:
        print 'Son files are in %s' % (sonpath)

    doplot = 1  #yes

    # reading specific settings
    cs2cs_args = "epsg:" + str(cs)

    # read-specific settings
    bedpick = 1  # auto bed pick
    c = 1500  # speed of sound in (fresh) water
    t = 0.108  # length of transducer
    draft = 0.4  # draft in metres
    model = 1199  # humminbird model
    calc_bearing = 0  #no
    filt_bearing = 0  #no
    chunk = 'd100'  # distance, 100m
    #chunk = 'p1000' # pings, 1000
    #chunk = 'h15' # heading deviation, 15 deg

    ## read data in SON files into PyHum memory mapped format (.dat)
    PyHum.read(humfile, sonpath, cs2cs_args, c, draft, doplot, t, bedpick,
               flip_lr, model, calc_bearing, filt_bearing, chunk)
예제 #7
0
       print 'An input file is required!!!!!!'
       Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
       humfile = askopenfilename(filetypes=[("DAT files","*.DAT")]) 

    # prompt user to supply directory if no input sonpath is given
    if not sonpath:
       print 'A *.SON directory is required!!!!!!'
       Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
       sonpath = askdirectory()


    # print given arguments to screen and convert data type where necessary
    if humfile:
       print 'Input file is %s' % (humfile)

    if sonpath:
       print 'Son files are in %s' % (sonpath)

    doplot = 1 #yes


    # correction specific settings
    maxW = 1000 # rms output wattage
    dofilt = 0 # 1 = apply a phase preserving filter (WARNING!! takes a very long time for large scans)
    correct_withwater = 0 # don't retain water column in radiometric correction (1 = retains water column for radiometric corrections)
    ph = 6.7 # acidity on the pH scale
    salinity = 0.0

    ## correct scans and remove water column
    PyHum.correct(humfile, sonpath, maxW, doplot, dofilt, correct_withwater, ph, temp, salinity)
예제 #8
0
def dotest():

   # copy files over to somewhere read/writeable
   dircopy(PyHum.__path__[0], os.path.expanduser("~")+os.sep+'pyhum_test')
   shutil.copy(PyHum.__path__[0]+os.sep+'test.DAT', os.path.expanduser("~")+os.sep+'pyhum_test'+os.sep+'test.DAT')

   # general settings   
   humfile = os.path.normpath(os.path.join(os.path.expanduser("~"),'pyhum_test','test.DAT'))
   sonpath = os.path.normpath(os.path.join(os.path.expanduser("~"),'pyhum_test'))

   doplot = 1 #yes

   # reading specific settings
   cs2cs_args = "epsg:26949" #arizona central state plane
   bedpick = 1 # auto bed pick
   c = 1450 # speed of sound fresh water
   t = 0.108 # length of transducer
   draft = 0.3 # draft in metres
   flip_lr = 1 # flip port and starboard
   model = 998 # humminbird model
   calc_bearing = 1 #1=yes
   filt_bearing = 1 #1=yes
   chunk = '1' ##'d100' # distance, 100m
   #chunk = 'p1000' # pings, 1000
   #chunk = 'h10' # heading deviation, 10 deg
          
   # correction specific settings
   maxW = 1000 # rms output wattage
   dofilt = 0 # 1 = apply a phase preserving filter (WARNING!! takes a very long time for large scans)
   correct_withwater = 0 # don't retain water column in radiometric correction (1 = retains water column for radiomatric corrections)
   ph = 7.0 # acidity on the pH scale
   temp = 10.0 # water temperature in degrees Celsius
   salinity = 0.0
   dconcfile = None

   # for shadow removal
   shadowmask = 0 # 0= automatic shadow removal, 1=manual
   win = 31
   dissim=3
   correl=0.2
   contrast=6
   energy=0.15
   mn=4

   # for texture calcs
   shift = 50 ##10 # pixel shift
   density =win/2 # win/2 
   numclasses = 8 #4 # number of discrete classes for contouring and k-means
   maxscale = 20 # Max scale as inverse fraction of data length (for wavelet analysis)
   notes = 4 # Notes per octave (for wavelet analysis)

   # for mapping
   res = 0.05 #99 # grid resolution in metres
   # if res==99, the program will automatically calc res from the spatial res of the scans
   mode = 1 # gridding mode (simple nearest neighbour)
   #mode = 2 # gridding mode (inverse distance weighted nearest neighbour)
   #mode = 3 # gridding mode (gaussian weighted nearest neighbour)
   use_uncorrected = 0

   scalemax=40
   nn = 64 #number of nearest neighbours for gridding (used if mode > 1)
   ##influence = 1 #Radius of influence used in gridding. Cut off distance in meters 
   numstdevs = 5 #Threshold number of standard deviations in sidescan intensity per grid cell up to which to accept 

   # for downward-looking echosounder echogram (e1-e2) analysis
   beam = 20.0
   transfreq = 200.0 # frequency (kHz) of downward looking echosounder
   integ = 5
   numclusters = 3 # number of acoustic classes to group observations

   ## read data in SON files into PyHum memory mapped format (.dat)
   PyHum.read(humfile, sonpath, cs2cs_args, c, draft, doplot, t, bedpick, flip_lr, model, calc_bearing, filt_bearing, chunk) #cog

   ## correct scans and remove water column
   PyHum.correct(humfile, sonpath, maxW, doplot, dofilt, correct_withwater, ph, temp, salinity, dconcfile)

   ## remove acoustic shadows (caused by distal acoustic attenuation or sound hitting shallows or shoreline)
   PyHum.rmshadows(humfile, sonpath, win, shadowmask, doplot, dissim, correl, contrast, energy, mn)

   win = 10
   PyHum.texture2(humfile, sonpath, win, doplot, numclasses)

   ## grid and map the scans
   PyHum.map(humfile, sonpath, cs2cs_args, res, mode, nn, numstdevs, use_uncorrected, scalemax) 

   ## calculate and map the e1 and e2 acoustic coefficients from the downward-looking sonar
   PyHum.e1e2(humfile, sonpath, cs2cs_args, ph, temp, salinity, beam, transfreq, integ, numclusters, doplot)
   
   res = 1 # grid resolution in metres
   numstdevs = 5
예제 #9
0
def dotest():

    # copy files over to somewhere read/writeable
    dircopy(PyHum.__path__[0], os.path.expanduser("~") + os.sep + 'pyhum_test')
    shutil.copy(
        PyHum.__path__[0] + os.sep + 'test.DAT',
        os.path.expanduser("~") + os.sep + 'pyhum_test' + os.sep + 'test.DAT')

    # general settings
    humfile = os.path.normpath(
        os.path.join(os.path.expanduser("~"), 'pyhum_test', 'test.DAT'))
    sonpath = os.path.normpath(
        os.path.join(os.path.expanduser("~"), 'pyhum_test'))

    doplot = 1  #yes

    # reading specific settings
    cs2cs_args = "epsg:26949"  #arizona central state plane
    bedpick = 1  # auto bed pick
    c = 1450  # speed of sound fresh water
    t = 0.108  # length of transducer
    draft = 0.3  # draft in metres
    flip_lr = 1  # flip port and starboard
    model = 998  # humminbird model
    calc_bearing = 1  #1=yes
    filt_bearing = 1  #1=yes
    chunk = 'd100'  # distance, 100m
    #chunk = 'p1000' # pings, 1000
    #chunk = 'h10' # heading deviation, 10 deg

    # correction specific settings
    maxW = 1000  # rms output wattage
    dofilt = 0  # 1 = apply a phase preserving filter (WARNING!! takes a very long time for large scans)
    correct_withwater = 0  # don't retain water column in radiometric correction (1 = retains water column for radiomatric corrections)
    ph = 7.0  # acidity on the pH scale
    temp = 10.0  # water temperature in degrees Celsius
    salinity = 0.0

    # for shadow removal
    shadowmask = 0  #automatic shadow removal
    win = 31

    # for texture calcs
    shift = 10  # pixel shift
    density = win / 2  # win/2
    numclasses = 4  # number of discrete classes for contouring and k-means
    maxscale = 20  # Max scale as inverse fraction of data length (for wavelet analysis)
    notes = 4  # Notes per octave (for wavelet analysis)

    # for mapping
    res = 0.2  #99 # grid resolution in metres
    # if res==99, the program will automatically calc res from the spatial res of the scans
    mode = 1  # gridding mode (simple nearest neighbour)
    #mode = 2 # gridding mode (inverse distance weighted nearest neighbour)
    #mode = 3 # gridding mode (gaussian weighted nearest neighbour)
    use_uncorrected = 0

    nn = 64  #number of nearest neighbours for gridding (used if mode > 1)
    ##influence = 1 #Radius of influence used in gridding. Cut off distance in meters
    numstdevs = 5  #Threshold number of standard deviations in sidescan intensity per grid cell up to which to accept

    # for downward-looking echosounder echogram (e1-e2) analysis
    beam = 20.0
    transfreq = 200.0  # frequency (kHz) of downward looking echosounder
    integ = 5
    numclusters = 3  # number of acoustic classes to group observations

    ## read data in SON files into PyHum memory mapped format (.dat)
    PyHum.read(humfile, sonpath, cs2cs_args, c, draft, doplot, t, bedpick,
               flip_lr, model, calc_bearing, filt_bearing, chunk)  #cog

    ## correct scans and remove water column
    PyHum.correct(humfile, sonpath, maxW, doplot, dofilt, correct_withwater,
                  ph, temp, salinity)

    ## remove acoustic shadows (caused by distal acoustic attenuation or sound hitting shallows or shoreline)
    PyHum.rmshadows(humfile, sonpath, win, shadowmask, doplot)

    win = 100  # pixel window

    ## Calculate texture lengthscale maps using the method of Buscombe et al. (2015)
    PyHum.texture(humfile, sonpath, win, shift, doplot, density, numclasses,
                  maxscale, notes)

    ## grid and map the scans
    PyHum.map(humfile, sonpath, cs2cs_args, res, mode, nn, numstdevs,
              use_uncorrected)  #dowrite,

    res = 1  # grid resolution in metres
    numstdevs = 5

    ## grid and map the texture lengthscale maps
    PyHum.map_texture(humfile, sonpath, cs2cs_args, res, mode, nn, numstdevs)

    ## calculate and map the e1 and e2 acoustic coefficients from the downward-looking sonar
    PyHum.e1e2(humfile, sonpath, cs2cs_args, ph, temp, salinity, beam,
               transfreq, integ, numclusters, doplot)
예제 #10
0
    # print given arguments to screen and convert data type where necessary
    if humfile:
        print 'Input file is %s' % (humfile)

    if sonpath:
        print 'Son files are in %s' % (sonpath)

    doplot = 1  #yes

    # reading specific settings

    cs2cs_args = "epsg:" + str(cs)

    # for mapping
    res = 99  # grid resolution in metres
    # if res==99, the program will automatically calc res from the spatial res of the scans
    mode = 1  # gridding mode (simple nearest neighbour)
    #mode = 2 # gridding mode (inverse distance weighted nearest neighbour)
    #mode = 3 # gridding mode (gaussian weighted nearest neighbour)
    #dowrite = 1 #writing of point cloud data to file
    use_uncorrected = 0

    nn = 64  # number of nearest neighbours for gridding (used if mode > 1)
    #influence = 1 # Radius of influence used in gridding. Cut of distance in meters.
    numstdevs = 5  # Threshold number of standard deviations in sidescan intensity per grid cell up to which to accept

    ## grid and map the scans
    PyHum.map(humfile, sonpath, cs2cs_args, res, mode, nn, numstdevs,
              use_uncorrected)  #dowrite,
예제 #11
0

    # print given arguments to screen and convert data type where necessary
    if humfile:
       print 'Input file is %s' % (humfile)

    if sonpath:
       print 'Son files are in %s' % (sonpath)

    doplot = 1 #yes

    # reading specific settings
    cs2cs_args = "epsg:"+str(cs)

    # for mapping
    res = 99 # grid resolution in metres
    # if res==99, the program will automatically calc res from the spatial res of the scans
    mode = 1 # gridding mode (simple nearest neighbour)
    #mode = 2 # gridding mode (inverse distance weighted nearest neighbour)
    #mode = 3 # gridding mode (gaussian weighted nearest neighbour)
    #dowrite = 1 #writing of point cloud data to file
    use_uncorrected = 0


    nn = 64 # number of nearest neighbours for gridding (used if mode > 1)
    #influence = 1 # Radius of influence used in gridding. Cut of distance in meters.
    numstdevs = 5 # Threshold number of standard deviations in sidescan intensity per grid cell up to which to accept

    ## grid and map the texture lengthscale maps
    PyHum.map_texture(humfile, sonpath, cs2cs_args, res, mode, nn, numstdevs)
def correct(humfiles,sonpath,cww):
    PyHum.correct(humfiles,sonpath,correct_withwater=cww)
def read_sondata(hmf,sonDir,c1,f1,model1,chunk1):
    PyHum.read(hmf,sonDir,c=c1,f=f1,model=model1,chunk=chunk1)
예제 #14
0
    # prompt user to supply file if no input file given
    if not humfile:
       print 'An input file is required!!!!!!'
       Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
       humfile = askopenfilename(filetypes=[("DAT files","*.DAT")]) 

    # prompt user to supply directory if no input sonpath is given
    if not sonpath:
       print 'A *.SON directory is required!!!!!!'
       Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
       sonpath = askdirectory()


    # print given arguments to screen and convert data type where necessary
    if humfile:
       print 'Input file is %s' % (humfile)

    if sonpath:
       print 'Son files are in %s' % (sonpath)

    doplot = 1 #yes


    # for shadow removal
    shadowmask = 0 #auto shadow removal
    win = 31 # pixel window

    ## remove acoustic shadows (caused by distal acoustic attenuation or sound hitting shallows or shoreline)
    PyHum.rmshadows(humfile, sonpath, win, shadowmask, doplot)
예제 #15
0
def dotest():

   # copy files over to somewhere read/writeable
   dircopy(PyHum.__path__[0], os.path.expanduser("~")+os.sep+'pyhum_test')
   shutil.copy(PyHum.__path__[0]+os.sep+'test.DAT', os.path.expanduser("~")+os.sep+'pyhum_test'+os.sep+'test.DAT')

   # general settings   
   humfile = os.path.normpath(os.path.join(os.path.expanduser("~"),'pyhum_test','test.DAT'))
   sonpath = os.path.normpath(os.path.join(os.path.expanduser("~"),'pyhum_test'))

   doplot = 1 #yes

   # reading specific settings
   cs2cs_args = "epsg:26949" #arizona central state plane
   bedpick = 1 # auto bed pick
   c = 1450 # speed of sound fresh water
   t = 0.108 # length of transducer
   f = 455 # frequency kHz of sidescan sonar
   draft = 0.3 # draft in metres
   flip_lr = 1 # flip port and starboard
   model = 998 # humminbird model
   chunk_size = 1000 # chunk size = 1000 pings
   #chunk_size = 0 # auto chunk size
   cog = 1 # GPS course-over-ground used for heading
   calc_bearing = 0 #no
   filt_bearing = 1 #yes
    
   # correction specific settings
   maxW = 1000 # rms output wattage

   # for shadow removal
   shadowmask = 0 #automatic shadow removal

   # for texture calcs
   win = 50 # pixel window
   shift = 10 # pixel shift
   density = win/2 
   numclasses = 4 # number of discrete classes for contouring and k-means
   maxscale = 20 # Max scale as inverse fraction of data length (for wavelet analysis)
   notes = 4 # Notes per octave (for wavelet analysis)

   # for mapping
   dogrid = 1 # yes
   res = 0.1 # grid resolution in metres
   mode = 3 # gridding mode (gaussian weighted nearest neighbour)
   dowrite = 0 #disable writing of point cloud data to file

   nn = 64 #number of nearest neighbours for gridding (used if mode > 1)
   influence = 1 #Radius of influence used in gridding. Cut off distance in meters 
   numstdevs = 4 #Threshold number of standard deviations in sidescan intensity per grid cell up to which to accept 

   # for downward-looking echosounder echogram (e1-e2) analysis
   ph = 7.0 # acidity on the pH scale
   temp = 10.0 # water temperature in degrees Celsius
   salinity = 0.0
   beam = 20.0
   transfreq = 200.0 # frequency (kHz) of downward looking echosounder
   integ = 5
   numclusters = 3 # number of acoustic classes to group observations

   # read data in SON files into PyHum memory mapped format (.dat)
   PyHum.read(humfile, sonpath, cs2cs_args, c, draft, doplot, t, f, bedpick, flip_lr, chunk_size, model, calc_bearing, filt_bearing, cog)

   # correct scans and remove water column
   PyHum.correct(humfile, sonpath, maxW, doplot)

   # remove acoustic shadows (caused by distal acoustic attenuation or sound hitting shallows or shoreline)
   PyHum.rmshadows(humfile, sonpath, win, shadowmask, doplot)

   # Calculate texture lengthscale maps using the method of Buscombe et al. (2015)
   PyHum.texture(humfile, sonpath, win, shift, doplot, density, numclasses, maxscale, notes)

   # grid and map the scans
   PyHum.map(humfile, sonpath, cs2cs_args, dogrid, res, dowrite, mode, nn, influence, numstdevs)

   res = 0.5 # grid resolution in metres
   numstdevs = 5
   
   # grid and map the texture lengthscale maps
   PyHum.map_texture(humfile, sonpath, cs2cs_args, dogrid, res, dowrite, mode, nn, influence, numstdevs)

   # calculate and map the e1 and e2 acoustic coefficients from the downward-looking sonar
   PyHum.e1e2(humfile, sonpath, cs2cs_args, ph, temp, salinity, beam, transfreq, integ, numclusters, doplot)