Skip to content

Add project setup CLI script#75

Open
dbetchkal wants to merge 8 commits into
mainfrom
feature/project_setup
Open

Add project setup CLI script#75
dbetchkal wants to merge 8 commits into
mainfrom
feature/project_setup

Conversation

@dbetchkal

@dbetchkal dbetchkal commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Closes #35. Closes #69. Intended to replace NMSIM_CreateBaseLayers.ipynb and to further escape the need for an ArcGIS Pro license.

  • Flexible ingestion of the two contextual inputs to NPS-ActiveSpace (study area + listening location). will add later
  • Initialize a standard NMSIM site directory given inputs from config file.
  • Automatically clip, convert units and save .tif DEM output for downstream modules.
  • Save ESRI GridFloat format (.flt, .hdr) for modeling.
  • Save NMSIM .sit file to represent the listening location.
  • Update script usage README appropriately.

@dbetchkal dbetchkal linked an issue Jun 29, 2026 that may be closed by this pull request
@dbetchkal dbetchkal self-assigned this Jun 29, 2026

@elliott-ruebush elliott-ruebush left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Edit: apologies if this PR wasn't ready for review - I missed that it was still marked as a draft

Nice! This'll be sweet to get in the repo rather than needing that separate ArcGIS workflow.

I've left some comments with questions/potential suggestions, lmk if you want to chat more on anything

Comment thread nps_active_space/scripts/README.md
Comment thread nps_active_space/utils/computation.py Outdated
Comment thread nps_active_space/utils/computation.py Outdated
Comment thread nps_active_space/scripts/run_audible_transits.py
Comment thread nps_active_space/utils/helpers.py Outdated
Comment thread nps_active_space/utils/helpers.py Outdated
Comment thread nps_active_space/scripts/project_setup.py Outdated

@arpitjain099 arpitjain099 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition - having a setup script that handles directory creation + DEM clipping + site file in one step will save a lot of manual work.

A couple things I noticed:

  1. The new make_NMSIM_site_dir() and create_NMSIM_site_file() use Windows-style backslash paths (e.g. r"Input_Data\01_ELEVATION", r"Input_Data\05_SITES"). Since the codebase is moving toward cross-platform support, these could use os.path.join("Input_Data", "01_ELEVATION") etc. Same for output_base in project_setup.py.

  2. The coords_to_utm() return type changes from str to tuple[str, int] here, which is a good change (callers often need the zone number). Worth noting that PR #84 also touches coords_to_utm() callers, so there will be a merge conflict between the two. Happy to rebase #84 once this lands, or we can coordinate.

  3. Small typo in scripts/README.md: "Fundemental" should be "Fundamental".

  4. Missing newline at end of helpers.py.

@dbetchkal dbetchkal marked this pull request as ready for review July 7, 2026 17:39
@dbetchkal dbetchkal requested a review from elliott-ruebush July 9, 2026 16:37
@elliott-ruebush

elliott-ruebush commented Jul 9, 2026 via email

Copy link
Copy Markdown
Collaborator

@elliott-ruebush elliott-ruebush left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed commenting on this on first pass, but I was looking some more and wanted to raise the point that some of these setup functions are seemingly duplicated between here and ActiveSpaceGenerator https://github.com/dbetchkal/NPS-ActiveSpace/blob/main/nps_active_space/active_space/active_space_generator.py

project_setup.py ActiveSpaceGenerator
create_NMSIM_site_dir() _make_dir_tree()
create_NMSIM_site_file() _create_site_file()
create_gridfloat() _create_dem_flt()
create_NMSIM_elevation_tif() _mask_dem_file() (+ project_raster() in computation.py)

So it seems that there's some repetition of function defintions across the two.

IMO the correct place for this to live might be project setup scripts, so maybe we move forward with merging this PR and then move the logic out of active space generator in a follow-up

@arpitjain099

Copy link
Copy Markdown
Contributor

Good catch on the duplication @elliott-ruebush. I ran into the same thing when reviewing - the DEM clipping and site file creation logic in ActiveSpaceGenerator does roughly the same work as what's here. Merging this first and then pulling the shared logic into one place sounds like the right order to me. Would keep this PR's scope clean and avoid a messy rebase.

help="Study area NE corner x y (WGS84). Example: -135.818994 58.706095")
args = parser.parse_args()

feet_to_meters = 0.3048

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change needed on this PR.

One other minor [nit], I think that it's nice to define constants like these as all caps global vars at the top of the files. e.g. FEET_TO_METERS = 0.3048

I have a later change which will add a few general constants, so I'll take a quick pass at updating this then. Something like FEET_TO_METERs in particular feels like it could live somewhere central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorporate create_NMSIM_site_file or similar into utils DEM transformation into meters should be automated

3 participants