##// END OF EJS Templates
set new matplotlib version in setup, improved searchFiles for multiprocessing
Juan C. Espinoza -
r1112:4bbef2dc4ffc
parent child
Show More
@@ -34,6 +34,8 def MPProject(project, n=cpu_count()):
34 34 op = rconf.getOperationObj('run')
35 35 dt1 = op.getParameterValue('startDate')
36 36 dt2 = op.getParameterValue('endDate')
37 tm1 = op.getParameterValue('startTime')
38 tm2 = op.getParameterValue('endTime')
37 39 days = (dt2 - dt1).days
38 40
39 41 for day in range(days + 1):
@@ -46,11 +48,13 def MPProject(project, n=cpu_count()):
46 48 paths, files = reader.searchFilesOffLine(path=rconf.path,
47 49 startDate=dt,
48 50 endDate=dt,
51 startTime=tm1,
52 endTime=tm2,
49 53 ext=DTYPES[rconf.datatype])
50 54 nFiles = len(files)
51 55 if nFiles == 0:
52 56 continue
53 skip = int(math.ceil(nFiles / n))
57 skip = int(math.ceil(nFiles / n))
54 58 while nFiles > cursor * skip:
55 59 rconf.update(startDate=dt_str, endDate=dt_str, cursor=cursor,
56 60 skip=skip)
@@ -962,7 +966,7 class Project(Process):
962 966 print '*' * 60
963 967 print
964 968 self.id = str(id)
965 self.description = description
969 self.description = description
966 970
967 971 def update(self, name, description):
968 972
@@ -1270,7 +1274,7 class Project(Process):
1270 1274 def run(self):
1271 1275
1272 1276 log.success('Starting {}'.format(self.name))
1273
1277 self.start_time = time.time()
1274 1278 self.createObjects()
1275 1279 self.connectObjects()
1276 1280
@@ -1314,4 +1318,6 class Project(Process):
1314 1318 procUnitConfObj = self.procUnitConfObjDict[procKey]
1315 1319 procUnitConfObj.close()
1316 1320
1317 log.success('{} finished'.format(self.name))
1321 log.success('{} finished (time: {}s)'.format(
1322 self.name,
1323 time.time()-self.start_time))
@@ -493,8 +493,8 class RadarControllerHeader(Header):
493 493 nBaud.tofile(fp)
494 494 code1 = (self.code + 1.0)/2.
495 495
496 for ic in range(self.nCode):
497 tempx = numpy.zeros(numpy.ceil(self.nBaud/32.))
496 for ic in range(self.nCode):
497 tempx = numpy.zeros(int(numpy.ceil(self.nBaud/32.)))
498 498 start = 0
499 499 end = 32
500 500 for i in range(len(tempx)):
@@ -22,6 +22,7 except:
22 22
23 23 from schainpy.model.data.jroheaderIO import PROCFLAG, BasicHeader, SystemHeader, RadarControllerHeader, ProcessingHeader
24 24 from schainpy.model.data.jroheaderIO import get_dtype_index, get_numpy_dtype, get_procflag_dtype, get_dtype_width
25 from schainpy.utils import log
25 26
26 27 LOCALTIME = True
27 28
@@ -440,7 +441,7 def isRadarFolder(folder):
440 441
441 442
442 443 def isRadarFile(file):
443 try:
444 try:
444 445 year = int(file[1:5])
445 446 doy = int(file[5:8])
446 447 set = int(file[8:11])
@@ -451,10 +452,10 def isRadarFile(file):
451 452
452 453
453 454 def getDateFromRadarFile(file):
454 try:
455 try:
455 456 year = int(file[1:5])
456 457 doy = int(file[5:8])
457 set = int(file[8:11])
458 set = int(file[8:11])
458 459 except:
459 460 return None
460 461
@@ -649,26 +650,13 class JRODataReader(JRODataIO):
649 650
650 651 filenameList = []
651 652 datetimeList = []
652
653
653 654 for thisPath in pathList:
654 655
655 656 fileList = glob.glob1(thisPath, "*%s" % ext)
656 657 fileList.sort()
657 658
658 skippedFileList = []
659
660 if cursor is not None and skip is not None:
661
662 if skip == 0:
663 skippedFileList = []
664 else:
665 skippedFileList = fileList[cursor *
666 skip: cursor * skip + skip]
667
668 else:
669 skippedFileList = fileList
670
671 for file in skippedFileList:
659 for file in fileList:
672 660
673 661 filename = os.path.join(thisPath, file)
674 662
@@ -684,12 +672,15 class JRODataReader(JRODataIO):
684 672 filenameList.append(filename)
685 673 datetimeList.append(thisDatetime)
686 674
675 if cursor is not None and skip is not None:
676 filenameList = filenameList[cursor * skip:cursor * skip + skip]
677 datetimeList = datetimeList[cursor * skip:cursor * skip + skip]
678
687 679 if not(filenameList):
688 680 print "[Reading] Time range selected invalid [%s - %s]: No *%s files in %s)" % (startTime, endTime, ext, path)
689 681 return [], []
690 682
691 print "[Reading] %d file(s) was(were) found in time range: %s - %s" % (len(filenameList), startTime, endTime)
692 print
683 print "[Reading] %d file(s) was(were) found in time range: %s - %s" % (len(filenameList), startTime, endTime)
693 684
694 685 # for i in range(len(filenameList)):
695 686 # print "[Reading] %s -> [%s]" %(filenameList[i], datetimeList[i].ctime())
@@ -1743,9 +1734,9 class JRODataWriter(JRODataIO):
1743 1734 if self.dataOut.datatime.date() > self.fileDate:
1744 1735 setFile = 0
1745 1736 self.nTotalBlocks = 0
1746
1747 filen = '%s%4.4d%3.3d%3.3d%s' % (
1748 self.optchar, timeTuple.tm_year, timeTuple.tm_yday, setFile, ext)
1737
1738 filen = '{}{:04d}{:03d}{:03d}{}'.format(
1739 self.optchar, timeTuple.tm_year, timeTuple.tm_yday, setFile, ext)
1749 1740
1750 1741 filename = os.path.join(path, subfolder, filen)
1751 1742
@@ -1796,11 +1787,11 class JRODataWriter(JRODataIO):
1796 1787 self.ext = ext.lower()
1797 1788
1798 1789 self.path = path
1799
1790
1800 1791 if set is None:
1801 1792 self.setFile = -1
1802 1793 else:
1803 self.setFile = set - 1
1794 self.setFile = set - 1
1804 1795
1805 1796 self.blocksPerFile = blocksPerFile
1806 1797
@@ -57,7 +57,7 setup(name="schainpy",
57 57 install_requires=[
58 58 "scipy >= 0.14.0",
59 59 "h5py >= 2.2.1",
60 "matplotlib >= 1.4.2",
60 "matplotlib >= 2.0.0",
61 61 "pyfits >= 3.4",
62 62 "paramiko >= 2.1.2",
63 63 "paho-mqtt >= 1.2",
General Comments 0
You need to be logged in to leave comments. Login now