POST
|
Thanks Dan. I knew you would have an interesting and creative way to attack this. Yes, example number 2 is exactly what I am looking for. And that's great because in my example I mentioned 6hr but I will also be doing this for 24 and 72 hour durations as well.
... View more
03-05-2016
04:05 AM
|
0
|
2
|
1808
|
POST
|
Hope this is legible. Each field represents 1 hours worth of precipitation for a particular storm for a particular grid cell. This example has only 2 records for simplicity, the actual database will have thousands. What I want to do is find the consecutive 6 hour period that had the largest total precipitation for every record and input that value to the Max_Precip field. So it would take fields [0] - [5],[1]-[6], [2]-[7],,ect and sum the total for each of those durations and and put them in a list. Then before it moves to the next record it would find the max precipitation amount for whatever duration had the most precipitation from the list and update the Max_Precip field. Then clear the list and do the same for the next record. Unless there is an easier way. Hope that makes sense....
... View more
03-04-2016
09:48 AM
|
0
|
1
|
1808
|
POST
|
Can somebody please help me, I have been struggling with this part of my script for hours now. I need to list the precip fields from my point feature class: Create empty MaxValue list For every record in my attribute table: Add up(SUM) values from first 6 fields [0]-[5] and append value to list (by record line) Add up(SUM) values from next group of 6 fields [1]-[6] and append value to list Add up(SUM) values from next group of 6 fields [2]-[7] and append value to list Loop to end of field list making sure it does not error at the end if it is not a full group of 6 records After I have a MaxValue list it finds the MAX from that list and adds that to the MaxPrecip field. (I think I can get this part its just incrementally iterating over and summing groups of fields by record that is killing me) Repeat for every point, there may be thousands of points and 20 or 120 fields. >>> PrecipFields = [f.name for f in arcpy.ListFields("asciiPoints","*")] >>> with arcpy.da.UpdateCursor("asciiPoints",PrecipFields) as cursor: ... for row in cursor: ... MaxValue = [] ... i = 0 ... for i in range(len(PrecipFields)): ... v = row + row[i+1] + row[i+2] + row[i+3] + row[i+4] + row[i+5] ... Val.append(v) ... i = i+1 Am I even close? Thanks
... View more
03-04-2016
06:43 AM
|
0
|
7
|
5213
|
POST
|
This would do that right? Same result... >>> with arcpy.da.UpdateCursor("asciiPoints",PrecipFields) as cursor: ... for row in cursor: ... for field in PrecipFields: ... if row[0] == None: ... row[0] = 0 ... cursor.updateRow(row) Also tried this... >>> i = 0 >>> with arcpy.da.UpdateCursor("asciiPoints",PrecipFields) as cursor: ... for row in cursor: ... if row == None: ... row = 0 ... cursor.updateRow(row) ... i += 1
... View more
03-02-2016
10:45 AM
|
0
|
0
|
1932
|
POST
|
That doesn't work for me either. No error just nothing happens.
... View more
03-02-2016
10:16 AM
|
0
|
2
|
1932
|
POST
|
Can somebody point out what I am doing wrong here? I am trying to get a list of fields (PrecipFields) and replace all null values with 0. When I call out a specific field it works fine. When I use list of fields it looks as if it runs but non of the values are updated. >>> with arcpy.da.UpdateCursor("asciiPoints",["ippt_allsites_spas1325_024_19230927_0700_UTC"]) as cursor: ... for row in cursor: ... if row[0] == None: ... row[0] = 0 ... cursor.updateRow(row) Works fine... My field list I want to use... >>> print PrecipFields [u'ippt_allsites_spas1325_021_19230927_0400_UTC', u'ippt_allsites_spas1325_022_19230927_0500_UTC', u'ippt_allsites_spas1325_023_19230927_0600_UTC', u'ippt_allsites_spas1325_024_19230927_0700_UTC', u'ippt_allsites_spas1325_025_19230927_0800_UTC', u'ippt_allsites_spas1325_026_19230927_0900_UTC', u'ippt_allsites_spas1325_027_19230927_1000_UTC', u'ippt_allsites_spas1325_028_19230927_1100_UTC' This is a shortened list. There could be hundreds of fields. Nothing happens... >>> with arcpy.da.UpdateCursor("asciiPoints","PrecipFields") as cursor: ... for row in cursor: ... if row[0] == None: ... row[0] = 0 ... cursor.updateRow(row) ...
... View more
03-02-2016
10:10 AM
|
0
|
6
|
3639
|
POST
|
I have a point feature class with fields representing hourly precipitation amounts for a particular storm and many thousands of records. The number of fields will vary from storm to storm. I am trying to get the max 6 hour precipitation amounts. I need it to list fields, SUM row for 1st-6th field, and assign it to Max Precip Field. Then SUM row for fields 2-7 and if it is larger than 1-6 assign that value, if not leave it the 1-6 value. Need this to loop till the end of the fields and for every record. Can somebody recommend the best way and some syntax to accomplish this? Would this be best accomplished with a numpy array or Update cursor?
... View more
03-01-2016
10:46 AM
|
0
|
2
|
2232
|
POST
|
Thanks again Dan! Your example was exactly what I needed. Very helpful!
... View more
02-26-2016
07:38 AM
|
0
|
0
|
630
|
POST
|
I get your example when you manually put in the V values. However, the V value and the obs value will need to be dynamic variables. Here is a breakdown of exactly what I am trying to do. If you look at the above Image, its the attribute field of my point feature class. The Precip_Amount is the observed depth. "obs" variable. The next 8 fields are precipitation Frequency depth amounts by year. Each field representing a year amount. 5, 10, 25 and so on. "v" variable. I want to use those and the harcoded "Years" variable to interpolate the ARI field with the recurrence interval. This will have to be done for 370k records with different v and obs values for every record. Then I want to export the points to a raster. Which I know how to do but if I go to an array I need to be able to get back to points.
... View more
02-25-2016
02:01 PM
|
0
|
1
|
2250
|
POST
|
Thanks again. So would I just use an update cursor and for loop as normal to populate the "V" and "obs" variables to feed into the interp command?
... View more
02-25-2016
01:31 PM
|
0
|
3
|
2250
|
POST
|
Thanks for taking the time yesterday to show me about numpy and arrays. I have created an array of my point feature class. Can you please provide an example syntax of how I would loop through the array and assign the variables to obs and v to do the calculation for rec_int? When I use arr.shape on my array it says I have 378288 records but no rows. Is this ok or will I need to reshape it somehow? I tried a bit but didn't have much luck. I assume then this array can be converted back to points once the Recurrence interval field is calculated? Any help would be greatly appreciated. Thanks and have a great day.
... View more
02-25-2016
12:35 PM
|
0
|
5
|
2250
|
POST
|
Thank you so much! I am still a little confused on how to find the bounding precipitation values and years and assign them to the variables for all of the 500K points.
... View more
02-24-2016
01:10 PM
|
0
|
7
|
2250
|
POST
|
In the table on the Image below, ippt_allsi represents precipitation amounts for a given storm. The rest of the fields represent the precipitation amounts for that number of years recurrence intervals. 2, 5,10, 25, 50 and so on. I need a script that will take the precipitation amount for the storm, (appt_allsi) then find the bounding larger and smaller values and interpolate the recurrence year by where the precipitation amount falls between those years values. For instance, for the first record, 3.84 inches of rain fell. The 100 year amount is 3.615 and the 200 year amount is 4.059. How would I return the interpolated recurrence year for the 3.84 inches? I am fairly new to python and am struggling. Could somebody please get me started in the right direction?
... View more
02-24-2016
12:45 PM
|
0
|
12
|
4706
|
POST
|
Attached is a diagram of St Louis Counties implementation of the Parcel Fabric if anyone is interested.
... View more
06-03-2014
06:49 AM
|
0
|
1
|
2805
|
Online Status |
Offline
|
Date Last Visited |
03-25-2023
07:37 PM
|