Open johngallo opened 5 years ago
Not positive how "revert" works, so here is a backup of the code:
return norm_rast_list
def clip_to_bound_geom(core_lyr, rast_list): """Clip NLCC rasters using minimum bounding geometry.""" lm_util.gprint("-Clipping NLCC rasters using minimum bounding geometry") bnd_rast_list = [] arcpy.env.extent = rast_list[0][1].extent
for fname, bnd_rast in rast_list:
from_core, to_core = fname.split('_')[1:]
xy_lyr = arcpy.MakeFeatureLayer_management(
core_lyr, out_layer="xy_lyr",
where_clause="{} in ({}, {})".format(
lm_env.COREFN, from_core, to_core))
bnd_fc = os.path.join(lm_env.SCRATCHGDB, fname)
if arcpy.CheckProduct("ArcInfo") == "Available":
arcpy.MinimumBoundingGeometry_management(
xy_lyr, bnd_fc, geometry_type="CONVEX_HULL",
group_option="ALL")
else:
arcpy.MinimumBoundingGeometry_management(
xy_lyr, bnd_fc, geometry_type="CIRCLE", group_option="ALL")
bnd_rast = arcpy.sa.ExtractByMask(bnd_rast, bnd_fc)
bnd_rast_list.append([fname, bnd_rast])
lm_util.delete_data(bnd_fc)
arcpy.env.extent = None
save_interm_rast(bnd_rast_list, "bp_step2")
return bnd_rast_list
def clip_nlcc_to_threashold(lcp_list): """Clip NLCC_A_B rasters to CWD threshold. etc,
then:
Also reverting this one line of code:
this is related to this google doc, and there is an issue here in git hub about this as well. https://docs.google.com/document/d/1XNsdH6jCBHkAoWfioPP_JKpn8mKrQ4sQcUxsvVy7ibQ/edit#heading=h.1m64lw5uhov0
I believe this is fixed in 2ec00e8f198cd8633c4f84779af4824a59f35dd4
I believe that commit 2ec00e8 simply undid the first attempt at cleaning the lee side of linkages: https://docs.google.com/document/d/1XNsdH6jCBHkAoWfioPP_JKpn8mKrQ4sQcUxsvVy7ibQ/edit#heading=h.1m64lw5uhov0
I'll try to remember to look at this the next time I am beta testing with the sample data.
I believe that what still needs to be done is to, try it again, but instead of clipping the linkage to bounding geometries, we need to add more nuance to the code. Here was the initial brainstorm:
"After that, ways to solve this include buffering the minimum bounding geometery (or circle) by x CWD units.
Or maybe even only doing this if the core is at the edge or a region / does not have any other linkages emanating from it in the direction of the clipped area of the first linkage..."
Clipping the NLCC rasters using minimum bounding geometry solves one problem, but introduces another in certain situations where a decent linkage leaves a core at 90 degrees or more away from the direct path to the other core. And, the core in question is at the edge of the study region.
Example in the demo data here:
this can be solved in one of several ways.
For starters, it may be best turn this feature off by commenting out the one line of code that calls the funtion.
After that, ways to solve this include buffering the minimum bounding geometery (or circle) by x CWD units.
Or maybe even only doing this if the core is at the edge or a region / does not have any other linkages emanating from it in the direction of the clipped area of the first linkage...
First of all, the code involved is commit: 7952f1f2de4442d6a3c64e6e91deff3a14a6158d
"Create new method to clean up lee-side of linkages"