add to current data set

Moderators: davetaflin, salter, steve, jprenaud, straton, Chris Idso

louisJ
Expert
Posts: 97
Joined: Thu Mar 08, 2007 9:04 am
Location: France
Contact:

add to current data set

Postby louisJ » Mon Oct 08, 2007 8:43 am

Hi

I am trying to add data ( a variable ) to the current data set.
But this new zones containing this variable appends at the end of the existing zone list, whereas what I want is to add this new variable yo each existing zone.
How can I do?

Thanks.

Ben

Re: add to current data set

Postby Ben » Mon Oct 08, 2007 1:02 pm

Hi louisJ,
Are you trying to do this in an add-on, macro, or interactively?

louisJ
Expert
Posts: 97
Joined: Thu Mar 08, 2007 9:04 am
Location: France
Contact:

Re: add to current data set

Postby louisJ » Mon Oct 08, 2007 11:38 pm

Hi Ben

simply interactively for now.

Ben

Re: add to current data set

Postby Ben » Tue Oct 09, 2007 12:01 pm

Well, it's currently not directly possible, because none of the Tecplot's loaders have this ability. You could write a macro that loops over all the new zones, assigns the values for the new variables to the original zones, then deletes the new zones.

Out of curiosity, how do you end up in this situation? If you just want the ability to load additional variables from the original data files, you should probably be loading all the variables initially. The additional variables should not cause too much additional overhead due to Tecplot's load on demand feature.

louisJ
Expert
Posts: 97
Joined: Thu Mar 08, 2007 9:04 am
Location: France
Contact:

Re: add to current data set

Postby louisJ » Wed Oct 10, 2007 12:13 pm

I end up in this situation because I load a dataset, extract a variable to a file, work on it with matlab to make a new variable and write it to a file in tecplot format...this is this new file I want to add to the zones of the original dataset.

Ok so to be sure I understand well, I write a macro that:
-loads my initial dataset
-create an empty variable in each zone
using ( $!ALTERDATA
EQUATION = '{variable}=0' )
-loads the new file containing the new variable (de facto into news zones),
-assign the values of the new variable in the new zones to the empty variable created before.
-delete those new zones
is that ok?
In this process, how to assign the values of the variable in the new zones to the empty variable in the initial zones?

thanks
Last edited by louisJ on Wed Oct 10, 2007 1:40 pm, edited 1 time in total.

User avatar
aritzmann
Jedi Master
Posts: 127
Joined: Mon Nov 20, 2006 2:26 pm
Location: Princeton, NJ
Contact:

Re: add to current data set

Postby aritzmann » Wed Oct 10, 2007 12:58 pm

Hi,

There is a way to do this (through both a macro and the interface). Assuming that the new zones (which contain only this variable) are the same dimmensions as your old zone, then you could load the new data and then use a data alter equation to cause this to happen. It is a bit tedious (could be made more efficient through a macro).

The process would be as follows:
1. Load your existing data
2. Load the new data (appending to the existing data).
3. Data-->Alter-->Specify Equations
4. Enter an equation: {AddedVarName}={AddedVarName}[AppendedZone#]
You would need to do this by altering a single (target) zone at a time.
5. After all of the zones have been populated properly, delete the appended zones.

Let's assume that you have 2 zones existing with vars X, Y, Z and Omega. You use Matlab to create a new file which contains only the variable Gamma, and the matlab file has two zones which are the same dimmensions as the existing zones. Then you would do the following:
1. Load the file with X,Y,Z and Omega
2. Load the file from Matlab which has the Gamma data
3. Data-->Alter-->Specify Equations
4. {Gamma}={Gamma}[3]
Apply to only Zone 1
5. {Gamma} = {Gamma}[4]
Apply to only Zone 2
6. Delete zones 3 and 4 (which came from the second file).

Steps 4 and 5 are used to copy the data from zone 3 to zone 1 and from zone 4 to zone 2.
Andrew Ritzmann

Ben

Re: add to current data set

Postby Ben » Wed Oct 10, 2007 3:18 pm

louisJ wrote:Ok so to be sure I understand well, I write a macro that:
-loads my initial dataset
-create an empty variable in each zone
using ( $!ALTERDATA
EQUATION = '{variable}=0' )
-loads the new file containing the new variable (de facto into news zones),
-assign the values of the new variable in the new zones to the empty variable created before.
-delete those new zones
is that ok?

Yes, that is the general idea. Although you don't need to create the empty variable in each zone, since the data loader does that when you append the modified data file. So I would say your macro only needs to do the last three steps you listed.

In this process, how to assign the values of the variable in the new zones to the empty variable in the initial zones?

You can do this by using a data altar equation like Andrew described:

{AddedVarName}={AddedVarName}[AppendedZone#]

If you want to make the macro more generic, you can reference variables by number with this syntax:

Vnnn = Vnnn[AppendedZone#]

Where "nnn" is a variable number (like V1, V2, etc.). To get the syntax correct, I recommend recording yourself performing one such data alter equation interactively.

louisJ
Expert
Posts: 97
Joined: Thu Mar 08, 2007 9:04 am
Location: France
Contact:

Re: add to current data set

Postby louisJ » Fri Oct 12, 2007 6:58 am

Andrew, Ben,

Thank you, this works.

I now use a macro to do the loop on each zone:

$!LOOP |numberOfZonesAppended|
$!VarSet |initialNumberOfZonesPlusLoop| = |InitialNumberOfZones|
$!Verset |initialNumberOfZonesPlusLoop| += |LOOP|
$!ALTERDATA [|LOOP|]
EQUATION = '{Gamma}={Gamma}[|initialNumberOfZonesPlusLoop|]'
$!ENDLOOP


Thank you for your help through this!

Svetlana
Expert
Posts: 93
Joined: Sun Dec 22, 2013 3:08 pm
Location: Australia
Contact:

Re: add to current data set

Postby Svetlana » Thu Jan 09, 2014 8:28 pm

Ben wrote:Out of curiosity, how do you end up in this situation?


FFT writes Amplitude, Frequency, and Phrase to new variables in new zones, but I would prefer to reuse old zones. That's how I get there.

adnan7
Newbie
Posts: 1
Joined: Fri Jan 09, 2015 4:19 am
Location: Pakistan

Re: add to current data set

Postby adnan7 » Fri Jan 09, 2015 8:06 pm

I'm seeking to put info to the current info established.
Nevertheless this completely new specific zones made up of this varying appends at the end in the active sector number, while what I would like should be to put this completely new varying years old every single active sector.


Return to “Loading Data”

Who is online

Users browsing this forum: No registered users and 1 guest