Two searchcursors and updatecursor in feature table

444
1
02-25-2013 04:37 AM
FranciNovak
New Contributor III
I have started looking at Python in Arcgis.
My aim is to build water hydraulic model from digital cadastre using model builder.

Water cadastre is broken into many small pieces.
Each sector (pipe) has attributes about the type of distribution, material, profil, age, etc., but not all.
Some pipes are without any attibuttes. Their reocords have no data.

So I have pipes and numerated nodes for these pipes. Each pipe has in his table  FROM NODE and TO NODE number.
I would like to write code in Python which would fill no data cells (NN,0 ) in table:
Each pipe without attributes would acquire attributes from previous pipe the same type with attributes.
I think i will have to repeat that process many times.

Table structure:
[ATTACH=CONFIG]22136[/ATTACH]
 
Steps:

  1. select pipes ID = PK and OZN_KAT = NN

  2. find FROM NODE for that pipe

  3. find TO NODE = FROM NODE for previous pipe

  4. copy [OZN_KAT], [MATERIAL], [PROFIL], [LETO_VGR] from previous pipe to desired pipe.

Can you give me a clue how to do that? Or something more.
I would like to use code first in Python and then also in calculate value toolbox.

thnx
Tags (2)
0 Kudos
1 Reply
MathewCoyle
Frequent Contributor
How many features are you going to be going through? Is this a process you will be doing often or rarely? Depending on this you could read out the entire dataset to a dictionary using a search cursor then use an update cursor on the rows you want to transfer the values to. This would probably be the fastest method if a bit memory intensive depending on the size of your dataset.

If that isn't the route you want to take you could use nested cursors as you described in your title. This may be one of the few cases it might make sense to use nested cursors if this is a process you rarely do and/or you are dealing with a very large dataset with many row pairs you need to read and write.
0 Kudos