##// END OF EJS Templates
GRABADO 1 SOLO CANAL H O V
avaldez -
r1596:5efbcbe7bd6e
parent child
Show More
@@ -350,28 +350,29 class HDFWriter(Operation):
350
350
351 """
351 """
352
352
353 ext = ".hdf5"
353 ext = ".hdf5"
354 optchar = "D"
354 optchar = "D"
355 filename = None
355 filename = None
356 path = None
356 path = None
357 setFile = None
357 setFile = None
358 fp = None
358 fp = None
359 firsttime = True
359 firsttime = True
360 #Configurations
360 #Configurations
361 blocksPerFile = None
361 blocksPerFile = None
362 blockIndex = None
362 blockIndex = None
363 dataOut = None
363 dataOut = None
364 #Data Arrays
364 #Data Arrays
365 dataList = None
365 dataList = None
366 metadataList = None
366 metadataList = None
367 currentDay = None
367 currentDay = None
368 lastTime = None
368 lastTime = None
369 last_Azipos = None
369 last_Azipos = None
370 last_Elepos = None
370 last_Elepos = None
371 mode = None
371 mode = None
372 #-----------------------
372 #-----------------------
373 Typename = None
373 Typename = None
374 mask = False
374 mask = False
375 setChannel = None
375
376
376 def __init__(self):
377 def __init__(self):
377
378
@@ -388,11 +389,12 class HDFWriter(Operation):
388 for key, value in kwargs.items():
389 for key, value in kwargs.items():
389 setattr(obj, key, value)
390 setattr(obj, key, value)
390
391
391 def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, description=None,type_data=None, localtime=True, **kwargs):
392 def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, description=None,type_data=None, localtime=True,setChannel=None, **kwargs):
392 self.path = path
393 self.path = path
393 self.blocksPerFile = blocksPerFile
394 self.blocksPerFile = blocksPerFile
394 self.metadataList = metadataList
395 self.metadataList = metadataList
395 self.dataList = [s.strip() for s in dataList]
396 self.dataList = [s.strip() for s in dataList]
397 self.setChannel = setChannel
396 self.setType = setType
398 self.setType = setType
397 if self.setType == "weather":
399 if self.setType == "weather":
398 self.set_kwargs(**kwargs)
400 self.set_kwargs(**kwargs)
@@ -426,7 +428,11 class HDFWriter(Operation):
426 if hasattr(self.dataOut, self.dataList[i]):
428 if hasattr(self.dataOut, self.dataList[i]):
427 dataAux = getattr(self.dataOut, self.dataList[i])
429 dataAux = getattr(self.dataOut, self.dataList[i])
428 if self.setType == 'weather' and self.dataList[i] == 'data_param':
430 if self.setType == 'weather' and self.dataList[i] == 'data_param':
429 dataAux = dataAux[:,self.weather_vars[self.weather_var],:]
431 if self.setChannel is None:
432 dataAux = dataAux[:,self.weather_vars[self.weather_var],:]
433 else:
434 dataAux = dataAux[self.setChannel,self.weather_vars[self.weather_var],:]
435 dataAux = numpy.reshape(dataAux,(1,dataAux.shape[0],dataAux.shape[1]))
430 dsDict['variable'] = self.dataList[i]
436 dsDict['variable'] = self.dataList[i]
431 else:
437 else:
432 log.warning('Attribute {} not found in dataOut'.format(self.dataList[i]), self.name)
438 log.warning('Attribute {} not found in dataOut'.format(self.dataList[i]), self.name)
@@ -679,6 +685,9 class HDFWriter(Operation):
679 else:
685 else:
680 shape = (self.blocksPerFile, ) + dsInfo['shape'][1:]
686 shape = (self.blocksPerFile, ) + dsInfo['shape'][1:]
681 for i in range(dsInfo['dsNumber']):
687 for i in range(dsInfo['dsNumber']):
688 if dsInfo['dsNumber']==1:
689 if self.setChannel==1:
690 i=1
682 ds = sgrp.create_dataset(
691 ds = sgrp.create_dataset(
683 self.getLabel(dsInfo['variable'], i),
692 self.getLabel(dsInfo['variable'], i),
684 shape,
693 shape,
General Comments 0
You need to be logged in to leave comments. Login now