Skip to content

Add project setup CLI script - #75

Merged
dbetchkal merged 8 commits into
mainfrom
feature/project_setup
Jul 13, 2026
Merged

Add project setup CLI script#75
dbetchkal merged 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.

@dbetchkal
dbetchkal merged commit 0ac843c into main Jul 13, 2026
1 check passed
@dbetchkal
dbetchkal deleted the feature/project_setup branch July 13, 2026 18:42
elliott-ruebush added a commit that referenced this pull request Jul 14, 2026
Preserve dbetchkal's Inputs/Returns/Notes docstrings from PR #75 in the
setup package, module preamble, NMSIM quirk comments, NLCD TODO, and CLI
print messages. Match original function signatures for elevation/gridfloat.

Co-authored-by: Cursor <cursoragent@cursor.com>
elliott-ruebush added a commit that referenced this pull request Jul 22, 2026
Use microphone.crs from get_deployment() when launching the ground-truthing app instead of passing the coords_to_utm() tuple.

Co-authored-by: Cursor <cursoragent@cursor.com>
elliott-ruebush added a commit that referenced this pull request Jul 22, 2026
No active callers use the PR #75 create_NMSIM_* names; project_setup and tests already import the canonical symbols.

Co-authored-by: Cursor <cursoragent@cursor.com>
elliott-ruebush added a commit that referenced this pull request Jul 24, 2026
…#102)

* Fix ground-truthing CRS regression from PR #75.

Use microphone.crs from get_deployment() when launching the ground-truthing app instead of passing the coords_to_utm() tuple.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Extract project_setup logic into nps_active_space/setup.

Move DEM clipping, GridFloat output, site directory creation, and setup_site orchestration into a library package. Thin project_setup.py to argparse and config only. Deduplicate site directory and .sit writing in ActiveSpaceGenerator. Add dem_elevation_units config and setup integration tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Align .sit microphone coords to project UTM zone and add legacy migration.

Write and read .sit easting/northing in the NMSIM project UTM zone (western study-area edge). Split site helpers into site_writer and site_decoder; fail clearly on legacy mic-local zone files with a project_setup rerun command. Add migrate_project_sites.py for in-place .sit rewrites and cross-zone regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Remove unused backward-compat aliases from setup package.

No active callers use the PR #75 create_NMSIM_* names; project_setup and tests already import the canonical symbols.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trim setup package exports and dedupe .sit parsing in get_deployment.

Keep __init__ as a thin entry point for setup_site and NMSIM_DST_CRS; import site helpers from submodules. Use read_sit_file() instead of re-parsing .sit lines in helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
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