1 Updated doc strings, removed print statements and updated documentation 2 Refactored checkCriteriaB to be generic function checkCriteria 3 Also fixed findPrecipRate
Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/5e1a3d1c Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/5e1a3d1c Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/5e1a3d1c Branch: refs/heads/master Commit: 5e1a3d1c3adad1df0d0db78a9711b9d0480932b2 Parents: aed34f0 Author: kwhitehall <[email protected]> Authored: Sun Apr 13 09:01:33 2014 -0400 Committer: kwhitehall <[email protected]> Committed: Sun Apr 13 09:01:33 2014 -0400 ---------------------------------------------------------------------- mccsearch/code/files.pyc | Bin 0 -> 18453 bytes mccsearch/code/mainProgTemp.py | 99 ++++++++++++++++++++++++++++++++++++ mccsearch/code/mccSearch.pyc | Bin 0 -> 98227 bytes mccsearch/code/process.pyc | Bin 0 -> 29786 bytes 4 files changed, 99 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/5e1a3d1c/mccsearch/code/files.pyc ---------------------------------------------------------------------- diff --git a/mccsearch/code/files.pyc b/mccsearch/code/files.pyc new file mode 100644 index 0000000..f8a5577 Binary files /dev/null and b/mccsearch/code/files.pyc differ http://git-wip-us.apache.org/repos/asf/climate/blob/5e1a3d1c/mccsearch/code/mainProgTemp.py ---------------------------------------------------------------------- diff --git a/mccsearch/code/mainProgTemp.py b/mccsearch/code/mainProgTemp.py new file mode 100644 index 0000000..9be65b5 --- /dev/null +++ b/mccsearch/code/mainProgTemp.py @@ -0,0 +1,99 @@ +''' +# running the program +''' + +import sys +import networkx as nx +import mccSearch +import numpy as np +import numpy.ma as ma +import files +import matplotlib.pyplot as plt +import subprocess + + +def main(): + CEGraph = nx.DiGraph() + prunedGraph = nx.DiGraph() + MCCList =[] + MCSList=[] + MCSMCCNodesList =[] + allMCSsList =[] + allCETRMMList =[] + + #for GrADs + subprocess.call('export DISPLAY=:0.0', shell=True) + + mainDirStr= "/directory/to/where/to/store/outputs" + TRMMdirName = "/directory/to/the/TRMM/netCDF/files" + CEoriDirName = "/directory/to/the/MERG/netCDF/files" + + #for first time working with the raw MERG zipped files + # mccSearch.preprocessingMERG("/Users/kimwhitehall/Documents/HU/research/DATA") + # --------------------------------------------------------------------------------- + + + #create main directory and file structure for storing intel + mccSearch.createMainDirectory(mainDirStr) + TRMMCEdirName = mainDirStr+'/TRMMnetcdfCEs' + CEdirName = mainDirStr+'/MERGnetcdfCEs' + + # for doing some postprocessing with the clipped datasets instead of running the full program, e.g. + # mccSearch.postProcessingNetCDF(3,CEoriDirName) + # mccSearch.postProcessingNetCDF(2) + # ------------------------------------------------------------------------------------------------- + + #let's go! + print "\n -------------- Read MERG Data ----------" + mergImgs, timeList = mccSearch.readMergData(CEoriDirName) + print ("-"*80) + + print 'in main', len(mergImgs) + #print 'timeList', timeList + print 'TRMMdirName ', TRMMdirName + print "\n -------------- TESTING findCloudElements ----------" + CEGraph = mccSearch.findCloudElements(mergImgs,timeList,TRMMdirName) + #if the TRMMdirName wasnt entered for whatever reason, you can still get the TRMM data this way + # CEGraph = mccSearch.findCloudElements(mergImgs,timeList) + # allCETRMMList=mccSearch.findPrecipRate(TRMMdirName,timeList) + # ---------------------------------------------------------------------------------------------- + print ("-"*80) + print "number of nodes in CEGraph is: ", CEGraph.number_of_nodes() + print ("-"*80) + print "\n -------------- TESTING findCloudClusters ----------" + prunedGraph = mccSearch.findCloudClusters(CEGraph) + print ("-"*80) + print "number of nodes in prunedGraph is: ", prunedGraph.number_of_nodes() + print ("-"*80) + #sys.exit() + print "\n -------------- TESTING findMCCs ----------" + MCCList,MCSList = mccSearch.findMCC(prunedGraph) + print ("-"*80) + print "MCC List has been acquired ", len(MCCList) + print "MCS List has been acquired ", len(MCSList) + print ("-"*80) + #now ready to perform various calculations/metrics + print "\n -------------- TESTING METRICS ----------" + + #some calculations/metrics that work that work + # print "creating the MCC userfile ", mccSearch.createTextFile(MCCList,1) + # print "creating the MCS userfile ", mccSearch.createTextFile(MCSList,2) + # MCCTimes, tdelta = mccSearch.temporalAndAreaInfoMetric(MCCList) + # print "number of MCCs is: ", mccSearch.numberOfFeatures(MCCList) + # print "longest duration is: ", mccSearch.longestDuration(MCCTimes), "hrs" + # print "shortest duration is: ", mccSearch.shortestDuration(MCCTimes), "hrs" + # #print "Average duration is: ", mccSearch.convert_timedelta(mccSearch.averageMCCLength(MCCTimes)) + # print "Average duration is: ", mccSearch.averageDuration(MCCTimes), "hrs" + # print "Average size is: ", mccSearch.averageFeatureSize(MCCList), "km^2" + + #some plots that work + # mccSearch.plotAccTRMM(MCCList) + # mccSearch.displayPrecip(MCCList) + # mccSearch.plotAccuInTimeRange('2009-09-01_00:00:00', '2009-09-01_09:00:00') + # mccSearch.displaySize(MCCList) + # mccSearch.displayPrecip(MCCList) + # mccSearch.plotHistogram(MCCList) + # + print ("-"*80) + +main() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/climate/blob/5e1a3d1c/mccsearch/code/mccSearch.pyc ---------------------------------------------------------------------- diff --git a/mccsearch/code/mccSearch.pyc b/mccsearch/code/mccSearch.pyc new file mode 100644 index 0000000..dc462d1 Binary files /dev/null and b/mccsearch/code/mccSearch.pyc differ http://git-wip-us.apache.org/repos/asf/climate/blob/5e1a3d1c/mccsearch/code/process.pyc ---------------------------------------------------------------------- diff --git a/mccsearch/code/process.pyc b/mccsearch/code/process.pyc new file mode 100644 index 0000000..d0133fc Binary files /dev/null and b/mccsearch/code/process.pyc differ
