Add tree canopy reprojection helper#14
Add tree canopy reprojection helper#14erin-glen wants to merge 2 commits intopreprocessing/disturbancesfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
reproject_tree_canopy.py
Outdated
| arcpy.env.outputCoordinateSystem, | ||
| resampling_type="NEAREST", | ||
| cell_size=arcpy.env.cellSize, |
There was a problem hiding this comment.
Pass numeric cell size to ProjectRaster
Here cell_size is fed from arcpy.env.cellSize, but _set_env assigns that environment value to the reference raster path string. ProjectRaster expects a numeric cell size, so when the env value is a path this call can fail with an “invalid cell size” error and stop all reprojections. Consider passing a numeric size (e.g., Describe(ref).meanCellWidth) or omitting cell_size and letting the environment setting take effect.
Useful? React with 👍 / 👎.
Motivation
Description
reproject_tree_canopy.py, which scanscfg.NLCD_TCC_INPUT_DIRandcfg.NLCD_TCC_INPUT_DIR_FALLBACKfor*.tiffiles that do not end with_projected.tif.arcpyenvironment (snapRaster,cellSize,extent,outputCoordinateSystem) from the reference raster atcfg.NLCD_RASTERand usearcpy.management.ProjectRasterto reproject._projectedbefore the.tifextension and skip files where the output already exists.NEARESTresampling andarcpy.env.overwriteOutput = Truewhile checking out theSpatialextension.Testing
Codex Task