Treatment and control cell sampling - #6
Merged
Merged
Conversation
alanalutz
force-pushed
the
cell_sampling
branch
from
August 27, 2026 18:43
8679979 to
a4036d5
Compare
cjthomas730
requested changes
Aug 27, 2026
cjthomas730
left a comment
Collaborator
There was a problem hiding this comment.
Can you please address this point, I'm not sure if I'm missing something in the CRS setting, or if this is just a nitpick
cjthomas730
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements a new sampling strategy for generating 1km2 treatment and control cells, to replace
src/psm/ps_grid_creation.py. Generates a new set of treatment and control cells for all 30 test PAs.Treatment cells are a grid of all fully interior 1km2 cells within a PA (if the PA is small), or a random sample of fully interior km2 cells (if the PA is large). Control cells are a random sample of unprotected 1km2 cells that are within a given distance of a PA, but outside of a given buffer distance from the PA. They must also fall fully outside a given buffer distance from any PA.
The PSM model is updated to use these newly generated grid cells instead of the old ones from
psm_grid_creation.pyCreated, updated, or replaced Files and/or tables
src/psm/get_interior_cells.py: Iterates through a set of PAs and generates a set of valid interior (treatment) 1km2 cells for each PA. If the PA is <500 km2, a grid of all valid interior cells is generated. If the PA is >500 km2, a random sample of valid interior cells is generated.src/psm/get_exterior_cells.py: Iterates through a set of PAs and generates a random sample of valid exterior (control) 1km2 cells for each PA. These are unprotected cells that fall within a given distance of a PA, but outside of a given buffer distance from that PA.notebooks/get_exterior_cells.ipynb: Test notebook for generating exterior (control) cells; was converted tosrc/psm/get_exterior_cells.py.notebooks/ps_model.ipynb: Updated to use the newly generated treatment and control cells instead of the ones generated byps_grid_creation.pyNotes for reviewers
I would appreciate close review on this PR, since this sampling approach is used (largely unchanged) in the current TPARA methodology.
Stack created with GitHub Stacks CLI • Give Feedback 💬