Example #1
0
if duration <=0 or len(dataDaysList) <= 0:
   msgLib.error('bad start/end times [' + startDateTime + ', ' + endDateTime + ']', 2)
   usage()
   sys.exit()

xType       = getParam(args,'type',msgLib,None)

#####################################
# find and start reading the PSD files 
#####################################
#
# build the file tag for the PSD files to read, example:
#     NM_SLM_--_BH_2009-01-06
#
psdDbDirTag, psdDbFileTag = fileLib.getDir(param.dataDirectory,param.psdDbDirectory,network,station,location,channel)

print "\n[INFO] PSD DIR TAG: " + psdDbDirTag
if VERBOSE:
   print "\n[INFO] PSD FILE TAG: " + psdDbFileTag

#####################################
# loop through the windows
#####################################
#
for n in xrange(len(dataDaysList)):
   print "\n[INFO] day ",dataDaysList[n]
   Dfile = {}
   Hfile = []
   thisFile = os.path.join(psdDbDirTag, dataDaysList[n], psdDbFileTag+'*'+xType+'.txt')
   if VERBOSE:
Example #2
0
    msgLib.error(
        'bad start/end times [' + startDateTime + ', ' + endDateTime + ']', 2)
    usage()
    sys.exit()

xType = getParam(args, 'type', msgLib, None)

#####################################
# find and start reading the PSD files
#####################################
#
# build the file tag for the PSD files to read, example:
#     NM_SLM_--_BH_2009-01-06
#
psdDbDirTag, psdDbFileTag = fileLib.getDir(param.dataDirectory,
                                           param.psdDbDirectory, network,
                                           station, location, channel)

print "\n[INFO] PSD DIR TAG: " + psdDbDirTag
if VERBOSE > 0:
    print "\n[INFO] PSD FILE TAG: " + psdDbFileTag

#####################################
# open the output file
#####################################
#
psdDirTag, psdFileTag = fileLib.getDir(param.dataDirectory, param.psdDirectory,
                                       network, station, location, channel)
fileLib.makePath(psdDirTag)
tagList = [
    psdFileTag,
Example #3
0
if duration <= 0 or len(dataDaysList) <= 0:
    msgLib.error(
        'bad start/end times [' + startDateTime + ', ' + endDateTime + ']', 2)
    usage()
    sys.exit()

#####################################
# find and start reading the polarization files
#####################################
#
# build the file tag for the polarization files to read, example:
#     NM_SLM_--_BH_2009-01-06
#
polarDbDirTag, polarDbFileTag = fileLib.getDir(param.dataDirectory,
                                               param.polarDbDirectory, network,
                                               station, location, channelDir)

print("\n[INFO] polarization DIR TAG: " + polarDbDirTag + "\n")
if VERBOSE > 0:
    print("\n[INFO] polarization FILE TAG: " + polarDbFileTag)

#####################################
# open the output file for each parameter
#####################################
#
thisPolarDirTag, polarFileTag = fileLib.getDir(param.dataDirectory,
                                               param.polarDirectory, network,
                                               station, location, channelDir)
for pn in range(len(variableList)):
    variable = variableList[pn]
Example #4
0
                + " shift " + str(
                    msgLib.param(param, "octaveWindowShift").octaveWindowShift)
                + " DONE", t0)

        #
        # convert to dB
        #
        power = 10.0 * np.log10(power[0:(nSamp / 2) + 1])
        smoothPSD = 10.0 * np.log10(smoothPSD)

        #
        # create output paths if they do not exist
        #
        if msgLib.param(param, 'outputValues').outputValues > 0:
            filePath, psdFileTag = fileLib.getDir(
                msgLib.param(param, 'dataDirectory').dataDirectory,
                msgLib.param(param, 'psdDbDirectory').psdDbDirectory, network,
                station, location, channel)
            filePath = os.path.join(filePath, segmentStartYear,
                                    segmentStartDOY)
            fileLib.makePath(filePath)

            #
            # output is based on the xType
            #
            if VERBOSE:
                print "trChannel.stats:", str(trChannel.stats)
                print "REQUEST:", segmentStart
                print "TRACE:", str(trChannel.stats.starttime).replace("Z", "")
                print "DELTA:", trChannel.stats.delta
                print "SAMPLES:", int(
                    float(msgLib.param(param, 'windowLength').windowLength) /
Example #5
0
                                     msgLib.param(param,'octaveWindowShift').octaveWindowShift, minFrequency,float(msgLib.param(param,'xStart').xStart[plotIndex]))

     if TIMING:
        t0 = fileLib.timeIt("SMOOTHING window "+str(msgLib.param(param,"octaveWindowWidth").octaveWindowWidth)+" shift "+str(msgLib.param(param,"octaveWindowShift").octaveWindowShift)+" DONE",t0)

     #
     # convert to dB
     #
     power     = 10.0 * np.log10(power[0:(nSamp/2)+1])
     smoothPSD = 10.0 * np.log10(smoothPSD)

     #
     # create output paths if they do not exist
     #
     if msgLib.param(param,'outputValues').outputValues > 0:
        filePath, psdFileTag = fileLib.getDir(msgLib.param(param,'dataDirectory').dataDirectory,msgLib.param(param,'psdDbDirectory').psdDbDirectory,network,station,location,channel)
        filePath = os.path.join(filePath,segmentStartYear,segmentStartDOY)
        fileLib.makePath(filePath)

        #
        # output is based on the xType
        #
        if VERBOSE:
           print "trChannel.stats:",str(trChannel.stats)
           print "REQUEST:",segmentStart
           print "TRACE:",str(trChannel.stats.starttime).replace("Z","")
           print "DELTA:",trChannel.stats.delta
           print "SAMPLES:",int(float(msgLib.param(param,'windowLength').windowLength)/float(trChannel.stats.delta) +1)

        tagList = [psdFileTag,str(trChannel.stats.starttime).replace("Z",""),str(msgLib.param(param,'windowLength').windowLength),xType]
        with open(fileLib.getFileName(msgLib.param(param,'namingConvention').namingConvention,filePath,tagList), "w") as file: