AnsweredAssumed Answered

convert one row values to another row

Question asked by helenak on Jul 9, 2012
Latest reply on Jul 11, 2012 by m.gasior
System ArcGIS 9.3
Problem:

I have some polygon shapefiles.
One of their attribute tables is as followed.
(min=> temperature_min; max=> temperatue_max)

FID  Shape  Bird_ID  temp_min  temp_max
0     polygon      S           10           20
0     polygon      W          18           26


Now I want to convert the table above into a new form:

FID  Shape  Bird_ID  temp_min_S  temp_max_S  temp_min_W  temp_max_W
0     polygon      S                10 (under temp_min_S)               20   (under temp_max_S)                         
1     polygon      W                                                      18 (under temp_min_W)           26 (under temp_max_W)

Please kindly advise how to write the expression code in the code below.
Thank you in advance.

##Script Name: Convert one row to another  ##Created By: Elaine Kuo ##Date: 10/07/2012   #Import standard library modules import arcgisscripting import os  #Create the Geoprocessor object gp = arcgisscripting.create(9.3)  #Set the input workspace #GP.workspace = sys.argv[1] #Set the workspace. gp.Workspace= "H:/temp/test"  #Set the output workspace #outWorkspace = sys.argv[2] #Set the workspace. List all of the feature classes in the dataset outWorkspace= "H:/temp"    #Get a list of the featureclasses in the input folder fcs = gp.ListFeatureClasses()  # Loop through every item in the list that was just generated for fc in fcs:      # Break out the name, no path or extension, using the describe object.     desc = gp.describe(fc)     featureName = desc.name      #Validate the new feature class name for the output workspace.     gp.Toolbox = "Data Management"      # Add a field to this shapefile     gp.addfield (fc, "min", "double", 6,3)           # Loop through every item in the list that was just generated            gp.toolbox = "Data Management"       expression = "!min!"              gp.CalculateField_management(fc, "min", expression, "PYTHON")            #Validate the new feature class name for the output workspace.     OutFeatureClass = outWorkspace + os.sep + gp.ValidateTableName(fc,outWorkspace)  gp.AddMessage(gp.GetMessages()) print gp.GetMessages()

Outcomes