I am following the [accepted answer][1] for the question: http://gis.stackexchange.com/questions/16715/batch-conversion-of-netcdf-to-raster-in-arcgis-using-python, obviously, to convert netcdfs. The code taken from the above answer (pasted below) works fine on a single NetCDF. However, if I run the same function on many `.nc` files by making `inNetCDF` variable a parameter, ArcMap breaks down. It crashes with ArcGIS 10.1 and hangs with ArcGIS 10.2.2 (on two different machines) after generating about 500 or 600 images.
 
I suspected that the issue is that ArcMap can't handle this many layers (more than 1000 considering the extracted nc layers). So I added:

          arcpy.env.addOutputsToMap = False

to forbid adding output to the content index, but the crashes still remain.

So my questions are:

1. Is it possible to run the involved ArcToolbox functions like `CopyRaster_management` outside of ArcMap from command line python?

2. If not, how to avoid the crash problem?

Thanks.

--[code][1]--

    def extractAllNetCDF():
        
        variable = "RRt_10m"
        x_dimension = "lon"
        y_dimension = "lat"
        band_dimension = ""
        dimension = "time"
        valueSelectionMethod = "BY_VALUE"
        
        outLoc = "E:/New Folder/"
        inNetCDF = "E:/netCDFFiles/RRt.nc"
        
        nc_FP = arcpy.NetCDFFileProperties(inNetCDF)
        nc_Dim = nc_FP.getDimensions()

        for dimension in nc_Dim:
            top = nc_FP.getDimensionSize(dimension)
            for i in range(0, top):
                if dimension == "time":
                    
                    dimension_values = nc_FP.getDimensionValue(dimension, i)
                    nowFile = str(dimension_values)

                    #THIS IS THE NEW CODE HERE
                    dv1 = ["time", dimension_value]
                    dimension_values = [dv1]
                    #END NEW CODE
                    
                    arcpy.MakeNetCDFRasterLayer_md(inNetCDF, variable, x_dimension, y_dimension, nowFile, band_dimension, dimension_values, valueSelectionMethod)
                    arcpy.CopyRaster_management(nowFile, outLoc + nowFile + ".img", "", "", "", "NONE", "NONE", "")
                    print dimension_values, i 

 




  [1]: http://gis.stackexchange.com/a/16838/34474