AnsweredAssumed Answered

How to solve the error:out of memory

Question asked by hs1991 on Jan 10, 2016
Latest reply on Jan 20, 2016 by xander_bakker

I want to use the clip function in python, the code is as follow:

 

import os

from multiprocessing import Pool

import arcpy

from arcpy import env

def data_clip(shp):

    env.workspace = r"F:/GCM_CMIP5/FGOALS-g2(LASG-CESS)/mrro/ShpFile/f"

    clip_features = "D:/Research/boundry.shp"

    pre, suf = os.path.splitext(shp)

    new = pre + "_china" + suf

    in_mem = os.path.join("in_memory", pre)

    out_feature_class = os.path.join("F:/GCM_CMIP5/FGOALS-g2(LASG-CESS)/mrro/ChinaShpFile", new)

   

    arcpy.Clip_analysis(shp, clip_features, in_mem)

    arcpy.CopyFeatures_management(in_mem, out_feature_class)

    arcpy.DeleteFeatures_management(in_mem)

 

if __name__ == "__main__":

    env.overwriteOutput = True

    env.workspace = r"F:/GCM_CMIP5/FGOALS-g2(LASG-CESS)/mrro/ShpFile/f"

   

    p = Pool(7)

    fcs = arcpy.ListFeatureClasses()

    p.map(data_clip, fcs)

   

    print('Clip finish!')

 

 

But I got the "out of memory" error.

1.png

If anyone knows how to solve this problem?

Thank you so much!!!

Outcomes