Hello Everyone!
I'm hoping you can help me understand how to accomplish this..I can't quite figure it out.
I have a table of soil horizon data with 65,000 rows, divided into profiles by a key field ("cokey"). I'm trying to sequentially add up values in the "Mm" field, which I've mocked up in the "Mms" field. The idea is essentially this: Mms1 = Mm1, Mms2 = Mm2 + Mms1, Mms3 = Mm3 + Mms2, etc. I can see how to do that, but I need it to stop after running through all the values in a given cokey, and then start again on the next cokey --- and I can't figure that part out!
It seems like this could be accomplished with a for or while loop, looking at the cokey field, but I'm just not conversant enough with python to see how to do it. It would be relatively simple if there weren't a lot of different cokeys, but there are 15,000. Thus far, I've just been using the field calculator and doing it by hand-ish.
Any help or suggestions would be very much appreciated. Thanks!
I'm hoping you can help me understand how to accomplish this..I can't quite figure it out.
I have a table of soil horizon data with 65,000 rows, divided into profiles by a key field ("cokey"). I'm trying to sequentially add up values in the "Mm" field, which I've mocked up in the "Mms" field. The idea is essentially this: Mms1 = Mm1, Mms2 = Mm2 + Mms1, Mms3 = Mm3 + Mms2, etc. I can see how to do that, but I need it to stop after running through all the values in a given cokey, and then start again on the next cokey --- and I can't figure that part out!
It seems like this could be accomplished with a for or while loop, looking at the cokey field, but I'm just not conversant enough with python to see how to do it. It would be relatively simple if there weren't a lot of different cokeys, but there are 15,000. Thus far, I've just been using the field calculator and doing it by hand-ish.
hzname | cokey | Mm | Mms | |
Ap |
|
148.47 | 148.47 | |
A1 |
|
145.56 | 294.03 | |
A2 |
|
141.92 | 435.95 | |
A1 |
|
154.66 | 154.66 | |
A2 |
|
154.66 | 309.32 | |
A3 |
|
154.66 | 463.97 | |
Bw |
|
149.44 | 613.42 |
Any help or suggestions would be very much appreciated. Thanks!