-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Acoustics module update #34
base: main
Are you sure you want to change the base?
Acoustics module update #34
Conversation
Just starting this. Still have work to do on updating the calculations, but this will be the next large update. |
…Envision/seat-qgis-plugin into acoustics_module_update merging new changes
Hey @tnelson-integral I hope you had great holidays. How are we doing over here and do you need any help? |
Hi Sterling,
The holidays were great. I hope you had a great holiday season too. I have updated the plugin to fix all bugs we could find internally, including adding another person at Integral to test. We made a few changes to the tutorial data, now having a deployed folder that works with the Main branch on GitHub. For the "in-development" branches, such as the Acoustics updates, the data is in a Development directory with subdirectories for active branches. I was still having trouble passing all the tests for the repository. I applied the black formatting plugin and ran it for each file, but still have a few issues. Due to function changes and variable renaming, some of the test scripts have likely broken. The documentation is mostly up to date. One last change we made was renaming "risk layer" to "area of interest," which has not been updated in the documentation. I believe we are going to discuss the documentation efforts in an upcoming meeting. On my end, the plugin works for me and Ashley. You are welcome to test it as well and please let me know if you run into any issues. There are new style files in the folder "Development/DEMO Files Tabbed GUI - Acoustics_AOI." I am going to resend links to the deployed and development folders to you in case the existing share was broken during reorganization.
…-Tim
Tim Nelson (he/him/his) | Senior Scientist
Tel: 561.240.5096 | Cell: 803.319.3344 | St. Petersburg | FL
***@***.*** | Bio<https://www.integral-corp.com/staff/timothy-r-nelson-ph-d>
<https://www.integral-corp.com/>[cid:integral_1a04a855-2877-4c4f-bd98-b89de3950d0f.png]<https://www.integral-corp.com/>
________________________________
From: ssolson ***@***.***>
Sent: Friday, January 10, 2025 8:11 AM
To: sandialabs/seat-qgis-plugin ***@***.***>
Cc: Tim Nelson ***@***.***>; Mention ***@***.***>
Subject: Re: [sandialabs/seat-qgis-plugin] Acoustics module update (PR #34)
[CAUTION: External email. Think before you click links or open attachments.]
This is still undergoing review. I will send you an email once this is ready.
Hey @tnelson-integral<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_tnelson-2Dintegral&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Yn83XI9QZV7rQ_mUtW6CoZUSMmSwPyFFoLpXJDIGmB_gQitci6XYbPIEU_R2LsGJ&s=UT2hBifKl937tUR2WTmJhUDXhqEcywI5PO_T5vqFMN4&e=> I hope you had great holidays. How are we doing over here and do you need any help?
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sandialabs_seat-2Dqgis-2Dplugin_pull_34-23issuecomment-2D2582683911&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Yn83XI9QZV7rQ_mUtW6CoZUSMmSwPyFFoLpXJDIGmB_gQitci6XYbPIEU_R2LsGJ&s=u3scYytRsZE2W7-7zr5no_yZCt75SqyEADTRCCMCPMc&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AZARDBNMLY5IPNL5IEBEXKD2J7BJLAVCNFSM6AAAAABJ6TD5U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKOBSGY4DGOJRGE&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Yn83XI9QZV7rQ_mUtW6CoZUSMmSwPyFFoLpXJDIGmB_gQitci6XYbPIEU_R2LsGJ&s=1mSYH1RrfBZrWtrCHY_c_pKTgb8IrlMgfhxDrPlFowM&e=>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi @ssolson. Everything is updated on our end. Let us know if you have any other recommendations. -Tim |
Thanks Tim. I'll take a look this week. |
Why have you created a "seat-qgis-plugin[]" folder in addition to the "seat" folder? There should only be one folder and the canonical folder is "seat". Please update all of the changes you are proposing into the correct folder. Please be careful to only update your changes into the correct folder. I am worried you are working off some old files and I am going to have to redo all the linting work I did if you simply copy paste one folder into the other. Why are you trying to commit 3 different zip files to the main? |
Hi Sterling,
The seat-qgis-plugin[] folder appears to have been committed on Jan 21st, after all code changes were completed in "seat". I removed the zip files which seem to have been committed by accident. I will remove the seat-qgis-plugin[] folder after talking with Ashley and then commit all changes.
-Tim
Tim Nelson (he/him/his) | Senior Scientist
Tel: 561.240.5096 | Cell: 803.319.3344 | St. Petersburg | FL
***@***.*** | Bio<https://www.integral-corp.com/staff/timothy-r-nelson-ph-d>
<https://www.integral-corp.com/>[cid:integral_1a04a855-2877-4c4f-bd98-b89de3950d0f.png]<https://www.integral-corp.com/>
…________________________________
From: ssolson ***@***.***>
Sent: Tuesday, February 4, 2025 11:02 AM
To: sandialabs/seat-qgis-plugin ***@***.***>
Cc: Tim Nelson ***@***.***>; Mention ***@***.***>
Subject: Re: [sandialabs/seat-qgis-plugin] Acoustics module update (PR #34)
[CAUTION: External email. Think before you click links or open attachments.]
@tnelson-integral<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_tnelson-2Dintegral&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=_mDScRxtdSR_wXDOXggN2wUPNsS5NIGNm2EJG2BUHrC5RwPD2UP0MQJa4fdURKhF&s=q9_hyA94ARUGe3Kl_jSRVxWmTfvEHUEnfenXp_dJpkI&e=>
Why have you created a "seat-qgis-plugin[]" folder in addition to the "seat" folder? There should only be one folder and the canonical folder is "seat".
Please update all of the changes you are proposing into the correct folder. Please be careful to only update your changes into the correct folder. I am worried you are working off some old files and I am going to have to redo all the linting work I did if you simply copy paste one folder into the other.
Why are you trying to commit 3 different zip files to the main?
—
Reply to this email directly, view it on GitHub<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sandialabs_seat-2Dqgis-2Dplugin_pull_34-23issuecomment-2D2634410397&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=_mDScRxtdSR_wXDOXggN2wUPNsS5NIGNm2EJG2BUHrC5RwPD2UP0MQJa4fdURKhF&s=G78_Be2_gXv6A_doETvDOUArWTdbiYbDpcugvqu5-a8&e=>, or unsubscribe<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AZARDBMEPWFZLNW7CH7EVET2ODQDDAVCNFSM6AAAAABJ6TD5U2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZUGQYTAMZZG4&d=DwMFaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=_mDScRxtdSR_wXDOXggN2wUPNsS5NIGNm2EJG2BUHrC5RwPD2UP0MQJa4fdURKhF&s=AD3iHHHPZ31xwL-kxDUCTzlAaxU5x2TJLvn9ayCADpo&e=>.
You are receiving this because you were mentioned.
|
Fantastic. Thanks Tim. |
paracousti_directory = r"C:\Users\aellenson\OneDrive - Integral Consulting Inc\C1308 Sandia\Tutorial_Files\Development\DEMO Files Tabbed GUI - Acoustics\pacwave\paracousti_files\\" | ||
save_directory = r"C:\Users\aellenson\OneDrive - Integral Consulting Inc\C1308 Sandia\Tutorial_Files\Development\DEMO Files Tabbed GUI - Acoustics\pacwave\paracousti_files_with_metrics_TU\\" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tim what do you think the best way to clean this up would be?
We shouldn't be pushing hardcoded local paths into a public tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about setting up the file to take sysargs?
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
ParAcousti pre-processing routine.
This module processes parAcousti files, which can be resource intensive depending on
grid resolution and weights selected. Processing may take several hours to complete.
Required packages:
- xarray with netCDF4 (pip install "xarray[io]")
- scipy (included with xarray[io])
- tqdm (pip install tqdm)
"""
import argparse
from pathlib import Path
from . import utils.paracousti_fxns as paracousti_fxns
def process_paracousti_files(input_dir: str, output_dir: str, weights: str = "TU") -> bool:
"""
Process parAcousti files and calculate metrics.
Args:
input_dir: Directory containing parAcousti files
output_dir: Directory to save processed files
weights: Weight type to use ("TU" or "All")
Returns:
bool: True if processing successful, False otherwise
"""
input_path = Path(input_dir)
output_path = Path(output_dir)
if not input_path.exists():
raise FileNotFoundError(f"Input directory not found: {input_dir}")
output_path.mkdir(parents=True, exist_ok=True)
return paracousti_fxns.calc_paracousti_metrics(
str(input_path),
str(output_path),
weights=weights
)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process parAcousti files.')
parser.add_argument('input_dir', help='Directory containing parAcousti files')
parser.add_argument('output_dir', help='Directory to save processed files')
parser.add_argument('--weights', default="TU", choices=['TU', 'All'],
help='Weight type to use (default: TU)')
args = parser.parse_args()
try:
status = process_paracousti_files(
args.input_dir,
args.output_dir,
weights=args.weights
)
print(f"Processing {'successful' if status else 'failed'}")
except Exception as e:
print(f"Error processing files: {e}")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds like a great idea. I like the code. I must have missed this before but let's make the default 'LFC' as opposed to 'TU'.
root: Optional[QgsLayerTreeGroup] = None, | ||
group: Optional[QgsLayerTreeGroup] = None, | ||
) -> None: # , ranges=True): | ||
subgroup: Optional[QgsLayerTreeGroup] = None, | ||
) -> None: | ||
"""Style and add the result layer to map.""" | ||
basename = os.path.splitext(os.path.basename(fpath))[0] | ||
if group is not None: | ||
vlayer = QgsRasterLayer(fpath, basename) | ||
QgsProject.instance().addMapLayer(vlayer) | ||
root = QgsProject.instance().layerTreeRoot() | ||
if stylepath is not None: | ||
vlayer.loadNamedStyle(stylepath) | ||
vlayer.triggerRepaint() | ||
vlayer.reload() | ||
layer = root.findLayer(vlayer.id()) | ||
vlayer = QgsRasterLayer(fpath, basename) | ||
QgsProject.instance().addMapLayer(vlayer) | ||
root = QgsProject.instance().layerTreeRoot() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tnelson-integral this root definition is overwriting any root passed to the function should this be:
if root is None:
root = QgsProject.instance().layerTreeRoot()
@tnelson-integral can you review and if everything looks good to you merge IntegralEnvision#18 so that all the tests on this PR will pass. |
Start of Acoustics Module update for weighting and exposure level.