Esempio n. 1
0
                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:

                #
                # Header
                #
                file.write("%s %s\n" % (xUnits, powerUnits))

                #
                # data
                #
                for i in xrange(0, len(smoothX)):
                    file.write("%11.6f %11.4f\n" %
                               (float(smoothX[i]), float(smoothPSD[i])))

            file.closed
Esempio n. 2
0
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,
    startDateTime.split('.')[0],
    endDateTime.split('.')[0], xType
]
outputFileName = fileLib.getFileName(param.namingConvention, psdDirTag,
                                     tagList)
#outputFileName = os.path.join(psdDirTag,'.'.join([psdFileTag,startDateTime.split('.')[0],endDateTime.split('.')[0]+'_'+xType+'.txt']))
with open(outputFileName, 'w') as outputFile:

    #####################################
    # loop through the windows
    #####################################
    #
    for n in xrange(len(dataDaysList)):

        thisFile = os.path.join(psdDbDirTag, dataDaysList[n],
                                psdDbFileTag + '*' + xType + '.txt')
        print "[INFO] Day:", dataDaysList[n]
        thisFileList = sorted(glob.glob(thisFile))

        if len(thisFileList) <= 0:
Esempio n. 3
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:

           #
           # Header
           #
           file.write("%s %s\n" % (xUnits,powerUnits))

           #
           # data
           #
           for i in xrange(0,len(smoothX)):
               file.write("%11.6f %11.4f\n" % (float(smoothX[i]),float(smoothPSD[i])))

        file.closed

     #