You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by le...@apache.org on 2017/09/11 14:52:57 UTC

[3/5] climate git commit: CLIMATE-912 Upgrade mccSearch code from Python2 > 3

CLIMATE-912 Upgrade mccSearch code from Python2 > 3


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/5c86f3a8
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/5c86f3a8
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/5c86f3a8

Branch: refs/heads/master
Commit: 5c86f3a87afd8c9ed136d59d3d517207efadb20a
Parents: 7cf8179
Author: Lewis John McGibbney <le...@gmail.com>
Authored: Tue Apr 25 18:40:44 2017 -0700
Committer: Lewis John McGibbney <le...@gmail.com>
Committed: Tue Apr 25 18:40:44 2017 -0700

----------------------------------------------------------------------
 deps_py2.txt                       |    1 +
 deps_py3.txt                       |    1 +
 mccsearch/.DS_Store                |  Bin 6148 -> 0 bytes
 mccsearch/code/mainProg.py         |   41 +-
 mccsearch/code/mainProgTemplate.py |   41 +-
 mccsearch/code/mccSearch.py        | 7226 +++++++++++++++++--------------
 mccsearch/code/mccSearchUI.py      |  277 +-
 7 files changed, 4171 insertions(+), 3416 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/5c86f3a8/deps_py2.txt
----------------------------------------------------------------------
diff --git a/deps_py2.txt b/deps_py2.txt
index c5cd8b6..4655a22 100644
--- a/deps_py2.txt
+++ b/deps_py2.txt
@@ -12,3 +12,4 @@ webtest
 myproxyclient
 esgf-pyclient
 podaacpy
+networkx
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/climate/blob/5c86f3a8/deps_py3.txt
----------------------------------------------------------------------
diff --git a/deps_py3.txt b/deps_py3.txt
index b5fbfa8..05d845c 100644
--- a/deps_py3.txt
+++ b/deps_py3.txt
@@ -9,3 +9,4 @@ python-dateutil
 mock
 webtest
 podaacpy
+networkx
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/climate/blob/5c86f3a8/mccsearch/.DS_Store
----------------------------------------------------------------------
diff --git a/mccsearch/.DS_Store b/mccsearch/.DS_Store
deleted file mode 100644
index 9cc3ce1..0000000
Binary files a/mccsearch/.DS_Store and /dev/null differ

http://git-wip-us.apache.org/repos/asf/climate/blob/5c86f3a8/mccsearch/code/mainProg.py
----------------------------------------------------------------------
diff --git a/mccsearch/code/mainProg.py b/mccsearch/code/mainProg.py
index fc3a752..d341aa6 100644
--- a/mccsearch/code/mainProg.py
+++ b/mccsearch/code/mainProg.py
@@ -20,7 +20,7 @@
 '''
 
 import networkx as nx
-import mccSearch
+from . import mccSearch
 import subprocess
 
 
@@ -55,35 +55,35 @@ def main():
     # -------------------------------------------------------------------------------------------------
 
     # let's go!
-    print "\n -------------- Read MERG Data ----------"
+    print("\n -------------- Read MERG Data ----------")
     mergImgs, timeList = mccSearch.readMergData(CEoriDirName)
-    print ("-" * 80)
+    print(("-" * 80))
 
-    print 'in main', len(mergImgs)
+    print('in main', len(mergImgs))
     # print 'timeList', timeList
-    print 'TRMMdirName ', TRMMdirName
-    print "\n -------------- TESTING findCloudElements ----------"
+    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 ----------"
+    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)
-    print "\n -------------- TESTING findMCCs ----------"
+    print(("-" * 80))
+    print("number of nodes in prunedGraph is: ", prunedGraph.number_of_nodes())
+    print(("-" * 80))
+    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)
+    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 ----------"
+    print("\n -------------- TESTING METRICS ----------")
 
     # some calculations/metrics that work that work
     # print "creating the MCC userfile ", mccSearch.createTextFile(MCCList,1)
@@ -104,6 +104,7 @@ def main():
     # mccSearch.displayPrecip(MCCList)
     # mccSearch.plotHistogram(MCCList)
     #
-    print ("-" * 80)
+    print(("-" * 80))
+
 
 main()

http://git-wip-us.apache.org/repos/asf/climate/blob/5c86f3a8/mccsearch/code/mainProgTemplate.py
----------------------------------------------------------------------
diff --git a/mccsearch/code/mainProgTemplate.py b/mccsearch/code/mainProgTemplate.py
index 8ef0d0b..96da757 100644
--- a/mccsearch/code/mainProgTemplate.py
+++ b/mccsearch/code/mainProgTemplate.py
@@ -20,7 +20,7 @@
 
 import sys
 import networkx as nx
-import mccSearch
+from . import mccSearch
 import numpy as np
 import numpy.ma as ma
 import files
@@ -59,36 +59,36 @@ def main():
     # -------------------------------------------------------------------------------------------------
 
     # let's go!
-    print "\n -------------- Read MERG Data ----------"
+    print("\n -------------- Read MERG Data ----------")
     mergImgs, timeList = mccSearch.readMergData(CEoriDirName)
-    print ("-" * 80)
+    print(("-" * 80))
 
-    print 'in main', len(mergImgs)
+    print('in main', len(mergImgs))
     # print 'timeList', timeList
-    print 'TRMMdirName ', TRMMdirName
-    print "\n -------------- TESTING findCloudElements ----------"
+    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 ----------"
+    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)
+    print(("-" * 80))
+    print("number of nodes in prunedGraph is: ", prunedGraph.number_of_nodes())
+    print(("-" * 80))
     # sys.exit()
-    print "\n -------------- TESTING findMCCs ----------"
+    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)
+    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 ----------"
+    print("\n -------------- TESTING METRICS ----------")
 
     # some calculations/metrics that work that work
     # print "creating the MCC userfile ", mccSearch.createTextFile(MCCList,1)
@@ -109,6 +109,7 @@ def main():
     # mccSearch.displayPrecip(MCCList)
     # mccSearch.plotHistogram(MCCList)
     #
-    print ("-" * 80)
+    print(("-" * 80))
+
 
 main()