<commit_before>
"""
plume_add_arc.py
ArcGIS Model to add batches of plumes together using Map Algebra

Authors: <NAME>
"""

# Import system modules
import sys, string, os, arcgisscripting, glob

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Set the Geoprocessing environment...
gp.outputCoordinateSystem = "PROJCS['World_Mollweide',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mollweide'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],UNIT['Meter',1.0]]"
gp.extent = "-17703215.5609692 -9018645.62975446 17876133.2023738 \
8750470.21662275" # pulled from GRASS ocean layer

# EDIT ME: change to the directory containing the compressed GeoTiffs
ws = "F:\\dev\\p3_fert"

if not os.path.isdir(ws):
    ws = os.getcwd()

gp.workspace = ws
gp.CheckOutExtension("Spatial")
name = os.path.basename(ws)

# EDIT ME: pattern below matches the files you'd like to add
files = glob.glob('plume*.tif*')
r = 'zyxwvutsrqponmlkjihgfedcba'
ra  = [r[i] for i in range(len(r))]
pass2 = []

try:
    for i in range(0, len(files), 10): # add 10 rasters per run
        exp = " + ".join(files[i:i + 9])
        output ='%s_%s' % (name, ra.pop())
        pass2.append(output)
        print "generating %s" % output
        gp.SingleOutputMapAlgebra("(%s)" % exp, output)

    exp = " + ".join(pass2)
    print "generating merged final output %s" % name
    gp.SingleOutputMapAlgebra("(%s)" % exp, name)
    
except:
    print gp.GetMessages()
<commit_msg>added additional passes since Arc chokes adding more than 12 or so rasters -- oh the joy<commit_after>
"""
plume_add_arc.py
ArcGIS Model to add batches of plumes together using Map Algebra

Authors: <NAME>
"""

# Import system modules
import sys, string, os, arcgisscripting, glob

# Create the Geoprocessor object
gp = arcgisscripting.create()

# Set the Geoprocessing environment...
gp.outputCoordinateSystem = "PROJCS['World_Mollweide',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mollweide'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],UNIT['Meter',1.0]]"
gp.extent = "-17703215.5609692 -9018645.62975446 17876133.2023738 \
8750470.21662275" # pulled from GRASS ocean layer

# EDIT ME: change to the directory containing the compressed GeoTiffs
ws = "F:\\dev\\p3_fert"

if not os.path.isdir(ws):
    ws = os.getcwd()

gp.workspace = ws
gp.CheckOutExtension("Spatial")
name = os.path.basename(ws)

# EDIT ME: pattern below matches the files you'd like to add
files = glob.glob('plume*.tif*')
r = 'zyxwvutsrqponmlkjihgfedcba'
ra  = [r[i] for i in range(len(r))]
pass2 = pass3 = []

try:
    for i in range(0, len(files), 10): # add 10 rasters per run
        exp = " + ".join(files[i:i + 9])
        output ='%s_%s' % (name, ra.pop())
        pass2.append(output)
        print "generating %s" % output
        gp.SingleOutputMapAlgebra("(%s)" % exp, output)
   
    
    for i in range(0, len(pass2), 5): # add 5 rasters per run
        exp = " + ".join(pass2[i:i+4])
        output = '%s_%s_2' % (name, ra.pop())
        pass3.append(output)
        print "generating %s" % output
        gp.SingleOutputMapAlgebra("(%s)" % exp, output)
    
    exp = " + ".join(pass3)
    print "generating merged final output %s" % name
    gp.SingleOutputMapAlgebra("(%s)" % exp, name)

except:
    print gp.GetMessages()
{'fraction_non_alphanumeric': 0.15052865887590428, 'fraction_numerical': 0.07484696716750139, 'mean_word_length': 4.240524781341108, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7424738', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1334, 'n_words': 305}