cat-cfs / gcbm_preprocessing

0 stars 2 forks source link

projected_disturbances_placeholder.py missing temporary layer #43

Closed benhudson85 closed 7 years ago

benhudson85 commented 7 years ago

Encountered issues of layer not existing so adjusted the script to skip the use of fire_proj_dist_temp1. Edit posted below seemed to work. Using this locally. Please review and advise if it's okay.

    if fire_areaValue>0:
        fire_proj_dist_temp = "fire_proj_dist_temp"
        for year in self.year_range:
            arcpy.SubsetFeatures_ga(in_features="inventory_gridded_1990", out_training_feature_class=r"{}\{}".format(self.outLocation,fire_proj_dist_temp), out_test_feature_class="", size_of_training_dataset=fire_areaValue, subset_size_units="ABSOLUTE_VALUE")
            arcpy.AddField_management(fire_proj_dist_temp, field_name=self.distYr_field, field_type="LONG", field_precision="", field_scale="", field_length="", field_alias="", field_is_nullable="NULLABLE", field_is_required="NON_REQUIRED", field_domain="")
            arcpy.CalculateField_management(fire_proj_dist_temp, field=self.distYr_field, expression=year, expression_type="PYTHON", code_block="")
            pp.updateProgressP()

        # update the dist type and regen delay
        arcpy.CalculateField_management(fire_proj_dist_temp, field=self.distType_field, expression=self.fire_code, expression_type="PYTHON", code_block="")
        arcpy.CalculateField_management(fire_proj_dist_temp, field=self.regen_delay_field, expression="0", expression_type="PYTHON", code_block="")

        arcpy.Append_management(fire_proj_dist_temp, projected_disturbances)
        arcpy.Delete_management(fire_proj_dist_temp)
naddison1 commented 7 years ago

Ah, my bad, I should really have some fire in my test area.. I don't know if this will work though, since for each year the layer "fire_proj_dist_temp" will be overwritten so I think it would only add the fire from the last year. Anyway, I'm testing with fire now, and I'll upload a fix shortly

benhudson85 commented 7 years ago

Resolved by Nick in commit:

https://github.com/cat-miti/gcbm_preprocessing/commit/55c4124fe205a9e5e984a3d88b222c590f62195a