Plugin SeaLab DataReshaper

From LabRPS Documentation
Revision as of 09:01, 25 January 2025 by LabRPS (talk | contribs) (Created page with "{{Plugin |Name=Data Reshaper Plugin |Description=This plugin allows the user to pick the data at all positions at a given time instance and reshape them into grid.. |Author=Koffi Daniel |Version=1.0 |Date=2024-04-15 |Features= Data Reshaper |RPSVersion=All }} == Introduction == This plugin allows the user to pick the data at all positions at a given time instance and reshape them into grid. == Data Reshaper == This is the only RPS feature that the...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Generic plugin icon. Create your personal icon with the same name of the plugin Data Reshaper Plugin

Description
This plugin allows the user to pick the data at all positions at a given time instance and reshape them into grid..

Plugin version: 1.0
Last modified: 2024-04-15
LabRPS version: All
Author: Koffi Daniel
Author
Koffi Daniel
Download
None
Features
Data Reshaper
Plugin Version
1.0
Date last modified
2024-04-15
LabRPS Version(s)
All
Default shortcut
None
See also
None

Introduction

This plugin allows the user to pick the data at all positions at a given time instance and reshape them into grid.

Data Reshaper

This is the only RPS feature that the plugin implements. It belongs to the table tool group. This feature allows the user to pick the data at all positions at a given time instance and reshape them into grid. Therefore, you need to make sure you simulate sea heights first. You can also import the sea heights from file. Note that if you use the mouse (GUI mode) to run this feature, you have to make sure the active window is the window containing the wind velocity data to be reshaped. The feature assesses the time index and uses it to pick all the data to be reshaped.

Properties

  • DataLengthNumberOfPoints: The number of points along the length of lthe grid.
  • DataWidthNumberOfPoints: The number of points along the width of lthe grid.
  • DataTimeIndex: The index of the time instant at with the data will be reshaped.

Scripting

import LabRPS
import SeaLabObjects
import SeaLabGui
import SeaLab
import GeneralToolsGui

# Before you run this macro, simulation must be run and there must be a table containing the simulated sea heights.
def checkResult():
    # Install the correlation checking tool
    installResuslt = SeaLab.installPlugin("DataReshaperPlugin")
    if not installResuslt:
        LabRPS.Console.PrintError("The installation of the DataReshaperPlugin has failed.\n")
        return None

    # Get the active simulation which as this time has been run already.   
    sim = SeaLabGui.getActiveSimulation()
    if not sim:
        LabRPS.Console.PrintError("No valid active simulation found.\n")
        return None
    
    # get the simulation data as list assuming that a simulation is run and 
    # the result is shown in an AlphaPlot table called "table". Please, edit this table name
    # according to the name of the table where your simulated data are stored.
    velocities = GeneralToolsGui.GeneralToolsPyTool.getTableByName("table")

    # create the correlation checking tool
    reshaper = SeaLabObjects.makeFeature("reshaper", sim.Name, "Data Reshaper", "Table Tool")
    
    # check if the created tool is good
    if not reshaper:
        LabRPS.Console.PrintError("The creation of the table tool was not successuful.\n")
        return None

    # run the tool
    sim.setActiveFeature(reshaper)        
    reshaperRest = sim.tableToolCompute(velocities)
    GeneralToolsGui.GeneralToolsPyTool.showArray(len(reshaperRest), len(reshaperRest[0]), reshaperRest, False)

checkResult()