def __init__(self, PathImg='', Fol='201303060940', V=['Prec', 'Pres']): MapFold = np.array(utl.GetFolders(PathImg + 'Maps/')) SeriesFold = np.array(utl.GetFolders(PathImg + 'Series/')) RadarFold = np.array(utl.GetFolders(PathImg + 'Radar/')) xFolMap = np.where(MapFold == Fol)[0] xFolSer = np.where(SeriesFold == Fol)[0] xFolRad = np.where(RadarFold == Fol)[0] if len(xFolSer) == 0: E = utl.ShowError( '__init__', 'MapSeriesGen', 'No se encuentra la carpeta en los dos directorios') raise E if len(xFolMap) != 0: self.PathMaps = PathImg + 'Maps/' + MapFold[xFolMap[0]] + '/' self.ArchMap = gl.glob(self.PathMaps + '*.png') self.Names = [i[len(self.PathMaps):-4] for i in self.ArchMap] self.PathSeries = PathImg + 'Series/' + SeriesFold[ xFolSer[0]] + '/' + V[1] + '/' self.ArchSeries = gl.glob(self.PathSeries + '*.png') self.NamesSeries = [ i[len(self.PathSeries):-4] for i in self.ArchSeries ] if len(xFolRad) != 0: # Se cargan los archivos, tener en cuenta la variable del radar 'DBZH' self.PathRadar1 = PathImg + 'Radar/' + SeriesFold[ xFolSer[0]] + '/' + V[0] + '/DBZH/' self.PathRadar2 = PathImg + 'Radar/' + SeriesFold[ xFolSer[0]] + '/' + V[1] + '/DBZH/' self.ArchRadar1 = gl.glob(self.PathRadar1 + '*.png') self.ArchRadar2 = gl.glob(self.PathRadar2 + '*.png') self.NamesRadar1 = [ i[len(self.PathRadar1):-4] for i in self.ArchRadar1 ] self.NamesRadar2 = [ i[len(self.PathRadar2):-4] for i in self.ArchRadar2 ] return
def __init__(self,PathData,Stations,Var=None): ''' DESCRIPTION: Class Constructor. ''' # ------------------------- # Error Managment # ------------------------- if not(isinstance(Stations,list)) and not(isinstance(Stations,str)): raise TypeError('SIATA','__init__','Erroneus type for Station information') if not(isinstance(Var,list)) and not(isinstance(Var,str)): raise TypeError('SIATA','__init__','Erroneus type for Var information') # ------------------------- # Parameters # ------------------------- self.PathData = PathData self.deli = ',' # Delimeter # Important Variables # String Variables self.LabelsStr = np.array(['Time']) self.LabelsData = np.array(['Temperature','DewpointC','Presion', 'WindSpeedKMH','WindDirectionDegrees','P1','P2', 'Radiacion','Humedad']) self.LabDataOper = {'Temperature':'mean','DewpointC':'mean', 'Presion':'mean','WindSpeedKMH':'mean', 'WindDirectionDegrees':'mean','P1':'sum','P2':'sum', 'Radiacion':'mean','Humedad':'mean'} self.LabDataOper1 = {'Temperature':'mean','DewpointC':'mean', 'Presion':'mean','WindSpeedKMH':'mean', 'WindDirectionDegrees':'mean','P1':'sum','P2':'sum', 'Radiacion':'mean','Humedad':'mean'} self.LabDataOper2 = {'Temperature':'mean','DewpointC':'mean', 'Presion':'mean','WindSpeedKMH':'mean', 'WindDirectionDegrees':'mean','P1':'sum','P2':'sum', 'Radiacion':'mean','Humedad':'mean'} self.LabDataOper3 = {'Temperature':'mean','DewpointC':'mean', 'Presion':'mean','WindSpeedKMH':'mean', 'WindDirectionDegrees':'mean','P1':'sum','P2':'sum', 'Radiacion':'mean','Humedad':'mean'} self.LabDataSave = {'Temperature':'TC','DewpointC':'TDC', 'Presion':'Pres','WindSpeedKMH':'WS', 'WindDirectionDegrees':'WSD','P1':'Prec1','P2':'Prec2', 'Radiacion':'Rad','Humedad':'HR'} self.ElimOver = {'TC':None,'Td':None, 'PresC':None,'WSC':None, 'WDC':None,'PrecC':None, 'RSC':None,'HRC':None} self.ElimLow = {'TC':None,'Td':None, 'PresC':None,'WSC':None, 'WDC':None,'PrecC':None, 'RSC':None,'HRC':None} self.LabelsWithUnits = {'TC':'Temperatura [°C]','Td':'Punto de Rocio [°C]', 'PresC':'Presión [hPa]','WSC':'Vel. Viento [m/s]', 'WDC':'Dirección del Viento [Grados]','PrecC':'Precipitación [mm]', 'RSC':r'Radiación Solar [W/m$^2$]','HRC':'Hum. Rel. [%]'} self.LabelsNoUnits = {'TC':'Temperatura','Td':'Punto de Rocio', 'PresC':'Presión','WSC':'Vel. Viento', 'WDC':'Dirección del Viento','PrecC':'Precipitación', 'RSC':r'Radiación Solar','HRC':'Hum. Rel.'} self.LabelsColors = {'TC':'r','Td':'r', 'PresC':'k','WSC':'k', 'WDC':'k','PrecC':'b', 'RSC':'y','HRC':'g'} # ------------------------- # Get Stations # ------------------------- if Var == None: Var = utl.GetFolders(Var) elif isinstance(Var,str): Var = [Var] # Stations self.Stations = Stations self.Arch = dict() for V in Var: self.Arch[V] = gl.glob(PathData+Stations+'/'+V+'/*.csv') if len(self.Arch[V]) == 0: print('In Station',St,'No data was found, review station') return
def __init__(self, PathData, Stations=None): ''' DESCRIPTION: Class Constructor. ''' # ------------------------- # Error Managment # ------------------------- if not (isinstance(Stations, list)) and not (isinstance( Stations, str)) and Stations != None: r = utl.ShowError('OpenWundergrounds', '__init__', 'Erroneus type for Station information') raise TypeError # ------------------------- # Parameters # ------------------------- self.PathData = PathData self.deli = ',' # Delimeter # Important Variables # String Variables self.LabelsStr = np.array(['Time']) self.LabelsData = np.array([ 'TemperatureC', 'DewpointC', 'PressurehPa', 'WindSpeedKMH', 'WindDirectionDegrees', 'HourlyPrecipMM', 'SolarRadiationWatts/m^2', 'Humidity' ]) self.LabDataOper = { 'TemperatureC': 'mean', 'DewpointC': 'mean', 'PressurehPa': 'mean', 'WindSpeedKMH': 'mean', 'WindDirectionDegrees': 'mean', 'HourlyPrecipMM': 'sum', 'SolarRadiationWatts/m^2': 'mean', 'Humidity': 'mean' } self.LabDataOper1 = { 'TemperatureC': 'mean', 'DewpointC': 'mean', 'PressurehPa': 'mean', 'WindSpeedKMH': 'mean', 'WindDirectionDegrees': 'mean', 'HourlyPrecipMM': 'sum', 'SolarRadiationWatts/m^2': 'mean', 'Humidity': 'mean' } self.LabDataOper2 = { 'TemperatureC': 'mean', 'DewpointC': 'mean', 'PressurehPa': 'mean', 'WindSpeedKMH': 'mean', 'WindDirectionDegrees': 'mean', 'HourlyPrecipMM': 'sum', 'SolarRadiationWatts/m^2': 'sum', 'Humidity': 'mean' } self.LabDataOper3 = { 'TemperatureC': 'mean', 'DewpointC': 'mean', 'PressurehPa': 'mean', 'WindSpeedKMH': 'mean', 'WindDirectionDegrees': 'mean', 'HourlyPrecipMM': 'sum', 'SolarRadiationWatts/m^2': 'mean', 'Humidity': 'mean' } self.LabDataSave = { 'TemperatureC': 'TC', 'DewpointC': 'Td', 'PressurehPa': 'PresC', 'WindSpeedKMH': 'WSC', 'WindDirectionDegrees': 'WDC', 'HourlyPrecipMM': 'PrecC', 'SolarRadiationWatts/m^2': 'RSC', 'Humidity': 'HRC' } self.ElimOver = { 'TC': None, 'Td': None, 'PresC': None, 'WSC': None, 'WDC': None, 'PrecC': None, 'RSC': None, 'HRC': None } self.ElimLow = { 'TC': None, 'Td': None, 'PresC': None, 'WSC': None, 'WDC': None, 'PrecC': None, 'RSC': None, 'HRC': None } self.LabelsWithUnits = { 'TC': 'Temperatura [°C]', 'Td': 'Punto de Rocio [°C]', 'PresC': 'Presión [hPa]', 'WSC': 'Vel. Viento [m/s]', 'WDC': 'Dirección del Viento [Grados]', 'PrecC': 'Precipitación [mm]', 'RSC': r'Radiación Solar [W/m$^2$]', 'HRC': 'Hum. Rel. [%]' } self.LabelsNoUnits = { 'TC': 'Temperatura', 'Td': 'Punto de Rocio', 'PresC': 'Presión', 'WSC': 'Vel. Viento', 'WDC': 'Dirección del Viento', 'PrecC': 'Precipitación', 'RSC': r'Radiación Solar', 'HRC': 'Hum. Rel.' } self.LabelsColors = { 'TC': 'r', 'Td': 'r', 'PresC': 'k', 'WSC': 'k', 'WDC': 'k', 'PrecC': 'b', 'RSC': 'y', 'HRC': 'g' } # ------------------------- # Get Stations # ------------------------- if Stations == None: Stations = utl.GetFolders(PathData) elif isinstance(Stations, str): Stations = [Stations] # Stations self.Stations = Stations self.Arch = dict() for St in Stations: self.Arch[St] = gl.glob(PathData + St + '/*.txt') if len(self.Arch[St]) == 0: print('In Station', St, 'No data was found, review station') return