import os, sys import glob import fnmatch import datetime import time import re import h5py import numpy import matplotlib.pyplot as plt import pylab as plb from scipy.optimize import curve_fit from scipy import asarray as ar,exp from scipy import stats from duplicity.path import Path from numpy.ma.core import getdata SPEED_OF_LIGHT = 299792458 SPEED_OF_LIGHT = 3e8 try: from gevent import sleep except: from time import sleep from schainpy.model.data.jrodata import Spectra #from schainpy.model.data.BLTRheaderIO import FileHeader, RecordHeader from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation #from schainpy.model.io.jroIO_bltr import BLTRReader from numpy import imag, shape, NaN class Header(object): def __init__(self): raise NotImplementedError def read(self): raise NotImplementedError def write(self): raise NotImplementedError def printInfo(self): message = "#"*50 + "\n" message += self.__class__.__name__.upper() + "\n" message += "#"*50 + "\n" keyList = self.__dict__.keys() keyList.sort() for key in keyList: message += "%s = %s" %(key, self.__dict__[key]) + "\n" if "size" not in keyList: attr = getattr(self, "size") if attr: message += "%s = %s" %("size", attr) + "\n" #print message FILE_HEADER = numpy.dtype([ #HEADER 1024bytes ('Hname','a32'), #Original file name ('Htime',numpy.str_,32), #Date and time when the file was created ('Hoper',numpy.str_,64), #Name of operator who created the file ('Hplace',numpy.str_,128), #Place where the measurements was carried out ('Hdescr',numpy.str_,256), #Description of measurements ('Hdummy',numpy.str_,512), #Reserved space #Main chunk 8bytes ('Msign',numpy.str_,4), #Main chunk signature FZKF or NUIG ('MsizeData','=5 ('SPARrawGate2',' 1180: self.fp.seek(self.PointerReader , os.SEEK_SET) print ' ' print 'First point in block: ',self.fp.tell() print ' ' #Off2StartNxtRec = (16 + 84 + self.blocksize)*self.RecCounter + 1180 self.srviHeader = SRVIHeader() self.srviHeader.SRVIread(self.fp) #Se obtiene la cabecera del SRVI self.blocksize = self.srviHeader.SizeOfDataBlock1 # Se obtiene el tamao del bloque if self.blocksize == 148: print 'blocksize == 148 bug' jump = numpy.fromfile(self.fp,[('jump',numpy.str_,140)] ,1) self.srviHeader.SRVIread(self.fp) #Se obtiene la cabecera del SRVI if not self.srviHeader.SizeOfSRVI1: self.fileSelector+=1 self.nextfileflag==True self.FileHeaderFlag == True self.recordheader = RecordHeader() self.recordheader.RHread(self.fp) RadarConst5 = self.recordheader.RadarConst dwell = self.recordheader.time_t self.dataOut.channelList = range(1) self.dataOut.nIncohInt = self.Num_inCoh self.dataOut.nProfiles = self.Num_Bins self.dataOut.nCohInt = 1 self.dataOut.windowOfFilter = 1 self.dataOut.utctime = dwell self.dataOut.timeZone=0 #self.__firstHeigth=rheader.StartRangeSamp #self.__deltaHeigth=rheader.SampResolution self.dataOut.heightList= self.SPARrawGate1*self.__deltaHeigth + numpy.array(range(self.Num_Hei))*self.__deltaHeigth #print 'self.Num_Bins', self.Num_Bins #print 'self.Num_inCoh',self.Num_inCoh self.HSDV = numpy.fromfile( self.fp, [('HSDV',numpy.str_,4)],1) self.SizeHSDV = numpy.fromfile( self.fp, [('SizeHSDV','