cat-cfs / gcbm_preprocessing

0 stars 2 forks source link

generate_historic_slashburn.py needs "DistType" field created #41

Closed benhudson85 closed 7 years ago

benhudson85 commented 7 years ago

Inserted the following between line 42 and 43 of generate_historic_slashburn.py. Change made locally as there may be a better way to do this. Test in progress.

arcpy.AddField_management("temp_SB", "DistType", "LONG")

Presuming that this will fix the following error:

[Sat 17:42:06] Starting Process: generateSlashburn Traceback (most recent call last): File "preprocessor.py", line 223, in tiler.processHistoricHarvestDisturbances(historicHarvest, sb_base_percent) File "../../../03_tools/gcbm_preprocessing\03_tiler\tiler.py", line 166, in processHistoricHarvestDisturbances sb_shp = sb.generateSlashburn(self.inventory, harvest_shp, "HARV_YR", year_range, sb_percent) File "../../../03_tools/gcbm_preprocessing\03_tiler\generate_historic_slashburn.py", line 43, in generateSlashburn arcpy.CalculateField_management("temp_SB", "DistType", 13, "PYTHON", "") File "C:\Program Files (x86)\ArcGIS\Desktop10.4\ArcPy\arcpy\management.py", line 3360, in CalculateField raise e arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid. ERROR 000728: Field DistType does not exist within table Failed to execute (CalculateField).

benhudson85 commented 7 years ago

Additionally, I think that the "slashburn" layer also needs the DistType field added so that the schema match for the Append arcpy tool. Inserted immediately ahead of the Append step:

arcpy.AddField_management("slashburn", "DistType", "LONG")

Apologies, accidentally overwrote the log file reporting the error about the schema mismatch.

benhudson85 commented 7 years ago

Resolved by Nick in commit:

https://github.com/cat-miti/gcbm_preprocessing/commit/29e6178cfe4cb2656e068b74b28ceb270f38e900