Ejemplo n.º 1
0
 def printUPDFilePulses(self, inputFile, startPulse, numPulses):
     print("UPD File: " + inputFile)
     spdFile = spdpy.openSPDFileHeader(inputFile)
     print("Number of SPD Pulse: " + str(spdFile.numPulses))
     print("Number of SPD Point: " + str(spdFile.numPts))
     pulses = spdpy.readSPDPulsesOffset(spdFile, startPulse, numPulses)
     print("Extracted " + str(len(pulses)) + " pulses.")
     for pulse in pulses:
         self.printPulse(pulse)
Ejemplo n.º 2
0
 def plotUPDFileTransPulses(self, inputFile, ampAxis, startPulse, numPulses):
     print("UPD File: " + inputFile)
     spdFile = spdpy.openSPDFileHeader(inputFile)
     print("Number of SPD Pulse: " + str(spdFile.numPulses))
     print("Number of SPD Point: " + str(spdFile.numPts))
     pulses = spdpy.readSPDPulsesOffset(spdFile, startPulse, numPulses)
     print("Extracted " + str(len(pulses)) + " pulses.")
     for pulse in pulses:
         if pulse.numOfTransmittedBins > 0:
             self.plotTransmittedPulse(pulse, ampAxis, spdFile.temporalBinSpacing)
Ejemplo n.º 3
0
 def printSPDFilePulses(self, inputFile, row, startCol, endCol):
     print("SPD File: " + inputFile)
     spdFile = spdpy.openSPDFileHeader(inputFile)
     print("Number of SPD Pulse: " + str(spdFile.numPulses))
     print("Number of SPD Point: " + str(spdFile.numPts))
     print("Index Size: " + str(spdFile.numBinsX) + " x " +
           str(spdFile.numBinsY))
     pulses = spdpy.readSPDPulsesRowCols(spdFile, row, startCol, endCol)
     print("Extracted " + str(len(pulses)) + " pulses.")
     for pulse in pulses:
         self.printPulse(pulse)
Ejemplo n.º 4
0
 def plotSPDFileTransPulses(self, inputFile, ampAxis, row, startCol, endCol):
     print("SPD File: " + inputFile)
     spdFile = spdpy.openSPDFileHeader(inputFile)
     print("Number of SPD Pulse: " + str(spdFile.numPulses))
     print("Number of SPD Point: " + str(spdFile.numPts))
     print("Index Size: " + str(spdFile.numBinsX) + " x " + str(spdFile.numBinsY))
     pulses = spdpy.readSPDPulsesRowCols(spdFile, row, startCol, endCol)
     print("Extracted " + str(len(pulses)) + " pulses.")
     for pulse in pulses:
         if pulse.numOfTransmittedBins > 0:
             self.plotTransmittedPulse(pulse, ampAxis, spdFile.temporalBinSpacing)
Ejemplo n.º 5
0
import spdpy

writeRow = True  # Set to false to write one data column at a time instead of an entire row

spdFileIn = spdpy.openSPDFileHeader(
    "/Users/pete/Desktop/apr1dr_1476754e0245792s_20081102212559_aa1m5_subset2_v2.spd"
)

spdFileOut = spdpy.copySPDFileAttributes(
    spdFileIn,
    "/Users/pete/Desktop/apr1dr_1476754e0245792s_20081102212559_aa1m5_subset2_v2_copy.spd"
)

spdWriter = spdpy.SPDPySeqWriter()
spdWriter.open(
    spdFileOut,
    "/Users/pete/Desktop/apr1dr_1476754e0245792s_20081102212559_aa1m5_subset2_v2_copy.spd"
)

print "Number of Rows: ", str(spdFileIn.numBinsY)
print "Number of Columns: ", str(spdFileIn.numBinsX)

for row in range(spdFileIn.numBinsY):
    print "Row:", str(row)
    rowOfPulses = spdpy.readSPDPulsesRow(spdFileIn, row)

    if writeRow:
        spdWriter.writeDataRow(rowOfPulses, row)
    else:
        col = 0
        #print "list length: ", len(rowOfPulses)
Ejemplo n.º 6
0
Just a quick and dirty piece of code to check if we successfully write waveforms
from ENVI cubes to SPD files. I've found sometimes it doesn't due to some
bugs. But now they should be all fixed. Just in case, use this code to check it
out.

Zhan Li, [email protected]
Created: 20140612
Last modified: 20141111
'''

import optparse
import sys
import os
import datetime
import numpy as np
from osgeo import gdal
# On GEO server after module load newer python or gdal version, the PYTHONPATH will be overwritten now
# To avoid the loss of the path to spdpy in the PYTHONPATH, include your own python package path here.
sys.path.append('/usr3/graduate/zhanli86/lib64/python2.6/site-packages')
import spdpy

import pdb; pdb.set_trace()

spdfile = spdpy.openSPDFileHeader('/projectnb/echidna/lidar/DWEL_Processing/Brisbane2013Aug/Brisbane2013_ESP_Cal/Brisbane2013_ESP6m/July30_6m_1064_cube_NadirCorrect_Aligned.spd')

pulses = spdpy.readSPDPulsesRow(spdfile, 3)

print(pulses[999][0].received)

print('checkspd\n')
Ejemplo n.º 7
0
from pylab import *
import spdpy

#spdFile = spdpy.openUPDFileHeader("/Users/pete/Desktop/p137_fw_GDA94_110118_mi_decomp_t9_e100_new_upd.upd")
#spdFile = spdpy.openUPDFileHeader("/Users/pete/Desktop/p137_fw_GDA94_110118_mi_decomp_upd.upd")

spdFile = spdpy.openSPDFileHeader(
    "/Users/pete/Desktop/p137_fw_GDA94_110118_mi_decomp_1m_AHD_Test_spd.spd")

print 'Num Pulses = ', spdFile.numPulses
print 'Num points = ', spdFile.numPts

##pulses = spdpy.readUPD(spdFile, 12130, 10)

pulses = spdpy.readSPDPulsesRowCols(spdFile, 100, 0, 500)

speedLightNS = 0.299792458

for pulse in pulses:
    if pulse.numOfReceivedBins > 0 and pulse.numberOfReturns > 0:
        rangeVals = list()
        thresVals = list()
        axisDims = list()
        axisDims.append(pulse.rangeToWaveformStart)
        axisDims.append(pulse.rangeToWaveformStart +
                        (pulse.numOfReceivedBins / speedLightNS))
        axisDims.append(0)
        axisDims.append(650)
        for i in range(len(pulse.received)):
            rangeVals.append((i / speedLightNS) + pulse.rangeToWaveformStart)
            thresVals.append(9)