### Bash Script for NoiseModelling Tutorial Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Get_Started_Script.html A Bash script to automate the 'Get Started - GUI' tutorial steps using NoiseModelling's ScriptRunner. It includes steps for uploading files, running noise calculations, and exporting results. ```bash 1#! /bin/bash 2 3# Run the get started turorial 4# https://noisemodelling.readthedocs.io/en/latest/Get_Started_Tutorial.html 5 6# Step 4: Upload files to database 7# create (or load existing) database and load a shape file into the database 8./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Import_File.groovy --pathFile resources/ground_type.shp 9./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Import_File.groovy --pathFile resources/buildings.shp 10./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Import_File.groovy --pathFile resources/receivers.shp 11./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Import_File.groovy --pathFile resources/ROADS2.shp 12./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Import_File.groovy --pathFile resources/dem.geojson 13 14 15# Step 5: Run Calculation 16./bin/ScriptRunner -w ./ -s scripts/NoiseModelling/Noise_level_from_traffic.groovy --tableBuilding BUILDINGS --tableRoads ROADS2 --tableReceivers RECEIVERS --tableDEM DEM --tableGroundAbs GROUND_TYPE 17 18# Step 6: Export (& see) the results 19./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Export_Table.groovy --exportPath RECEIVERS_LEVEL.shp --tableToExport RECEIVERS_LEVEL ``` -------------------------------- ### Run Docker Compose Source: https://noisemodelling.readthedocs.io/en/latest/Architecture.html Command to start NoiseModelling services using Docker Compose. Ensure Docker is installed and the docker-compose.yml file is in the current directory. ```bash docker compose up -d ``` -------------------------------- ### Run Podman Compose Source: https://noisemodelling.readthedocs.io/en/latest/Architecture.html Command to start NoiseModelling services using Podman Compose. Ensure Podman is installed and the docker-compose.yml file is in the current directory. ```bash podman compose up -d ``` -------------------------------- ### Check Java Version Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Requirements.html Verify if Java is installed and check its version. The output should start with '11' or a higher version number. ```bash java -version ``` -------------------------------- ### Run NoiseModelling GUI (Windows) Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Get_Started_GUI.html Execute this command in the terminal to start the NoiseModelling application and its local server on Windows. ```batch NoiseModelling.exe ``` ```batch NoiseModelling_xxx\start_windows.bat ``` -------------------------------- ### Run NoiseModelling GUI (Linux/Mac) Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Get_Started_GUI.html Execute this command in the terminal to start the NoiseModelling application and its local server on Linux or macOS. Ensure the script has execute permissions. ```bash NoiseModelling_xxx/start_linux_macos.sh ``` -------------------------------- ### Verify JAVA_HOME on Linux/Mac Source: https://noisemodelling.readthedocs.io/en/latest/_sources/Tutorial_Requirements.rst.txt Confirm that the JAVA_HOME environment variable has been set correctly. This command should output the configured Java installation directory. ```bash echo $JAVA_HOME ``` -------------------------------- ### Set JAVA_HOME and PATH on Linux Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Requirements.html Configure the JAVA_HOME environment variable and update the system's PATH to include the Java binary directory. Adapt the path to your specific Java installation. ```bash export JAVA_HOME=/usr/lib/jvm/java-22-openjdk-amd64 export PATH="$JAVA_HOME/bin:$PATH" ``` -------------------------------- ### Prepare Sensor Data using Prepare_Sensors Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Data_Assimilation.html Prepares sensor data for assimilation by extracting data within a specified time range and splitting it into training and validation sets. Requires start and end timestamps, training ratio, working folder path, and target SRID. ```Groovy new Prepare_Sensors().exec(connection,[ "startDate":"2024-08-25 06:30:00", "endDate": "2024-08-25 07:30:00", "trainingRatio": 0.8, "workingFolder": "./resources/dataAssimilation/", "targetSRID": 2056 ]) ``` -------------------------------- ### Verify JAVA_HOME on Linux/macOS Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Requirements.html Confirm that the JAVA_HOME environment variable has been set correctly. This command should output the path to your Java installation directory. ```bash echo $JAVA_HOME ``` -------------------------------- ### Execute a WPS Process with OwsLib Source: https://noisemodelling.readthedocs.io/en/latest/_sources/WPS_Builder.rst.txt Execute a specific process on a WPS server using the OwsLib Python library. This example demonstrates how to submit a process and retrieve its status. ```python from owslib.wps import WPSConnection, ProcessInputs, LiteralOutput # Connect to the WPS service wps = WPSConnection("http://localhost:8080/wps/WebProcessingService") # Get the process to execute process = wps.describeprocess("myProcessId") # Define inputs for the process inputs = ProcessInputs() inputs.add("myInput", literal=True, data=["myInputValue"]) # Execute the process asynchronously output = wps.execute("myProcessId", inputs, async_=True) # Print the status and links to monitor the job print(output.statusLocation) print(output.getlinks()) # To execute synchronously, remove async_=True and handle the result directly # output = wps.execute("myProcessId", inputs) # print(output.status) ``` -------------------------------- ### Import Shapefile to PostGIS using ScriptRunner Source: https://noisemodelling.readthedocs.io/en/latest/NoiseModellingOnPostGIS.html Use this command-line example to import a Shapefile into a PostGIS database via NoiseModelling's ScriptRunner. Ensure all necessary parameters like working directory, script path, database credentials, and file paths are correctly provided. ```bash ./bin/ScriptRunner \ -w /path/to/working/dir \ -s src/main/groovy/org/noise_planet/noisemodelling/scripts/Import_and_Export/Import_File.groovy \ -d noisemodelling_db \ -u noisemodelling \ -p noisemodelling \ --host localhost \ --port 5432 \ --pathFile /path/to/your/buildings.shp \ --tableName BUILDINGS ``` -------------------------------- ### Check Java Version on Linux/Mac Source: https://noisemodelling.readthedocs.io/en/latest/_sources/Tutorial_Requirements.rst.txt Verify if Java is installed and check its version. The command should output a version starting with '11' or higher. ```bash java -version ``` -------------------------------- ### Get Java Home Path on macOS Source: https://noisemodelling.readthedocs.io/en/latest/_sources/Tutorial_Requirements.rst.txt Retrieve the directory to be used as JAVA_HOME on macOS. This command helps locate the installed Java version. ```bash /usr/libexec/java_home -v latest ``` -------------------------------- ### Prepare Sensor Data with Groovy Source: https://noisemodelling.readthedocs.io/en/latest/_sources/Tutorial_Data_Assimilation.rst.txt Use this script to prepare sensor data by specifying time ranges, training ratios, working folders, and target SRID. Ensure all required parameters are correctly formatted. ```groovy new Prepare_Sensors().exec(connection,[ "startDate":"2024-08-25 06:30:00", "endDate": "2024-08-25 07:30:00", "trainingRatio": 0.8, "workingFolder": "./resources/dataAssimilation/", "targetSRID": 2056 ]) ``` -------------------------------- ### Get Java Home Directory on macOS Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Requirements.html Retrieve the directory path for the latest installed Java version on macOS. This is used to set the JAVA_HOME environment variable. ```bash /usr/libexec/java_home -v latest ``` -------------------------------- ### Run NoiseModelling Script with Arguments Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Get_Started_Script.html Execute a specific NoiseModelling WPS script using ScriptRunner from the terminal. Ensure the installation path and script paths are correct. This example imports a ground type shapefile. ```bash 1cd /home/user/NoiseModelling/ 2 3./bin/ScriptRunner -w ./ -s scripts/Import_and_Export/Import_File.groovy --pathFile resources/ground_type.shp ``` -------------------------------- ### Execute a WPS Process with OWSLib Source: https://noisemodelling.readthedocs.io/en/latest/WPS_Builder.html This script demonstrates how to execute a specific WPS process asynchronously using OWSLib. It includes setting up the connection, defining inputs, executing the process, and monitoring its progress. The script prints the results upon successful completion or an error message if it fails. Requires the OWSLib Python library. ```python import logging import sys from owslib.wps import WebProcessingService, monitorExecution def main(): # Configure the root logger to output to stdout logging.basicConfig(stream=sys.stdout, level=logging.INFO) url = "http://localhost:8000/builder/ows" # use java web token for authentification jwt_token = "" wps = WebProcessingService(url, skip_caps=False, headers={"Authorization": jwt_token}) target_id = "Database_Manager:Display_Database" inputs = [('showColumns', "true")] # Execute (sync or async) execution = wps.execute(target_id, inputs) # Monitor progress if it's a long task monitorExecution(execution, sleepSecs=2) if execution.isSucceded(): for output in execution.processOutputs: print(f"Result {output.identifier}: {output.data}") else: print("Execution failed.") if __name__ == "__main__": main() ``` -------------------------------- ### Example Point Source GeoJSON Source: https://noisemodelling.readthedocs.io/en/latest/_sources/Tutorial_Noise_Map_From_Point_Source.rst.txt This is an example of a GeoJSON file representing a single point source with its properties and geometry. ```json { "type": "FeatureCollection", "name": "Point_Source", "crs": {"type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::2154" } }, "features": [{"type": "Feature", "properties": { "PK": 1, "HZD500": 90.0 }, "geometry": {"type": "Point", "coordinates": [223771.0727, 6757583.2983, 0.0]} }] } ``` -------------------------------- ### Find Java Installation Path on Linux Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Requirements.html Determine the installation path of the Java executable on Linux systems. This path is used to set the JAVA_HOME environment variable. ```bash readlink -f "$(command -v java)" ``` -------------------------------- ### Execute All Possible Configuration WPS Block (Groovy) Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Data_Assimilation.html Execute the All_Possible_Configuration WPS script using a Groovy script. This method requires establishing a connection and passing traffic and temperature values as a map. ```groovy new All_Possible_Configuration().exec(connection,[ "trafficValues": "0.01,1.0,2.0", "temperatureValues": "10,15,20" ]) ``` -------------------------------- ### Execute All Possible Configuration WPS Block (CLI) Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Data_Assimilation.html Use this command to execute the All_Possible_Configuration WPS script via the command line. It requires the script path and parameters for traffic and temperature values. ```bash 1./bin/wps_scripts -w ./ -s scripts/Data_Assimilation/All_Possible_Configuration.groovy -trafficValues "0.01,1,2" -temperatureValues "10,15,20" ``` -------------------------------- ### Extract Best Configuration for Noise Simulation Source: https://noisemodelling.readthedocs.io/en/latest/_sources/Tutorial_Data_Assimilation.rst.txt Use the Extract_Best_Configuration WPS script to find the optimal simulation map by minimizing the difference between observed and simulated noise levels. ```groovy new Extract_Best_Configuration().exec(connection,[ "observationTable": "SENSORS_MEASUREMENTS_TRAINING", "noiseMapTable": "RECEIVERS_LEVEL", "tempToleranceThreshold" : 5 ]) ``` -------------------------------- ### Export Table with Export_Table Source: https://noisemodelling.readthedocs.io/en/latest/Tutorial_Data_Assimilation.html Use this block to export a specified table, for example, as a Shapefile, for visualization in GIS applications. Provide the export path and the table name to be exported. ```Groovy new Export_Table().exec(connection, ["exportPath": "results/ASSIMILATED_MAPS.shp", "tableToExport": "ASSIMILATED_MAPS" ]) ```