Select to view content in your preferred language

Python Script Dissolve (in_)memory Error

797
6
02-07-2024 01:17 PM
TylerT
by
Frequent Contributor

Hello,

The following code produces an the following error:

 

 

 

fc_mem_1 = r"memory\temp_1"
...
fc_mem_2 = r"memory\temp_2" # memory fails, use in_memory
arcpy.analysis.PairwiseDissolve(fc_mem_1, fc_mem_2, 'cl_id', statistics_fields=stat_fields, multi_part='MULTI_PART')

 

 

 

TylerT_0-1707340078538.png

While the following code does not produce an error:

 

 

 

fc_mem_1 = r"memory\temp_1"
...
fc_mem_2 = r"in_memory\temp_2"
arcpy.analysis.PairwiseDissolve(fc_mem_1, fc_mem_2, 'cl_id', statistics_fields=stat_fields, multi_part='MULTI_PART')

 

 

 

I understand in_memory to be a legacy workspace.  Is this expected behavior with PairwiseDissolve and Dissolve?

Thank you,

Tyler

ArcGIS Pro 3.1.0

0 Kudos
6 Replies
MErikReedAugusta
MVP Regular Contributor

Somehow I missed the boat on "IN_MEMORY" becoming "MEMORY".  Do you have sources on that?  Because I clearly need to catch up on some reading.

------------------------------
M Reed
"The pessimist may be right oftener than the optimist, but the optimist has more fun, and neither can stop the march of events anyhow." — Robert A. Heinlein, in Time Enough for Love
0 Kudos
BlakeTerhune
MVP Regular Contributor
0 Kudos
KimOllivier
Honored Contributor

Yes, well the Pro developers forgot to read the ArcMap manuals.... there is now a synonym to patch up the syntax. I presume that it is a different mechanism under the hood. It never worked reliably for me anyway, so I just use an SSD drive as my scratch.gdb. You can easily run out of memory if you do not release the features, and who does that? Also projections did not work etc.

0 Kudos
KimOllivier
Honored Contributor

Save (in_)memory for simple tasks. It is a lot of people's experience that it does not always work for complex tasks like Dissolve. It did not work for me with geometry objects or reprojections.  If you have an SSD then define a partition or just a disk letter and use that for the scratch.gdb and other temporary featureclasses. Since it is effectively equivalent hardware you will get all the benefits of cached read/writes and more reliable operation with the same speed and not run out of memory.

0 Kudos
TylerT
by
Frequent Contributor

I just ran into the same with with arcpy.analysis.Union().  The out_feature_class will not accept memory\ but will accept the legacy in_memory.

ESRI?  Thoughts?

Thank you.

Tyler
ArcGIS Pro 3.3

0 Kudos
KevinGabelman
Emerging Contributor

Well, you definitely cannot have file extensions when you're using the memory workspace(s). And more generally speaking, I have found it pretty difficult to manage arcpy memory datasets unless they're being consumed almost immediately. In addition, there are certain spatial GP - Dissolve included - with which I never use memory. The need for an index (or something) means the tool doesn't usually work right.

0 Kudos