Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
CLIMATE-912 Upgrade mccSearch code from Python2 > 3
Browse files Browse the repository at this point in the history
  • Loading branch information
lewismc committed Apr 26, 2017
1 parent 7cf8179 commit 5c86f3a
Show file tree
Hide file tree
Showing 7 changed files with 4,171 additions and 3,416 deletions.
1 change: 1 addition & 0 deletions deps_py2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ webtest
myproxyclient
esgf-pyclient
podaacpy
networkx
1 change: 1 addition & 0 deletions deps_py3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ python-dateutil
mock
webtest
podaacpy
networkx
Binary file removed mccsearch/.DS_Store
Binary file not shown.
41 changes: 21 additions & 20 deletions mccsearch/code/mainProg.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'''

import networkx as nx
import mccSearch
from . import mccSearch
import subprocess


Expand Down Expand Up @@ -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)
Expand All @@ -104,6 +104,7 @@ def main():
# mccSearch.displayPrecip(MCCList)
# mccSearch.plotHistogram(MCCList)
#
print ("-" * 80)
print(("-" * 80))


main()
41 changes: 21 additions & 20 deletions mccsearch/code/mainProgTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -109,6 +109,7 @@ def main():
# mccSearch.displayPrecip(MCCList)
# mccSearch.plotHistogram(MCCList)
#
print ("-" * 80)
print(("-" * 80))


main()
Loading

0 comments on commit 5c86f3a

Please sign in to comment.