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